Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Mesh Class Reference

Class representing a triangle mesh. More...

#include <mesh.h>

Inherits Primitive.

Inheritance diagram for Mesh:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Mesh ()
 Creates a mesh primitive.
 Mesh (const std::string &filename, Material *m=0)
 Loads a mesh from the specified file.
virtual ~Mesh ()
 Destroys the mesh.
void load (const std::string &filename)
 Loads a mesh from the specified file.
void setMaterial (Material *m)
 Sets the material of the primitive to the material pointed to by m, or if m is 0, the material is set to the default material (diffuse gray).
MaterialgetMaterial () const
 Returns a pointer to the primitive's material.
void setTransform (Matrix &M)
 Manually set the local transform matrix to M.
void setTranslation (const Vector &T)
 Sets the translation of the node to T.
void setTranslation (float tx, float ty, float tz)
 Sets the translation of the node to (tx,ty,tz).
void setScale (float s)
 Sets the scale uniformly to s.
void setScale (const Vector &S)
 Sets the scale non-uniformly to S.
void setScale (float sx, float sy, float sz)
 Sets the scale non-uniformly to (sx,sy,sz).
void setRotation (const Vector &R)
 Sets the rotation about the x,y,z axes to the components of R.
void setRotation (float rx, float ry, float rz)
 Sets the rotation about the x,y,z axes to (rx,ry,rz) respectively.

Protected Types

typedef std::list< Node
* >::iterator 
t_itr
typedef std::list< Node
* >::const_iterator 
t_constitr

Protected Member Functions

void prepare ()
 Prepares the mesh for rendering by transforming all vertex positions/normals to world space.
void clear ()
 Clears all data associated with the mesh.
void loadOBJ (const std::string &filename)
 Loads a mesh file in the OBJ format.
void getGeometry (std::vector< Intersectable * > &geometry)
 Extract all intersectable geometry from the mesh, i.e.
void addChild (Node *child)
 Adds a node to the list of children.
bool hasChild (const Node *child) const
 Returns true if a specific node is a child of this node.
void setupTransform (const Matrix &world)
 Setup the local and world transform of the node.

Protected Attributes

std::vector< PointmVtxP
 Array of vertex positions.
std::vector< VectormVtxN
 Array of vertex normals.
std::vector< UVmVtxUV
 Array of vertex UV coordinates.
std::vector< TrianglemFaces
 Array of triangles.
bool mReady
 True if prepare() has been called.
MaterialmMaterial
 Ptr to the material used by the primitive.
Vector mT
 Translation.
Vector mS
 Scale.
Vector mR
 Rotation.
bool mTransformSet
 True if the local transform has been setup.
Matrix mLocalTransform
 Local transform, created from the T,S,R parameters.
Matrix mWorldTransform
 Object->World transform (local + inherited transform).
std::list< Node * > mChildren
 List of children attached to the Node.

Classes

struct  vertex
 Internal class representing the vertex indices. More...

Detailed Description

Class representing a triangle mesh.

The mesh can be loaded from an WaveFront .obj file.


The documentation for this class was generated from the following files:
Generated on Tue Mar 14 09:46:39 2006 for ASR by  doxygen 1.4.4