44 #define TEXTUREINDEX "OriginalTexIndexMapping" 54 #include <OpenMesh/Core/Geometry/VectorT.hh> 60 #ifdef ENABLE_BSPLINECURVE_SUPPORT 64 #ifdef ENABLE_BSPLINESURFACE_SUPPORT 68 #include "Material.hh" 72 typedef int VertexHandle;
73 typedef int FaceHandle;
74 typedef std::vector<VertexHandle> VHandles;
75 typedef std::vector<OpenMesh::VertexHandle> OMVHandles;
98 FORCE_NOCOLOR = 1 << 8,
99 FORCE_NONORMALS = 1 << 9,
100 FORCE_NOTEXTURES = 1 << 10
103 typedef unsigned int ObjectOptions;
108 addGroup(
"DefaultGroup");
153 #ifdef ENABLE_BSPLINECURVE_SUPPORT 156 unsigned int numCurves() {
return curvesMap_.size(); }
158 void setCurveGroupId(
const unsigned int _count,
const int _id);
160 int getCurveGroupId(
const unsigned int _count);
162 void setCurveParentId(
const int _curveGroup,
const int _parentGroup);
164 int getCurveParentId(
const int _curveGroup);
167 #ifdef ENABLE_BSPLINECURVE_SUPPORT 170 unsigned int numSurfaces() {
return surfacesMap_.size(); }
172 void setSurfaceGroupId(
const unsigned int _count,
const int _id);
174 int getSurfaceGroupId(
const unsigned int _count);
176 void setSurfaceParentId(
const int _surfaceGroup,
const int _parentGroup);
178 int getSurfaceParentId(
const int _surfaceGroup);
188 void setNormal(
int _index,
int _normalID);
191 void addFace(
const VHandles& _indices);
194 void addFace(
const VHandles& _indices,
const std::vector<int>& _face_texcoords);
197 bool addFace(
const VHandles& _indices,
OpenMesh::FaceHandle &_outFH, std::vector< TriMesh::VertexHandle > &_outTriVertices, std::vector< PolyMesh::VertexHandle > &_outPolyVertices);
205 bool hasTexture(
int _objectID);
206 bool hasTextureCoords(
int _objectID);
207 bool isTriangleMesh(
int _objectID);
208 bool isPolyMesh(
int _objectID);
209 bool isCurve(
int _objectID);
210 bool isSurface(
int _objectID);
211 bool isNone(
int _objectID);
217 void setOption( ObjectOptionsE _option,
int _groupId);
221 unsigned int n_normals();
222 unsigned int n_texCoords();
242 const std::vector<std::string>
usedMaterials(
unsigned int _objectID);
243 void useMaterial( std::string _materialName );
250 void setPath(QString _path);
260 bool hasOption(
unsigned int _id, ObjectOptions _option );
266 int addGroup(
const QString& _groupName);
267 int groupId(
const QString& _groupName)
const;
268 unsigned int numGroups()
const {
return groupNames_.size(); }
269 const QString groupName(
const int _grpId)
const;
270 void setGroupName(
const int _grp,
const QString& _name);
272 void setCurrentGroup(
const int _current);
282 bool vertexListIsManifold(
const std::vector<PolyMesh::VertexHandle>& _vertices)
const;
285 std::vector< Vec3f > vertices_;
286 std::vector< Vec3f > normals_;
287 std::vector< Vec2f > texCoords_;
290 std::map<TriMesh::VertexHandle,TriMesh::Normal> storedTriHENormals_;
291 std::map<TriMesh::VertexHandle,PolyMesh::Normal> storedPolyHENormals_;
296 MaterialList materials_;
300 std::vector<QString> groupNames_;
304 std::vector<std::map< int, PolyMesh::VertexHandle > > vertexMapPoly_;
306 PolyMesh::FaceHandle addedFacePoly_;
309 std::vector<std::map< int, TriMesh::VertexHandle > > vertexMapTri_;
311 std::vector<std::vector< TriMesh::FaceHandle > > addedFacesTri_;
316 std::vector<TriMeshObject*> triMeshes_;
317 std::vector<PolyMeshObject*> polyMeshes_;
318 #ifdef ENABLE_BSPLINECURVE_SUPPORT 319 std::vector<BSplineCurveObject*> bSplineCurves_;
321 #ifdef ENABLE_BSPLINESURFACE_SUPPORT 322 std::vector<BSplineSurfaceObject*> bSplineSurfaces_;
325 std::vector< ObjectOptions > objectOptions_;
328 std::vector< std::vector< std::string > > usedMaterials_;
332 std::vector< std::map< int, VertexHandle > > usedVertices_;
336 std::vector< std::vector< OMVHandles > > invalidFaces_;
338 #ifdef ENABLE_BSPLINECURVE_SUPPORT 339 std::map<unsigned int, int> curvesMap_;
342 std::map<int, int> curveParentGroupMap_;
345 #ifdef ENABLE_BSPLINESURFACE_SUPPORT 346 std::map<unsigned int, int> surfacesMap_;
349 std::map<int, int> surfaceParentGroupMap_;
void forceMeshType(ObjectOptions _meshType)
force all meshes to be opened with specific type
QString path()
Path of the OBJ file.
void setObjectName(int _objectID, QString _name)
change the name of an object
BaseObject * object(int _groupId)
return object for the given group
TriMesh * currentTriMesh()
get a pointer to the active triMesh
void setVertexTexCoord(VertexHandle _vh, int _texCoordID)
set vertex texture coordinate
int addTexCoord(const Vec2f &_coord)
add texture coordinates
void setDegreeU(int _degree)
set degree
Vec3f vertex(unsigned int _index)
get vertex with given index
bool noOptions()
Return true if the importer has no options stored.
void addUsedVertices(int _groupId)
add all vertices that are used to the mesh (in correct order)
void setObject(BaseObject *_object, int _groupId)
add an object
int degreeV()
get current degree
int currentGroup()
Get the id of the current group.
void addFace(const VHandles &_indices)
add a face with indices _indices refering to vertices
unsigned int groupCount()
Number of groups currently stored in the importer.
void addMaterial(std::string _materialName)
Add a material.
MaterialList & materials()
return all loaded materials
const std::vector< std::string > usedMaterials(unsigned int _objectID)
used materials
void useVertex(int _vertex_index)
used vertices
int degreeU()
get current degree
void setDegreeV(int _degree)
set degree V direction
Handle for a face entity.
unsigned int n_vertices()
Global Properties.
void setObjectOptions(ObjectOptions _options)
PolyMesh * currentPolyMesh()
get a pointer to the active polyMesh
int addNormal(const Vec3f &_normal)
add a normal
void setNormal(int _index, int _normalID)
set vertex normal
bool hasOption(unsigned int _id, ObjectOptions _option)
check if object with given id has given option
void setOption(ObjectOptionsE _option)
Set Object Option.
VertexHandle addVertex(const Vec3f &_point)
add a vertex with coordinate _point
~OBJImporter()
base class needs virtual destructor
OBJImporter()
Constructor.
bool hasNormals(int _objectID)
Query Object Options.