#include <vpmeshobject.h>
Inheritance diagram for VPMeshObject:
Public Member Functions | |
VPMeshObject () | |
VPMeshObject (const VPMeshObject &obj) | |
VPMeshObject & | operator= (const VPMeshObject &obj) |
void | SetMaterial (const VPMaterial &mat) |
Assigns a material to all meshes of the mesh object. | |
void | MakeBox (double minX, double maxX, double minY, double maxY, double minZ, double maxZ) |
Creates a box aligned with the 3 reference planes (XY, XZ and YZ). | |
void | GetYProjection (std::list< VPPoint4D > *resultPtr, double height=0) const |
Computes the projection of all vertices along the Y axis. | |
void | Optimize () |
void | Clear () |
Erases internal structures. | |
void | SetVertices (const std::vector< VPPoint4D > &vertexVec) |
Sets the vector of vertices. | |
void | SetVertices (const char *vertexStr) |
Sets the vector of vertices. | |
void | AddFace (const char *indexStr) |
Adds a face (a mesh of a single polygon) based on previously set vertices. | |
virtual void | ComputeBoundingBox () |
Computes the bounding box. | |
virtual TypeID | GetID () const |
void | MergeWith (const VPMeshObject &obj) |
All vertices, normals, meshes, etc. are copied inside the active object. | |
void | Transform (const VPTransform &trans) |
Apply Transformation to all vertices. | |
bool | IsEmpty () |
Checks whether the object contains geometry data. | |
Static Public Member Functions | |
static void | ComputeTriangleNormal (const VPPoint4D &v1, const VPPoint4D &v2, const VPPoint4D &v3, VPPoint4D *resultPtr) |
V1, V2 and V3 should be in counter clockwise order. | |
static void | ReadFromOBJ (const std::string &filename, std::list< VPMeshObject * > *resultPtr) |
Read VPMeshObjects from a Wavefront OBJ file. | |
Protected Member Functions | |
virtual bool | DrawInstanceOGL () const |
Non-recursive drawing - should be overriden by every derived clas. | |
Static Protected Member Functions | |
static void | ReadMaterialTable (const std::string &filename, std::map< std::string, VPMaterial > *matMapPtr) |
Protected Attributes | |
std::vector< VPPoint4D > | vertVec |
Vector of pointers to all vertices. | |
std::vector< double > | vertCoordVec |
Vector of all vertices (their coordinates in sequence). | |
std::vector< VPPoint4D > | normVec |
Vector of pointers to all normals. | |
std::vector< double > | normCoordVec |
Vector of all normals (their coordinates in sequence). | |
std::vector< float > | textCoordVec |
Vector of all texture coordinates. | |
std::list< VPMesh > | meshList |
List of Meshes. |
A mesh object, unlike other graphical objects, maintains information about every vertex, normals, texture coordinates and edges. This is the class of choice for creating objects from files or objects whose vertex are to be edited. A mesh object may be optimized for display, and in that case vertex editing will be no longer possible.
Definition at line 26 of file vpmeshobject.h.
|
Definition at line 32 of file vpmeshobject.cpp. |
|
Definition at line 36 of file vpmeshobject.cpp. References meshList, normCoordVec, normVec, textCoordVec, vertCoordVec, and vertVec. |
|
Adds a face (a mesh of a single polygon) based on previously set vertices. Creates a new Mesh of a single polygon, based on the indices found in indexStr. Indices start at zero. The vertices referenced should be in counter-clockwise order. No checking is done. Definition at line 112 of file vpmeshobject.cpp. References VPPoint4D::CrossProduct(), VPMesh::indexVec, meshList, VPPoint4D::Normalize(), VPMesh::normIndVec, normVec, VPMesh::POLYGON, VPMesh::type, and vertVec. |
|
Erases internal structures. Erases previous vertices, indices, normals, texture coordinates, etc. Use before a complete change in the object. Definition at line 57 of file vpmeshobject.cpp. References meshList, normCoordVec, normVec, textCoordVec, vertCoordVec, and vertVec. |
|
Computes the bounding box.
Implements VPGraphicObj. Definition at line 228 of file vpmeshobject.cpp. References VPGraphicObj::bBox, VPBoundingBox::ConditionalUpdate(), VPBoundingBox::SetBoundingBox(), vertCoordVec, and vertVec. Referenced by MakeBox(), MergeWith(), SetVertices(), and Transform(). |
|
V1, V2 and V3 should be in counter clockwise order.
Definition at line 301 of file vpmeshobject.cpp. References VPPoint4D::CrossProduct(), and VPPoint4D::Normalize(). |
|
Non-recursive drawing - should be overriden by every derived clas.
Reimplemented from VPSceneNode. Definition at line 311 of file vpmeshobject.cpp. References meshList, normCoordVec, normVec, VPGraphicObj::show, vertCoordVec, and vertVec. |
|
Reimplemented from VPSceneNode. Definition at line 91 of file vpmeshobject.h. References VPSceneNode::MESH_OBJECT. |
|
Computes the projection of all vertices along the Y axis.
Definition at line 197 of file vpmeshobject.cpp. References VPPoint4D::SetXYZW(). |
|
Checks whether the object contains geometry data. Returns true if the object contains no geometry data. Actually it checks whether the mesh list is empty, which should be enough for consistent mesh objects. Definition at line 117 of file vpmeshobject.h. References meshList. |
|
Creates a box aligned with the 3 reference planes (XY, XZ and YZ).
Definition at line 138 of file vpmeshobject.cpp. References ComputeBoundingBox(), VPGraphicObj::ComputeRecursiveBoundingBox(), VPMaterial::DARK_PLASTIC_GRAY(), VPMesh::indexVec, VPMesh::material, meshList, normCoordVec, VPMesh::QUADS, textCoordVec, VPMesh::type, and vertCoordVec. |
|
All vertices, normals, meshes, etc. are copied inside the active object.
Definition at line 249 of file vpmeshobject.cpp. References ComputeBoundingBox(), VPGraphicObj::ComputeRecursiveBoundingBox(), VPMesh::IncrementIndices(), meshList, normCoordVec, normVec, textCoordVec, vertCoordVec, and vertVec. |
|
Definition at line 46 of file vpmeshobject.cpp. References meshList, normCoordVec, normVec, textCoordVec, vertCoordVec, and vertVec. |
|
This method creates an internal representation that is optimized for display (currently aimed at OpenGL - optimized representation may not be usefull for other renderers such as Direct3D). After being optimized, old data is discarded and the object can no longer be edited. Definition at line 222 of file vpmeshobject.cpp. |
|
Read VPMeshObjects from a Wavefront OBJ file. This method creates mesh objects marked as auto-delete, ie, they will be automatically deleted if attached to scene. If not, the application programmer should delete them. |
|
|
|
Assigns a material to all meshes of the mesh object.
Definition at line 67 of file vpmeshobject.cpp. References meshList. |
|
Sets the vector of vertices. Parses all values in vertexStr and stores them into the MeshObject's internal representation. Parameter vertexStr should be set of points separated by commas, point coordinates should be separated by spaces, point may have 3 or 4 coordinates - ex.: "1.2 0.2 3.1, 2 3 4 1, 1 2 3" The MeshObject becomes unoptimized. The meshList is cleared. Definition at line 82 of file vpmeshobject.cpp. References ComputeBoundingBox(), VPGraphicObj::ComputeRecursiveBoundingBox(), meshList, VPPoint4D::SetXYZW(), and vertVec. |
|
Sets the vector of vertices. All vertices in vertexVec are copied into the MeshObject's internal representation. The MeshObject becomes unoptimized. The meshList is cleared. Definition at line 74 of file vpmeshobject.cpp. References ComputeBoundingBox(), VPGraphicObj::ComputeRecursiveBoundingBox(), meshList, and vertVec. |
|
Apply Transformation to all vertices.
Definition at line 274 of file vpmeshobject.cpp. References VPTransform::ApplyTo(), ComputeBoundingBox(), VPGraphicObj::ComputeRecursiveBoundingBox(), VPPoint4D::GetX(), VPPoint4D::GetY(), VPPoint4D::GetZ(), VPPoint4D::SetXYZW(), vertCoordVec, and vertVec. |
|
List of Meshes.
Definition at line 174 of file vpmeshobject.h. Referenced by AddFace(), Clear(), DrawInstanceOGL(), IsEmpty(), MakeBox(), MergeWith(), operator=(), SetMaterial(), SetVertices(), and VPMeshObject(). |
|
Vector of all normals (their coordinates in sequence). This is the optimized storage of normals. It must be a vector (not a list) because OpenGL will see it as a C array. Definition at line 165 of file vpmeshobject.h. Referenced by Clear(), DrawInstanceOGL(), MakeBox(), MergeWith(), operator=(), and VPMeshObject(). |
|
Vector of pointers to all normals. This is the unoptimized storage of normals. It must be a vector (not a list) because the internal meshes identifies vertices by integers. Definition at line 159 of file vpmeshobject.h. Referenced by AddFace(), Clear(), DrawInstanceOGL(), MergeWith(), operator=(), and VPMeshObject(). |
|
Vector of all texture coordinates. This is both the optimized and the unoptimized storage of texture coordinates. It must be a vector (not a list) because OpenGL will see it as a C array. Definition at line 171 of file vpmeshobject.h. Referenced by Clear(), MakeBox(), MergeWith(), operator=(), and VPMeshObject(). |
|
Vector of all vertices (their coordinates in sequence). This is the optimized storage of vertices. It must be a vector (not a list) because OpenGL will see it as a C array. Every 3 sucessive coordinates in the array describe a vertex in the object. Definition at line 153 of file vpmeshobject.h. Referenced by Clear(), ComputeBoundingBox(), DrawInstanceOGL(), MakeBox(), MergeWith(), operator=(), Transform(), and VPMeshObject(). |
|
Vector of pointers to all vertices. This is the unoptimized storage of vertices. It must be a vector (not a list) because the internal meshes identifies vertices by integers. Definition at line 146 of file vpmeshobject.h. Referenced by AddFace(), Clear(), ComputeBoundingBox(), DrawInstanceOGL(), MergeWith(), operator=(), SetVertices(), Transform(), and VPMeshObject(). |