Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

RmMeshModel Class Reference

Mesh Class. More...

#include <RmMesh.h>

List of all members.

Public Member Functions

 RmMeshModel ()
 Constructor.

virtual ~RmMeshModel ()
 Destructor.

void GetGeometryStatistics (int &nNumVertices, int &nNumPrimitives)
 Compute polygonal statistics (number of vertices, primitives).

RmVertexArrayGetVertexArray ()
 Get vertex array.

const RmVertexArrayGetVertexArray () const
 Get vertex array.

void SetPrimitiveType (RmPrimitiveType type)
 Set primitive type.

RmPrimitiveType GetPrimitiveType () const
 Get primitive type.

int GetNumPrimitives () const
 Get primitive type.

void SetNumIndices (int nNumIndices, bool bPreserve=true)
 Set number of indices.

int GetNumIndices () const
 Get number of indices.

RM_DWORD * GetIndices ()
 Get index buffer.

const RM_DWORD * GetIndices () const
 Get index buffer.

void GetIndicesForPrimitive (int nPrimitiveIndex, RM_DWORD *pIndices)
 Get indices for primitive.

void SetParent (RmMeshModel *pParent)
 Set parent.

RmMeshModelGetParent ()
 Get parent.

const RmMeshModelGetParent () const
 Get parent.

RmMeshModelListIterator BeginChildren ()
 Begin iterator.

RmMeshModelListConstIterator BeginChildren () const
 Begin iterator.

RmMeshModelListIterator EndChildren ()
 End iterator.

RmMeshModelListConstIterator EndChildren () const
 End iterator.

int GetNumChildren () const
 Get number of children.

void AddChild (RmMeshModel *pChild)
 Add child.

void RemoveChild (RmMeshModel *pChild, bool bDelete)
 Remove child.

RmMeshModelListIterator RemoveChild (RmMeshModelListIterator itr, bool bDelete)
 Remove child.

void RemoveAllChildren ()
 Remove all children.

RmMatrix4x4GetLocalTM ()
 Model transformation.

const RmMatrix4x4GetLocalTM () const
const RmMatrix4x4GetWorldTM ()
 Model to world transformation.

void NotifyTMChange ()
 Notify transformation change.

bool ComputeNormals (int usageIndex, int *pSortedIndices=NULL, bool bBlendDegenVertices=false)
 Compute normals.

bool ComputeTangents (int usageIndex, int *pSortedIndices=NULL)
 Compute tangent and binormal.

int * CreateSortedVertexIndices (RmVertexElementArray *pPosElementtArray)
 Create sorted indices for vertices.

void DestroySortedVertexIndices (int *pSortedIndices)
 Destroy sorted vertex indices.

void Copy (RmMeshModel *pDestMesh, RmMeshModelContainer *pContainer)
 Copy mesh model.

void SetBoundBoxDirty (bool bDirty)
 Set boundbox dirty flag.

void UpdateBoundBox ()
 Update Boundbox.

RmBoundBoxGetBoundBox ()
 Get bounding box.

bool GetBoundSphere (RmVector3D &center, float &radius)
 Retrieve bounding sphere.

void SetCentroidDirty (bool bDirty)
 Set centroid dirty flag.

void UpdateCentroid ()
 Recompute centroid.

RmVector3DGetCentroid ()
 Get centroid.

RmVector3D GetSumOfAllVertices (int &totalNumVertices)
 Sum of all vertices.

void TransformVertices (const RmMatrix4x4 &mat)
 Transform all vertices by matrix.


Detailed Description

Mesh Class.

Mesh Class


Constructor & Destructor Documentation

RmMeshModel::RmMeshModel  ) 
 

Constructor.

Constructor

virtual RmMeshModel::~RmMeshModel  )  [virtual]
 

Destructor.

Destructor


Member Function Documentation

void RmMeshModel::AddChild RmMeshModel pChild  ) 
 

Add child.

Add child mesh

Parameters:
pChild Child mesh to add
Returns:
None

RmMeshModelListConstIterator RmMeshModel::BeginChildren  )  const [inline]
 

Begin iterator.

Returns an iterator to the beginning of a list of child meshes

Returns:
Begin iterator

RmMeshModelListIterator RmMeshModel::BeginChildren  )  [inline]
 

Begin iterator.

Returns an iterator to the beginning of a list of child meshes

Returns:
Begin iterator

bool RmMeshModel::ComputeNormals int  usageIndex,
int *  pSortedIndices = NULL,
bool  bBlendDegenVertices = false
 

Compute normals.

Normal

  • Usage Index determines which normal to compute. If Normal does not exist, returns false. pSortedIndices is the indices for vertex sorted by x,y,z Can be NULL.

eg. if usageIndex is 2, NORMAL2 will be computed for each vertex ( assuminng that NORMAL2 exist ) using POSITION2

Note * Only works with dataType = FLOAT3

Parameters:
nUsageIndex Usage index for Normal
pSortedIndices Array of indices sorted
bBlendDegenVertices Flag to blend normals of vertices that are close together
Returns:
True on success

bool RmMeshModel::ComputeTangents int  usageIndex,
int *  pSortedIndices = NULL
 

Compute tangent and binormal.

pSortedIndices is the indices for vertex sorted by x,y,z Can be NULL.

Parameters:
usageIndex Which of tangent and binormal to compute 0 for TANGENT0 and BINORMAL0 1 for TANGENT1 and BINORMAL1 etc
pSortedIndices Array of indices sorted
Returns:
True on success

void RmMeshModel::Copy RmMeshModel pDestMesh,
RmMeshModelContainer pContainer
 

Copy mesh model.

Copy ( copies data to destination )

Parameters:
pDestMesh Destination mesh to copy to
pContainer Container of destination mesh
Returns:
None

int* RmMeshModel::CreateSortedVertexIndices RmVertexElementArray pPosElementtArray  ) 
 

Create sorted indices for vertices.

Create sorted vertexindices

  • Sorted indices are array of indices to vertex which are sorted in space. ( from smallest to biggest in xyz )

Parameters:
pPosElementtArray Which element array to create sort indices for
Returns:
Array of sorted indices

void RmMeshModel::DestroySortedVertexIndices int *  pSortedIndices  ) 
 

Destroy sorted vertex indices.

Deallocates memory created by CreateSortedVertexIndices

See also:
CreateSortedVertexIndices
Parameters:
pSortedIndices Array of sorted indices

RmMeshModelListConstIterator RmMeshModel::EndChildren  )  const [inline]
 

End iterator.

Returns an iterator to the Ending of a list of child meshes

Returns:
End iterator

RmMeshModelListIterator RmMeshModel::EndChildren  )  [inline]
 

End iterator.

Returns an iterator to the Ending of a list of child meshes

Returns:
End iterator

RmBoundBox& RmMeshModel::GetBoundBox  ) 
 

Get bounding box.

Get bounding box. If dirty flag is set, it calls update to recompute boundbox

Returns:
Boundbox

bool RmMeshModel::GetBoundSphere RmVector3D center,
float &  radius
 

Retrieve bounding sphere.

Get bounding sphere. Returns false if bound sphere is empty

Returns:
True if bound sphere is not empty

RmVector3D& RmMeshModel::GetCentroid  ) 
 

Get centroid.

Get centroid of mesh. If the dirty flag is set, it calls UpdateCentroid to recompute centroid.

Returns:
Centroid position

void RmMeshModel::GetGeometryStatistics int &  nNumVertices,
int &  nNumPrimitives
 

Compute polygonal statistics (number of vertices, primitives).

Compute polygonal statistics (number of vertices, primitives) for this model container. Note: this method INCREMENTS the incoming nNumVertices and nNumPrimitives, so to start counting from the very beginning, they must be manually reset by the caller of this method.

Parameters:
nNumVertices Number of vertices in this mesh
nNumPrimitives Number of primitives in this mesh
Returns:
None

const RM_DWORD* RmMeshModel::GetIndices  )  const [inline]
 

Get index buffer.

Get index buffer

Returns:
Index buffer

RM_DWORD* RmMeshModel::GetIndices  )  [inline]
 

Get index buffer.

Get index buffer

Returns:
Index buffer

void RmMeshModel::GetIndicesForPrimitive int  nPrimitiveIndex,
RM_DWORD *  pIndices
 

Get indices for primitive.

Caller is responsible for having enough memory for pIndices for PrimitiveType. Eg. If PrimType is Triangle, pIndices must be able to store 3 dword. Likewise if Line, 2 dword

Parameters:
nPrimitiveIndex Primitive index
pIndices Indices returned
Returns:
None

RmMatrix4x4& RmMeshModel::GetLocalTM  )  [inline]
 

Model transformation.

Model ( local )Transformation

Returns:
Reference to model matrix

int RmMeshModel::GetNumChildren  )  const [inline]
 

Get number of children.

Returns the number of child meshes

Returns:
Number of children

int RmMeshModel::GetNumIndices  )  const [inline]
 

Get number of indices.

Get number of indices

Returns:
Number of vertices

int RmMeshModel::GetNumPrimitives  )  const
 

Get primitive type.

Get primitive type

Returns:
Primitive type
See also:
RmPrimitiveType

const RmMeshModel* RmMeshModel::GetParent  )  const [inline]
 

Get parent.

Retrieve parent to mesh model

Returns:
Parent modesh model

RmMeshModel* RmMeshModel::GetParent  )  [inline]
 

Get parent.

Retrieve parent to mesh model

Returns:
Parent modesh model

RmPrimitiveType RmMeshModel::GetPrimitiveType  )  const [inline]
 

Get primitive type.

Get primitive type

Returns:
Primitive type
See also:
RmPrimitiveType

RmVector3D RmMeshModel::GetSumOfAllVertices int &  totalNumVertices  ) 
 

Sum of all vertices.

Add all vertices ( xyz ) and return the result

Parameters:
totalNumVertices Nuber gets increased by how many vertices gets added
Returns:
Sum of all vertices

const RmVertexArray* RmMeshModel::GetVertexArray  )  const [inline]
 

Get vertex array.

Vertex Array

Returns:
Vertex array

RmVertexArray* RmMeshModel::GetVertexArray  )  [inline]
 

Get vertex array.

Vertex Array

Returns:
Vertex array

const RmMatrix4x4& RmMeshModel::GetWorldTM  ) 
 

Model to world transformation.

Model ( local ) to world Transformation

Returns:
Reference to model to world matrix

void RmMeshModel::NotifyTMChange  ) 
 

Notify transformation change.

Let system know that transformation of this mesh is changed

Returns:
None

void RmMeshModel::RemoveAllChildren  ) 
 

Remove all children.

Remove all children

Returns:
None

RmMeshModelListIterator RmMeshModel::RemoveChild RmMeshModelListIterator  itr,
bool  bDelete
 

Remove child.

Remove child mesh

Parameters:
Itr Child iterator for mesh to remove
bDelete Flag to delete memory of child
Returns:
Next iterator from deleted mesh ( EndIterator, if last element is removed

void RmMeshModel::RemoveChild RmMeshModel pChild,
bool  bDelete
 

Remove child.

Remove child mesh

Parameters:
pChild Child mesh to remove
bDelete Flag to delete memory of child
Returns:
None

void RmMeshModel::SetBoundBoxDirty bool  bDirty  ) 
 

Set boundbox dirty flag.

BoundBox ( currently only use POSITION0 data, must be float3 )

Parameters:
bDirty True to set boundbox dirty ( so it GetBoundBox will recomoute )
Returns:
None

void RmMeshModel::SetCentroidDirty bool  bDirty  ) 
 

Set centroid dirty flag.

Set centroid dirty flag. Set this to true, if vertices are modified.

Parameters:
bDirty Flag to set centroid dirty
Returns:
None

void RmMeshModel::SetNumIndices int  nNumIndices,
bool  bPreserve = true
 

Set number of indices.

Set index buffer size

Parameters:
nNumIndices Number of indices
bPreserve Flag to preserve already allocated data
Returns:
None

void RmMeshModel::SetParent RmMeshModel pParent  ) 
 

Set parent.

Asssign new parent to mesh model

Returns:
None

void RmMeshModel::SetPrimitiveType RmPrimitiveType  type  )  [inline]
 

Set primitive type.

Primitive Type

Parameters:
type Primitive type
See also:
RmPrimitiveType
Returns:
None

void RmMeshModel::TransformVertices const RmMatrix4x4 mat  ) 
 

Transform all vertices by matrix.

Transform vertices by a given matrix

Note that this method currently only transforms using the POSITION0 and NORMAL0 stream data (element arrays) for the mesh mode, which also must be of type float3.

Parameters:
mat Matrix to use for transform
Returns:
None

void RmMeshModel::UpdateBoundBox  ) 
 

Update Boundbox.

Recomputes bound box

Returns:
None

void RmMeshModel::UpdateCentroid  ) 
 

Recompute centroid.

Recompute centroid

Returns:
None


The documentation for this class was generated from the following file:
Generated on Fri Feb 25 16:09:10 2005 for RenderMonkey SDK by doxygen 1.3.6