Class hierarchy Compound list File list Compound Members File Members
Mesh Class Reference
A Mesh of triangles that represent an object in 3D Space. More...
Inherits Interface and Transformable.
List of all members.
Public Members
- virtual long render (Matrix3D* transform=NULL) = 0
- Render the object to the current scene using the transformation given by transform.
- virtual long status () = 0
- Returns status of object (0=ok, else error).
- virtual long orientSound (SoundBuffer* S) = 0
- Locate a 3D sound buffer in this object's location.
- virtual long collision (Mesh* O, Matrix3D* transform=NULL) = 0
- Check for collision with this object Returns a non-zero value if a collision is detected.
- virtual long advance (float Fraction) = 0
- Should be called from main world advance if blinking materials are used.
- virtual long setTexture (const char* Name, void* Texture) = 0
- Set a texture for this object.
- virtual long setPosition (float x, float y, float z) = 0
- Set the object's position.
- virtual long relocate (float dx, float dy, float dz) = 0
- Move the object relative to its current position.
- virtual long rotate (float ax, float ay, float az) = 0
- Rotate around any or all axes (angles in radians).
- virtual long align (Mesh* O) = 0
- Set the position and orientation according to this object.
- virtual Vector3D direction (float Size=1.0f) = 0
- Get direction vector, scaled to Size.
- virtual Vector3D direction_up (float Size=1.0f) = 0
- Get the up direction vector, scaled to Size.
- virtual float getRadius () = 0
- Get the object's rough radius, (non-optimized bounding sphere).
- virtual long setRadius (float Radius) = 0
- Set the object's radius, other than its actual one.
- virtual long exportXFile (ostream& os) = 0
- Exports the object to a text .X file.
- virtual long exportData (float* Vertices, int* VerticesNumber, short* Faces, int* FacesNumber, float* Materials, int* MaterialsNumber) = 0
- Exports the model's data to the supplied areas.
- virtual long addVertex (float x, float y, float z, float u=0.0f, float v=0.0f) = 0
- Add a vertex (point) at the specified position, optionally specifying texture coordinates.
- virtual int getSetupVerticesNumber () = 0
- Get how many vertices have been entered so far (useful for independent subobjects).
- virtual long setVertexTextureCoords (int index, float u=0.0f, float v=0.0f) = 0
- In case texture coords are loaded separately that the world coords, it is possible to set it later.
- virtual long addFace (short a, short b, short c, const char* MaterialName) = 0
- Add a triangle with a,b,c specifying the vertices that form this triangle and the material name specifies the material it is made of.
- virtual long addFace (short a, short b, short c, int MaterialNumber) = 0
- Same as the previous, but uses the index of the material instead, In case you don't have its name.
- virtual long addMaterial (const char* Name, ushort Diffuse, ushort Specular, ushort Emissive, float Power, void* Texture=NULL) = 0
- Add a material with the key name and the list of colors that make the material.
- virtual long addMaterial (const char* Name, void* MaterialDesc, void* Texture=NULL) = 0
- Add a material, used internally by the .X import.
- virtual long calculateNormals (Mesh* O, ProgressMonitor* PM=NULL) = 0
- This method can be used to calculate normals for models that have unordered faces.
- virtual long createReducedObject (Mesh* O, float Reduction=0.75f, ProgressMonitor* PM=NULL) = 0
- This method creates a copy of the current object, but reduces the polygon count approximately according to the reduction ratio.
- virtual long finalize (float JoinVertices=-1.0f) = 0
- Setup complete, prepare for rendering.
Related Functions
(Note that these are not member functions.)
- DLLExport Mesh* newMesh ()
- Create a new mesh object.
- DLLExport Mesh* newBillBoard ()
- Create a new BillBoard.
- DLLExport Mesh* newBillBoardSphere (float x, float y, float z, float Size, int Red, int Green, int Blue)
- Create a new BillBoard Sphere.
- DLLExport Mesh* newSphere (float x, float y, float z, float Size, void* Texture)
- Create a new Sphere.
- DLLExport long loadXFile (const char* Name, Mesh* O, TextureCache* TC=NULL, float Scale=1.0f)
- Loads the object from a .X file.
Detailed Description
A Mesh of triangles that represent an object in 3D Space.
The interface provides methods for: creating the mesh, moving it in 3D space and rendering it.
Member Function Documentation
virtual long Mesh::render(Matrix3D* transform=NULL) = 0 [pure virtual]
Render the object to the current scene using the transformation given by transform.
If transform == NULL,
the Mesh's own internal transform will be used.
virtual long Mesh::status() = 0 [pure virtual]
Returns status of object (0=ok, else error).
virtual long Mesh::orientSound(SoundBuffer* S) = 0 [pure virtual]
Locate a 3D sound buffer in this object's location.
virtual long Mesh::collision(Mesh* O, Matrix3D* transform=NULL) = 0 [pure virtual]
Check for collision with this object Returns a non-zero value if a collision is detected.
If transform ==
NULL, both this and Mesh O are to be transformed by their own internal
transformations; otherwise, the given transform is applied to O and is
assumed to be relative to this (no transform is applied to this).
virtual long Mesh::advance(float Fraction) = 0 [pure virtual]
Should be called from main world advance if blinking materials are used.
virtual long Mesh::setTexture(const char* Name, void* Texture) = 0 [pure virtual]
Set a texture for this object.
virtual long Mesh::setPosition(float x, float y, float z) = 0 [pure virtual]
Set the object's position.
virtual long Mesh::relocate(float dx, float dy, float dz) = 0 [pure virtual]
Move the object relative to its current position.
virtual long Mesh::rotate(float ax, float ay, float az) = 0 [pure virtual]
Rotate around any or all axes (angles in radians).
virtual long Mesh::align(Mesh* O) = 0 [pure virtual]
Set the position and orientation according to this object.
virtual Vector3D Mesh::direction(float Size=1.0f) = 0 [pure virtual]
Get direction vector, scaled to Size.
virtual Vector3D Mesh::direction_up(float Size=1.0f) = 0 [pure virtual]
Get the up direction vector, scaled to Size.
virtual float Mesh::getRadius() = 0 [pure virtual]
Get the object's rough radius, (non-optimized bounding sphere).
virtual long Mesh::setRadius(float Radius) = 0 [pure virtual]
Set the object's radius, other than its actual one.
virtual long Mesh::exportXFile(ostream& os) = 0 [pure virtual]
Exports the object to a text .X file.
virtual long Mesh::exportData(float* Vertices, int* VerticesNumber, short* Faces, int* FacesNumber, float* Materials, int* MaterialsNumber) = 0 [pure virtual]
Exports the model's data to the supplied areas.
Specify NULL for any parameter to skip retrieval of that info.
Vertices Array size should be 5 * VerticesNumber
Faces Array size should be 4 * FacesNumber
Materials Array size should be 17 * MaterialsNumber
virtual long Mesh::addVertex(float x, float y, float z, float u=0.0f, float v=0.0f) = 0 [pure virtual]
Add a vertex (point) at the specified position, optionally specifying texture coordinates.
virtual int Mesh::getSetupVerticesNumber() = 0 [pure virtual]
Get how many vertices have been entered so far (useful for independent subobjects).
virtual long Mesh::setVertexTextureCoords(int index, float u=0.0f, float v=0.0f) = 0 [pure virtual]
In case texture coords are loaded separately that the world coords, it is possible to set it later.
Vertex index is required.
virtual long Mesh::addFace(short a, short b, short c, const char* MaterialName) = 0 [pure virtual]
Add a triangle with a,b,c specifying the vertices that form this triangle and the material name specifies the material it is made of.
Note: The index order determines its visible side (Clockwise)
virtual long Mesh::addFace(short a, short b, short c, int MaterialNumber) = 0 [pure virtual]
Same as the previous, but uses the index of the material instead, In case you don't have its name.
virtual long Mesh::addMaterial(const char* Name, ushort Diffuse, ushort Specular, ushort Emissive, float Power, void* Texture=NULL) = 0 [pure virtual]
Add a material with the key name and the list of colors that make the material.
virtual long Mesh::addMaterial(const char* Name, void* MaterialDesc, void* Texture=NULL) = 0 [pure virtual]
Add a material, used internally by the .X import.
virtual long Mesh::calculateNormals(Mesh* O, ProgressMonitor* PM=NULL) = 0 [pure virtual]
This method can be used to calculate normals for models that have unordered faces.
It will copy itself onto 'O' and update the normals.
O must be a newly created object with no data.
virtual long Mesh::createReducedObject(Mesh* O, float Reduction=0.75f, ProgressMonitor* PM=NULL) = 0 [pure virtual]
This method creates a copy of the current object, but reduces the polygon count approximately according to the reduction ratio.
This is used for creating different Levels Of Details (LODs)
O must be a newly created object with no data.
virtual long Mesh::finalize(float JoinVertices=-1.0f) = 0 [pure virtual]
Setup complete, prepare for rendering.
This function must be run in order to process all data entered by the previous functions.
The 'JoinVertices' parameter determines if nearby vertices should be joined into one.
nearby is determined if the square distance is less than this parameter.
Therefore, -1.0 means 'No'
DLLExport Mesh* newMesh()
Create a new mesh object.
DLLExport Mesh* newBillBoard()
Create a new BillBoard.
This is a mesh that always faces the camera to allow 2D
art in the 3D World.
DLLExport Mesh* newBillBoardSphere(float x, float y, float z, float Size, int Red, int Green, int Blue)
Create a new BillBoard Sphere.
This is a a bill board that is simply a circle.
Coordinates specify the initial position for the mesh.
DLLExport Mesh* newSphere(float x, float y, float z, float Size, void* Texture)
Create a new Sphere.
This is not a bill board, but a real 3D Sphere.
Coordinates specify the initial position for the mesh.
Size is the radius of the sphere.
A texture can be applied and will wrap the sphere.
DLLExport long loadXFile(const char* Name, Mesh* O, TextureCache* TC=NULL, float Scale=1.0f)
Loads the object from a .X file.
name specifies file name
The documentation for this class was generated from the following files: