The physical mesh class. More...
#include <VR3PhyMesh.h>
Classes | |
struct | Shape |
A shape in the physical object representation. More... | |
Public Member Functions | |
Constructor | |
VR3PhyMesh (const char *file_name, const char *mesh_name=0, int objID=-1) | |
Constructor of the class. | |
Destroying Function | |
void | Destroy () |
Pseudo-Destructor for the VR3Mesh Class. | |
Private Member Functions | |
VR3PhyMesh (const VR3PhyMesh &) | |
Disable default copy constructor. | |
VR3PhyMesh & | operator= (const VR3PhyMesh &) |
Disable default assignment operator. | |
Destructor | |
~VR3PhyMesh () | |
Destructor of the class. | |
Private Attributes | |
Physical Data | |
int | m_simtype |
Simulation type for the current physical mesh object. | |
int | m_shapenum |
Number of shapes. | |
Shape * | m_shapes |
Shapes associated with the VR3PhyMesh. | |
NxReal | m_mass |
Mass of the physical mesh material (used only for dynamic objects) | |
NxReal | m_sfri |
Static friction of the physical mesh material. | |
NxReal | m_dfri |
Dynamic friction of the physical mesh material. | |
NxReal | m_bou |
Bounciness of the physical mesh material. | |
NxReal | m_bbox_size [3] |
Size of the bounding box along the 3 axes. | |
Physical Mesh File Parameters | |
std::string | m_meshfile |
Name of the file the physical mesh was loaded from (absolute path) | |
std::string | m_name |
Name of the mesh object, extracted from the file. | |
int | m_ID |
ID of the physical mesh extracted from the file. | |
Friends | |
class | VR3PhyMeshManager |
Friend class VR3PhyMeshManager to access all private data members and the destructor. | |
class | VR3PhysicsSimulator |
Friend class VR3PhysicsSimulato to access the private data members. |
The physical mesh class.
The gemeometric representation used when drawing objects (their meshes) may be different from their physical representation used for simulation. This class contains the physical properties of a single AAM object, the user may create one physical meshes in order to supply them to the simulator (but usually it is not needed because done automatically).
Currently, physical meshes may only be loaded from AAM files. In case of static AAM objects, the physical mesh will have the same geometric properties as the non-physical mesh, in this case we actually reload the data. We desire to keep the VR3Mesh and the VR3PhyMesh as separate as possible because other file formats may handle static objects differently (with different geometric data).
A VR3PhyMesh always has a type that describes the sort of simulation the VR3PhyMesh is designed for (read from the mesh file):
Physical data stored for dynamic and kinematic object is represented by an array of convex shapes (each one with vertices and triangle indices), in case of static objects just one shape will be present and will not necessarily be a convex hull.
Definition at line 68 of file VR3PhyMesh.h.
VR3PhyMesh::VR3PhyMesh | ( | const VR3PhyMesh & | ) | [private] |
Disable default copy constructor.
VR3PhyMesh::~VR3PhyMesh | ( | ) | [private] |
Destructor of the class.
Deletes a VR3PhyMesh object. This is a private destructor because a VR3PhyMesh object may only be deleted by the VR3MeshManager static module, this will happen when the number of references to this physical mesh object drops to 0.
VR3PhyMesh::VR3PhyMesh | ( | const char * | file_name, |
const char * | mesh_name = 0 , |
||
int | objID = -1 |
||
) |
Constructor of the class.
Creates a new VR3PhyMesh object and initializes the object by loading the data from the mesh file specified through file_name. Currently, only AAM files are supported. The mesh_name specifies which physical object to load from the AAM file (perhaps representing the whole scene). The ID may be used to identify the desired object as well. If no objID or name is specified, the first object read in the file will be loaded. To specify a null name value but explicitly specify the desired objID, a name of 0 must be passed to the function (NULL).
[in] | file_name | The name of the mesh file to load |
[in] | mesh_name | The name of the object to load from the file |
[in] | objID | Object ID of the desired object in the AAM file |
void VR3PhyMesh::Destroy | ( | ) |
Pseudo-Destructor for the VR3Mesh Class.
When a dynamic instance of the VR3PhyMesh class is not used anymore by the programmer or by a physics simulator, we cannot delete the whole dynamic instance. Other entities may be using the object in dynamic memory and the only thing we must do is call the Destroy() functions in order to notify the VR3PhyMeshManager that a reference to a mesh object has been deleted. If the mesh is to be destroyed, the VR3PhyMeshManager will do that.
VR3PhyMesh& VR3PhyMesh::operator= | ( | const VR3PhyMesh & | ) | [private] |
Disable default assignment operator.
friend class VR3PhyMeshManager [friend] |
Friend class VR3PhyMeshManager to access all private data members and the destructor.
Definition at line 70 of file VR3PhyMesh.h.
friend class VR3PhysicsSimulator [friend] |
Friend class VR3PhysicsSimulato to access the private data members.
Definition at line 72 of file VR3PhyMesh.h.
NxReal VR3PhyMesh::m_bbox_size[3] [private] |
Size of the bounding box along the 3 axes.
Definition at line 111 of file VR3PhyMesh.h.
NxReal VR3PhyMesh::m_bou [private] |
Bounciness of the physical mesh material.
Definition at line 109 of file VR3PhyMesh.h.
NxReal VR3PhyMesh::m_dfri [private] |
Dynamic friction of the physical mesh material.
Definition at line 107 of file VR3PhyMesh.h.
int VR3PhyMesh::m_ID [private] |
ID of the physical mesh extracted from the file.
Definition at line 123 of file VR3PhyMesh.h.
NxReal VR3PhyMesh::m_mass [private] |
Mass of the physical mesh material (used only for dynamic objects)
Definition at line 103 of file VR3PhyMesh.h.
std::string VR3PhyMesh::m_meshfile [private] |
Name of the file the physical mesh was loaded from (absolute path)
Definition at line 119 of file VR3PhyMesh.h.
std::string VR3PhyMesh::m_name [private] |
Name of the mesh object, extracted from the file.
Definition at line 121 of file VR3PhyMesh.h.
NxReal VR3PhyMesh::m_sfri [private] |
Static friction of the physical mesh material.
Definition at line 105 of file VR3PhyMesh.h.
int VR3PhyMesh::m_shapenum [private] |
Number of shapes.
Definition at line 99 of file VR3PhyMesh.h.
Shape* VR3PhyMesh::m_shapes [private] |
Shapes associated with the VR3PhyMesh.
Definition at line 101 of file VR3PhyMesh.h.
int VR3PhyMesh::m_simtype [private] |
Simulation type for the current physical mesh object.
Definition at line 97 of file VR3PhyMesh.h.