opal::MeshShapeData Class Reference

#include <MeshShapeData.h>

Inheritance diagram for opal::MeshShapeData:

opal::ShapeData List of all members.

Public Member Functions

OPAL_DECL MeshShapeData ()
OPAL_DECL MeshShapeData (const MeshShapeData &data)
virtual OPAL_DECL ~MeshShapeData ()
virtual OPAL_DECL void OPAL_CALL operator= (const MeshShapeData &data)
virtual OPAL_DECL void OPAL_CALL getLocalAABB (real aabb[6])

Public Attributes

realvertexArray
unsigned int numVertices
unsigned int * triangleArray
unsigned int numTriangles

Protected Attributes

real localAABB [6]

Detailed Description

A data structure describing a mesh Shape. A mesh is represented as an array of vertices and an array of triangles (the triangle array contains indices referring to vertices in the vertex array). The data pointers to these arrays must remain valid; OPAL simply stores pointers to the user-supplied arrays. Additionally, the arrays must be destroyed by the user when finished. It is critical that the size of the data type used in these arrays (i.e. OPAL real) matches the size of the data type expected by the underlying physics engine (don't mix floats with doubles). One limitation is that other Shapes can only collide with a mesh's surface. There is no concept of "inside" or "outside" a mesh (like there is with the primitive Shapes); an object that is "inside" a closed mesh surface will not be detected as a collision.

Definition at line 49 of file MeshShapeData.h.


Constructor & Destructor Documentation

OPAL_DECL opal::MeshShapeData::MeshShapeData  )  [inline]
 

Definition at line 52 of file MeshShapeData.h.

References localAABB, opal::MESH_SHAPE, opal::ShapeData::mType, numTriangles, numVertices, triangleArray, and vertexArray.

OPAL_DECL opal::MeshShapeData::MeshShapeData const MeshShapeData data  )  [inline]
 

Copy constructor.

Definition at line 68 of file MeshShapeData.h.

virtual OPAL_DECL opal::MeshShapeData::~MeshShapeData  )  [inline, virtual]
 

Definition at line 73 of file MeshShapeData.h.


Member Function Documentation

virtual OPAL_DECL void OPAL_CALL opal::MeshShapeData::getLocalAABB real  aabb[6]  )  [inline, virtual]
 

This recomputes the axis-aligned bounding box from the vertex data, so it should not be called very often.

Implements opal::ShapeData.

Definition at line 97 of file MeshShapeData.h.

virtual OPAL_DECL void OPAL_CALL opal::MeshShapeData::operator= const MeshShapeData data  )  [inline, virtual]
 

Makes a shallow copy, simply copying data pointers.

Definition at line 78 of file MeshShapeData.h.

References opal::ShapeData::contactGroup, opal::defaults::shape::contactGroup, localAABB, opal::ShapeData::material, opal::defaults::shape::material, opal::ShapeData::mType, numTriangles, numVertices, opal::ShapeData::offset, triangleArray, and vertexArray.


Member Data Documentation

real opal::MeshShapeData::localAABB[6] [protected]
 

The mesh's local axis-aligned bounding box. This array stores data in the following order: min x, max x, min y, max y, min z, max z. This will be updated automatically when the mesh is added to a Solid.

Definition at line 175 of file MeshShapeData.h.

Referenced by MeshShapeData(), and operator=().

unsigned int opal::MeshShapeData::numTriangles
 

The number of triangles in the mesh.

Definition at line 168 of file MeshShapeData.h.

Referenced by MeshShapeData(), and operator=().

unsigned int opal::MeshShapeData::numVertices
 

The number of vertices in the mesh.

Definition at line 154 of file MeshShapeData.h.

Referenced by MeshShapeData(), and operator=().

unsigned int* opal::MeshShapeData::triangleArray
 

Pointer to a 1-dimensional array of indexed triangles. This data must be allocated/deallocated by the user. The size of this array must be 3 * the number of triangles because each triangle uses 3 elements in the array. Each element is an index into the vertex array. To access the ith triangle's vertices, for example, triangleArray[i * 3] is the index for the 1st vertex, triangleArray[i* 3 + 1] is the index for the 2nd vertex, and triangleArray[i * 3 + 2] is the index for the 3rd vertex.

Definition at line 165 of file MeshShapeData.h.

Referenced by MeshShapeData(), and operator=().

real* opal::MeshShapeData::vertexArray
 

Pointer to a 1-dimensional array of vertices. This data must be allocated/deallocated by the user. The size of this array must be 3 * the number of vertices because each vertex uses 3 elements in the array. To access the ith vertex, for example, vertexArray[i * 3] is the x component, vertexArray[i* 3 + 1] is the y component, and vertexArray[i * 3 + 2] is the z component.

Definition at line 151 of file MeshShapeData.h.

Referenced by MeshShapeData(), and operator=().


The documentation for this class was generated from the following file:
Generated on Tue May 16 17:49:56 2006 for OPAL by  doxygen 1.4.6-NO