Developer Documentation
|
Public Types | |
enum | ObjectOptionsE { NONE = 0 , TRIMESH = 1 , POLYMESH = 1 << 1 , CURVE = 1 << 2 , SURFACE = 1 << 3 , NORMALS = 1 << 4 , TEXCOORDS = 1 << 5 , FACECOLOR = 1 << 6 , TEXTURE = 1 << 7 , FORCE_NOCOLOR = 1 << 8 , FORCE_NONORMALS = 1 << 9 , FORCE_NOTEXTURES = 1 << 10 } |
typedef unsigned int | ObjectOptions |
Public Member Functions | |
OBJImporter () | |
Constructor. More... | |
~OBJImporter () | |
base class needs virtual destructor More... | |
VertexHandle | addVertex (const Vec3d &_point) |
add a vertex with coordinate _point More... | |
Vec3d | vertex (unsigned int _index) |
get vertex with given index More... | |
int | addTexCoord (const Vec2f &_coord) |
add texture coordinates More... | |
int | addNormal (const Vec3d &_normal) |
add a normal More... | |
void | setDegreeU (int _degree) |
set degree More... | |
void | setDegreeV (int _degree) |
set degree V direction More... | |
int | degreeU () |
get current degree More... | |
int | degreeV () |
get current degree More... | |
void | setObject (BaseObject *_object, int _groupId) |
add an object More... | |
int | currentGroup () |
Get the id of the current group. More... | |
PolyMesh * | currentPolyMesh () |
get a pointer to the active polyMesh More... | |
TriMesh * | currentTriMesh () |
get a pointer to the active triMesh More... | |
void | addUsedVertices (int _groupId) |
add all vertices that are used to the mesh (in correct order) More... | |
void | setVertexTexCoord (VertexHandle _vh, int _texCoordID) |
set vertex texture coordinate More... | |
void | setNormal (int _index, int _normalID) |
set vertex normal More... | |
void | addFace (const VHandles &_indices) |
add a face with indices _indices refering to vertices More... | |
void | addFace (const VHandles &_indices, const std::vector< int > &_face_texcoords) |
add face and texture coordinates More... | |
void | forceMeshType (ObjectOptions _meshType) |
force all meshes to be opened with specific type More... | |
bool | hasNormals (int _objectID) |
Query Object Options. More... | |
bool | hasTexture (int _objectID) |
bool | hasTextureCoords (int _objectID) |
bool | isTriangleMesh (int _objectID) |
bool | isPolyMesh (int _objectID) |
bool | isCurve (int _objectID) |
bool | isSurface (int _objectID) |
bool | isNone (int _objectID) |
void | setOption (ObjectOptionsE _option) |
Set Object Option. More... | |
void | setOption (ObjectOptionsE _option, int _groupId) |
Set Object Option. More... | |
unsigned int | n_vertices () |
Global Properties. More... | |
unsigned int | n_normals () |
unsigned int | n_texCoords () |
unsigned int | groupCount () |
Number of groups currently stored in the importer. More... | |
BaseObject * | object (int _groupId) |
return object for the given group More... | |
MaterialList & | materials () |
return all loaded materials More... | |
void | addMaterial (std::string _materialName) |
Add a material. More... | |
const std::vector< std::string > | usedMaterials (unsigned int _objectID) |
used materials More... | |
void | useMaterial (std::string _materialName) |
void | useVertex (int _vertex_index) |
used vertices More... | |
QString | path () |
Path of the OBJ file. More... | |
void | setPath (QString _path) |
void | setObjectOptions (ObjectOptions _options) |
bool | noOptions () |
Return true if the importer has no options stored. More... | |
bool | hasOption (unsigned int _id, ObjectOptions _option) |
check if object with given id has given option More... | |
void | setObjectName (int _objectID, QString _name) |
change the name of an object More... | |
int | addGroup (const QString &_groupName) |
int | groupId (const QString &_groupName) const |
unsigned int | numGroups () const |
const QString | groupName (const int _grpId) const |
void | setGroupName (const int _grp, const QString &_name) |
void | setCurrentGroup (const int _current) |
int | currentGroup () const |
void | finish () |
Private Member Functions | |
bool | addFace (const VHandles &_indices, OpenMesh::FaceHandle &_outFH, std::vector< TriMesh::VertexHandle > &_outTriVertices, std::vector< PolyMesh::VertexHandle > &_outPolyVertices) |
bool | vertexListIsManifold (const std::vector< PolyMesh::VertexHandle > &_vertices) const |
Private Attributes | |
std::vector< Vec3d > | vertices_ |
std::vector< Vec3d > | normals_ |
std::vector< Vec2f > | texCoords_ |
std::map< TriMesh::VertexHandle, TriMesh::Normal > | storedTriHENormals_ |
std::map< TriMesh::VertexHandle, PolyMesh::Normal > | storedPolyHENormals_ |
int | degreeU_ |
int | degreeV_ |
MaterialList | materials_ |
QString | path_ |
std::vector< QString > | groupNames_ |
int | currentGroup_ |
std::vector< std::map< int, PolyMesh::VertexHandle > > | vertexMapPoly_ |
PolyMesh::FaceHandle | addedFacePoly_ |
std::vector< std::map< int, TriMesh::VertexHandle > > | vertexMapTri_ |
std::vector< std::vector< TriMesh::FaceHandle > > | addedFacesTri_ |
std::vector< TriMeshObject * > | triMeshes_ |
std::vector< PolyMeshObject * > | polyMeshes_ |
std::vector< ObjectOptions > | objectOptions_ |
std::vector< std::vector< std::string > > | usedMaterials_ |
std::vector< std::map< int, VertexHandle > > | usedVertices_ |
std::vector< std::vector< OMVHandles > > | invalidFaces_ |
Definition at line 85 of file OBJImporter.hh.
typedef unsigned int OBJImporter::ObjectOptions |
Definition at line 105 of file OBJImporter.hh.
enum OBJImporter::ObjectOptionsE |
Definition at line 89 of file OBJImporter.hh.
|
inline |
Constructor.
Definition at line 108 of file OBJImporter.hh.
OBJImporter::~OBJImporter | ( | ) |
base class needs virtual destructor
Definition at line 50 of file OBJImporter.cc.
void OBJImporter::addFace | ( | const VHandles & | _indices | ) |
add a face with indices _indices refering to vertices
Definition at line 464 of file OBJImporter.cc.
void OBJImporter::addFace | ( | const VHandles & | _indices, |
const std::vector< int > & | _face_texcoords | ||
) |
add face and texture coordinates
Definition at line 487 of file OBJImporter.cc.
|
private |
Definition at line 354 of file OBJImporter.cc.
int OBJImporter::addGroup | ( | const QString & | _groupName | ) |
Definition at line 939 of file OBJImporter.cc.
void OBJImporter::addMaterial | ( | std::string | _materialName | ) |
Add a material.
Definition at line 561 of file OBJImporter.cc.
int OBJImporter::addNormal | ( | const Vec3d & | _normal | ) |
add a normal
Definition at line 84 of file OBJImporter.cc.
int OBJImporter::addTexCoord | ( | const Vec2f & | _coord | ) |
add texture coordinates
Definition at line 75 of file OBJImporter.cc.
void OBJImporter::addUsedVertices | ( | int | _groupId | ) |
add all vertices that are used to the mesh (in correct order)
Definition at line 205 of file OBJImporter.cc.
VertexHandle OBJImporter::addVertex | ( | const Vec3d & | _point | ) |
add a vertex with coordinate _point
Definition at line 57 of file OBJImporter.cc.
int OBJImporter::currentGroup | ( | ) |
Get the id of the current group.
get id of the active object
OBJ files can contain groups which are handled inside OpenFlipper as separate Objects. When loading a file, the importer has to keep track of the current group and store a state for each group with its properties (materials) )
Definition at line 159 of file OBJImporter.cc.
int OBJImporter::currentGroup | ( | ) | const |
Definition at line 1001 of file OBJImporter.cc.
PolyMesh * OBJImporter::currentPolyMesh | ( | ) |
get a pointer to the active polyMesh
get the active polyMesh
Definition at line 167 of file OBJImporter.cc.
TriMesh * OBJImporter::currentTriMesh | ( | ) |
get a pointer to the active triMesh
get the active triMesh
Definition at line 175 of file OBJImporter.cc.
int OBJImporter::degreeU | ( | ) |
get current degree
Definition at line 108 of file OBJImporter.cc.
int OBJImporter::degreeV | ( | ) |
get current degree
Definition at line 115 of file OBJImporter.cc.
void OBJImporter::finish | ( | ) |
Finish up importing: Duplicate vertices of non-manifold faces and add new face as isolated one
Definition at line 1008 of file OBJImporter.cc.
void OBJImporter::forceMeshType | ( | ObjectOptions | _meshType | ) |
force all meshes to be opened with specific type
Definition at line 759 of file OBJImporter.cc.
unsigned int OBJImporter::groupCount | ( | ) |
Number of groups currently stored in the importer.
As OBJ files can contain several groups, we need to store information per group.
Definition at line 858 of file OBJImporter.cc.
int OBJImporter::groupId | ( | const QString & | _groupName | ) | const |
Definition at line 965 of file OBJImporter.cc.
const QString OBJImporter::groupName | ( | const int | _grpId | ) | const |
Definition at line 975 of file OBJImporter.cc.
bool OBJImporter::hasNormals | ( | int | _objectID | ) |
Query Object Options.
Definition at line 809 of file OBJImporter.cc.
bool OBJImporter::hasOption | ( | unsigned int | _id, |
ObjectOptions | _option | ||
) |
check if object with given id has given option
Definition at line 919 of file OBJImporter.cc.
bool OBJImporter::hasTexture | ( | int | _objectID | ) |
Definition at line 816 of file OBJImporter.cc.
bool OBJImporter::hasTextureCoords | ( | int | _objectID | ) |
Definition at line 823 of file OBJImporter.cc.
bool OBJImporter::isCurve | ( | int | _objectID | ) |
Definition at line 793 of file OBJImporter.cc.
bool OBJImporter::isNone | ( | int | _objectID | ) |
Definition at line 803 of file OBJImporter.cc.
bool OBJImporter::isPolyMesh | ( | int | _objectID | ) |
Definition at line 787 of file OBJImporter.cc.
bool OBJImporter::isSurface | ( | int | _objectID | ) |
Definition at line 799 of file OBJImporter.cc.
bool OBJImporter::isTriangleMesh | ( | int | _objectID | ) |
Definition at line 781 of file OBJImporter.cc.
MaterialList & OBJImporter::materials | ( | ) |
return all loaded materials
Definition at line 883 of file OBJImporter.cc.
unsigned int OBJImporter::n_normals | ( | ) |
Definition at line 846 of file OBJImporter.cc.
unsigned int OBJImporter::n_texCoords | ( | ) |
Definition at line 852 of file OBJImporter.cc.
unsigned int OBJImporter::n_vertices | ( | ) |
Global Properties.
Definition at line 840 of file OBJImporter.cc.
bool OBJImporter::noOptions | ( | ) |
Return true if the importer has no options stored.
Definition at line 912 of file OBJImporter.cc.
|
inline |
Definition at line 270 of file OBJImporter.hh.
BaseObject * OBJImporter::object | ( | int | _groupId | ) |
return object for the given group
Definition at line 864 of file OBJImporter.cc.
QString OBJImporter::path | ( | ) |
Path of the OBJ file.
Definition at line 889 of file OBJImporter.cc.
void OBJImporter::setCurrentGroup | ( | const int | _current | ) |
Definition at line 994 of file OBJImporter.cc.
void OBJImporter::setDegreeU | ( | int | _degree | ) |
void OBJImporter::setDegreeV | ( | int | _degree | ) |
set degree V direction
Definition at line 100 of file OBJImporter.cc.
void OBJImporter::setGroupName | ( | const int | _grp, |
const QString & | _name | ||
) |
Definition at line 985 of file OBJImporter.cc.
void OBJImporter::setNormal | ( | int | _index, |
int | _normalID | ||
) |
set vertex normal
Definition at line 303 of file OBJImporter.cc.
void OBJImporter::setObject | ( | BaseObject * | _object, |
int | _groupId | ||
) |
void OBJImporter::setObjectName | ( | int | _objectID, |
QString | _name | ||
) |
change the name of an object
Definition at line 929 of file OBJImporter.cc.
void OBJImporter::setObjectOptions | ( | ObjectOptions | _options | ) |
store an initial options object for an object containing info about the meshType
Definition at line 901 of file OBJImporter.cc.
void OBJImporter::setOption | ( | ObjectOptionsE | _option | ) |
Set Object Option.
Definition at line 829 of file OBJImporter.cc.
void OBJImporter::setOption | ( | ObjectOptionsE | _option, |
int | _groupId | ||
) |
Set Object Option.
Definition at line 834 of file OBJImporter.cc.
void OBJImporter::setPath | ( | QString | _path | ) |
Definition at line 895 of file OBJImporter.cc.
void OBJImporter::setVertexTexCoord | ( | VertexHandle | _vh, |
int | _texCoordID | ||
) |
set vertex texture coordinate
Definition at line 258 of file OBJImporter.cc.
const std::vector< std::string > OBJImporter::usedMaterials | ( | unsigned int | _objectID | ) |
used materials
Definition at line 1164 of file OBJImporter.cc.
void OBJImporter::useMaterial | ( | std::string | _materialName | ) |
Definition at line 1174 of file OBJImporter.cc.
void OBJImporter::useVertex | ( | int | _vertex_index | ) |
used vertices
Definition at line 1191 of file OBJImporter.cc.
Vec3d OBJImporter::vertex | ( | unsigned int | _index | ) |
get vertex with given index
Definition at line 64 of file OBJImporter.cc.
|
private |
Definition at line 474 of file OBJImporter.cc.
|
private |
Definition at line 308 of file OBJImporter.hh.
|
private |
Definition at line 313 of file OBJImporter.hh.
|
private |
Definition at line 303 of file OBJImporter.hh.
|
private |
Definition at line 295 of file OBJImporter.hh.
|
private |
Definition at line 296 of file OBJImporter.hh.
|
private |
Definition at line 302 of file OBJImporter.hh.
|
private |
Definition at line 338 of file OBJImporter.hh.
|
private |
Definition at line 298 of file OBJImporter.hh.
|
private |
Definition at line 288 of file OBJImporter.hh.
|
private |
Definition at line 327 of file OBJImporter.hh.
|
private |
Definition at line 300 of file OBJImporter.hh.
|
private |
Definition at line 319 of file OBJImporter.hh.
|
private |
Definition at line 293 of file OBJImporter.hh.
|
private |
Definition at line 292 of file OBJImporter.hh.
|
private |
Definition at line 289 of file OBJImporter.hh.
|
private |
Definition at line 318 of file OBJImporter.hh.
|
private |
Definition at line 330 of file OBJImporter.hh.
|
private |
Definition at line 334 of file OBJImporter.hh.
|
private |
Definition at line 306 of file OBJImporter.hh.
|
private |
Definition at line 311 of file OBJImporter.hh.
|
private |
Definition at line 287 of file OBJImporter.hh.