Class hierarchy Compound list File list Compound Members File Members
MeshBuilder Class Reference
The MeshBuilder interface is used to construct objects from scratch. More...
Inherits Interface.
List of all members.
Public Members
- virtual void clear () = 0
- This clears all vertex, face and material information.
- virtual long status () const = 0
- return status code.
- virtual long addVertex (const Vector3D& p, const fVector2D& t=fVector2D()) = 0
- Add a vertex (point) at the specified position, optionally specifying texture coordinates.
- virtual int getSetupVerticesNumber () const = 0
- Get how many vertices have been entered so far (useful for independent subobjects).
- virtual long setVertexTextureCoords (const int index, const fVector2D& t=fVector2D(0.0f, 0.0f)) = 0
- In case texture coords are loaded separately from the world coords, it is possible to set them later.
- virtual long addFace (const short a, const short b, const short c, const char* MaterialName, const int MaterialNumber=-1) = 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 (const short a, const short b, const short c, const 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, const TColor Diffuse, const TColor Specular, const TColor Emissive, const float Power, Texture* 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, const void* MaterialDesc, Texture* texture=NULL) = 0
- Add a material, used internally by the .X import.
- virtual long rebuild (const Mesh* m) = 0
- This enters the vertex, face and material information into MeshBuilder from Mesh m.
- virtual MeshBuilder* calculateNormals (ProgressMonitor* PM=NULL) const = 0
- This method can be used to calculate normals for models that have unordered faces.
- virtual MeshBuilder* createReducedObject (const float Reduction=0.75f, ProgressMonitor* PM=NULL) const = 0
- This method creates a copy of the current object, but reduces the polygon count approximately according to the reduction ratio.
- virtual void setBillBoard (int flag=1) = 0
- this determines whether finalize() will output a normal or a billboard mesh.
- virtual int getBillBoard () const = 0
- get billboard state.
- virtual Mesh* createMesh (const float JoinVertices=-1.0f, const float GouraudThreshold=fPI) = 0
- Setup complete, generate a Mesh.
- virtual Mesh* createSphere (const Vector3D& pos, const float Size, Texture* texture, int Inv=0) = 0
- Create a new Sphere.
- virtual Mesh* createBillBoardSphere (const Vector3D& pos, const float Size, const int Red, const int Green, const int Blue) = 0
- Create a new BillBoard Sphere.
Detailed Description
The MeshBuilder interface is used to construct objects from scratch.
It need not be used when loading objects from .X files.
Member Function Documentation
virtual void MeshBuilder::clear() = 0 [pure virtual]
This clears all vertex, face and material information.
Use after finalize() to start building a new (fresh) mesh.
virtual long MeshBuilder::status() const = 0 [pure virtual]
virtual long MeshBuilder::addVertex(const Vector3D& p, const fVector2D& t=fVector2D()) = 0 [pure virtual]
Add a vertex (point) at the specified position, optionally specifying texture coordinates.
virtual int MeshBuilder::getSetupVerticesNumber() const = 0 [pure virtual]
Get how many vertices have been entered so far (useful for independent subobjects).
virtual long MeshBuilder::setVertexTextureCoords(const int index, const fVector2D& t=fVector2D(0.0f, 0.0f)) = 0 [pure virtual]
In case texture coords are loaded separately from the world coords, it is possible to set them later.
vertex index is required.
virtual long MeshBuilder::addFace(const short a, const short b, const short c, const char* MaterialName, const int MaterialNumber=-1) = 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 MeshBuilder::addFace(const short a, const short b, const short c, const 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 MeshBuilder::addMaterial(const char* Name, const TColor Diffuse, const TColor Specular, const TColor Emissive, const float Power, Texture* texture=NULL) = 0 [pure virtual]
Add a material with the key name and the list of colors that make the material.
virtual long MeshBuilder::addMaterial(const char* Name, const void* MaterialDesc, Texture* texture=NULL) = 0 [pure virtual]
Add a material, used internally by the .X import.
virtual long MeshBuilder::rebuild(const Mesh* m) = 0 [pure virtual]
This enters the vertex, face and material information into MeshBuilder from Mesh m.
Note that the vertices are trasnformed by the Mesh's m_Transform
before adding them.
virtual MeshBuilder* MeshBuilder::calculateNormals(ProgressMonitor* PM=NULL) const = 0 [pure virtual]
This method can be used to calculate normals for models that have unordered faces.
It returns a new MeshBuilder filled with the modified info.
virtual MeshBuilder* MeshBuilder::createReducedObject(const float Reduction=0.75f, ProgressMonitor* PM=NULL) const = 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).
It returns a new MeshBuilder filled with the modified info.
virtual void MeshBuilder::setBillBoard(int flag=1) = 0 [pure virtual]
this determines whether finalize() will output a normal or a billboard mesh.
billboard Mesh's are always oriented to face the camera (used for 2D artwork in a 3D world).
default parameter of 1 means 'yes' (create billboards).
virtual int MeshBuilder::getBillBoard() const = 0 [pure virtual]
virtual Mesh* MeshBuilder::createMesh(const float JoinVertices=-1.0f, const float GouraudThreshold=fPI) = 0 [pure virtual]
Setup complete, generate a Mesh.
This function must be run in order to process all data entered by the previous functions and
produces a new Mesh.
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'. GouraudThreshold (GT) determines the angle (in radians) between faces
at which Gouraud shading should be applied (vertex normals are averaged when the angle is <= GT).
In default situation (GT=fPI), a faster normal calculation method is used (the normals of
all faces sharing a vertex are averaged without regard to the angle between them).
finalize() returns the newly genertaed Mesh. If it returns NULL, an error occured.
Chech status() for the cause. finalize() does not modify the setup face, vertex or matarial
info so it may be called multiple times to produce incrementally built models or ones
with different materials or texture coords.
virtual Mesh* MeshBuilder::createSphere(const Vector3D& pos, const float Size, Texture* texture, int Inv=0) = 0 [pure virtual]
Create a new Sphere.
This is not a billboard, 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.
virtual Mesh* MeshBuilder::createBillBoardSphere(const Vector3D& pos, const float Size, const int Red, const int Green, const int Blue) = 0 [pure virtual]
Create a new BillBoard Sphere.
This is a a billboard that is simply a circle.
Coordinates specify the initial position for the mesh.
Note: this function clears MeshBuilder before and after generation.
The documentation for this class was generated from the following file: