# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CMesh Class Reference

An instanciable mesh. More...

#include <mesh.h>

Inheritance diagram for NL3D::CMesh:

NL3D::CMeshBase NL3D::IShape NLMISC::CRefCount NLMISC::IStreamable NLMISC::IClassable List of all members.

Public Methods

 CMesh ()
 Constructor. More...

 ~CMesh ()
 dtor. More...

 CMesh (const CMesh &mesh)
CMesh & operator= (const CMesh &mesh)
void build (CMeshBase::CMeshBaseBuild &mbase, CMeshBuild &mbuild)
 Build a mesh, replacing old. WARNING: This has a side effect of deleting AnimatedMaterials. More...

void build (CMeshBase::CMeshBaseBuild &mbuild, CMeshGeom &meshGeom)
 Build a mesh from material info, and a builded MeshGeom. WARNING: This has a side effect of deleting AnimatedMaterials. More...

void optimizeMaterialUsage (std::vector< sint > &remap)
 Optimize material use. More...

void setBlendShapes (std::vector< CBlendShape > &bs)
void computeBonesId (CSkeletonModel *skeleton)
 Compute skinning id. More...

void updateSkeletonUsage (CSkeletonModel *sm, bool increment)
 update Skeleton Usage. increment or decrement. More...

From IShape
virtual CTransformShapecreateInstance (CScene &scene)
 Create a CMeshInstance, which contains materials. More...

virtual bool clip (const std::vector< CPlane > &pyramid, const CMatrix &worldMatrix)
 clip this mesh in a driver. More...

virtual void render (IDriver *drv, CTransformShape *trans, bool opaquePass)
 render() this mesh in a driver. More...

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 serial this mesh. More...

 NLMISC_DECLARE_CLASS (CMesh)
virtual float getNumTriangles (float distance)
 get trinagle count. More...

virtual void getAABBox (NLMISC::CAABBox &bbox) const
 Get bbox. More...

Geometry accessors
const NLMISC::CAABBoxExtgetBoundingBox () const
 get the extended axis aligned bounding box of the mesh. More...

const CVertexBuffergetVertexBuffer () const
 get the vertex buffer used by the mesh. More...

uint getNbMatrixBlock () const
 get the number of matrix block. More...

uint getNbRdrPass (uint matrixBlockIndex) const
 get the number of rendering pass for a given matrix block. More...

const CPrimitiveBlockgetRdrPassPrimitiveBlock (uint matrixBlockIndex, uint renderingPassIndex) const
 get the primitive block associated with a rendering pass of a matrix block. More...

uint32 getRdrPassMaterial (uint matrixBlockIndex, uint renderingPassIndex) const
 get the material ID associated with a rendering pass of a matrix block. More...

const CMeshGeomgetMeshGeom () const
 Get the geom mesh. More...

Mesh Block Render Interface
virtual IMeshGeomsupportMeshBlockRendering (CTransformShape *trans, float &polygonCount) const
 return !NULL if this shape can support MeshBlock rendering for a special instance. More...


Private Attributes

CMeshGeom_MeshGeom

Detailed Description

An instanciable mesh.

Skinning support: support only palette skinning.

Author:
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 76 of file mesh.h.


Constructor & Destructor Documentation

NL3D::CMesh::CMesh  
 

Constructor.

Definition at line 2136 of file mesh.cpp.

References _MeshGeom.

NL3D::CMesh::~CMesh  
 

dtor.

Definition at line 2142 of file mesh.cpp.

References _MeshGeom.

NL3D::CMesh::CMesh const CMesh &    mesh
 

Definition at line 2150 of file mesh.cpp.

References _MeshGeom.


Member Function Documentation

void NL3D::CMesh::build CMeshBase::CMeshBaseBuild   mbuild,
CMeshGeom   meshGeom
 

Build a mesh from material info, and a builded MeshGeom. WARNING: This has a side effect of deleting AnimatedMaterials.

Definition at line 2214 of file mesh.cpp.

References _MeshGeom.

void NL3D::CMesh::build CMeshBase::CMeshBaseBuild   mbase,
CMeshBuild   mbuild
 

Build a mesh, replacing old. WARNING: This has a side effect of deleting AnimatedMaterials.

Definition at line 2173 of file mesh.cpp.

References _MeshGeom.

bool NL3D::CMesh::clip const std::vector< CPlane > &    pyramid,
const CMatrix &    worldMatrix
[virtual]
 

clip this mesh in a driver.

Reimplemented from NL3D::IShape.

Definition at line 2246 of file mesh.cpp.

References _MeshGeom.

void NL3D::CMesh::computeBonesId CSkeletonModel   skeleton
 

Compute skinning id.

Definition at line 2335 of file mesh.cpp.

References _MeshGeom, and nlassert.

CTransformShape * NL3D::CMesh::createInstance CScene   scene [virtual]
 

Create a CMeshInstance, which contains materials.

Reimplemented from NL3D::IShape.

Definition at line 2225 of file mesh.cpp.

References _MeshGeom.

virtual void NL3D::CMesh::getAABBox NLMISC::CAABBox   bbox const [inline, virtual]
 

Get bbox.

Reimplemented from NL3D::IShape.

Definition at line 267 of file mesh.h.

References NLMISC::CAABBoxExt::getAABBox, and getBoundingBox.

const NLMISC::CAABBoxExt & NL3D::CMesh::getBoundingBox   const
 

get the extended axis aligned bounding box of the mesh.

Definition at line 2294 of file mesh.cpp.

References _MeshGeom.

Referenced by getAABBox.

const CMeshGeom & NL3D::CMesh::getMeshGeom   const
 

Get the geom mesh.

Definition at line 2330 of file mesh.cpp.

References _MeshGeom.

uint NL3D::CMesh::getNbMatrixBlock   const
 

get the number of matrix block.

Definition at line 2304 of file mesh.cpp.

References _MeshGeom.

Referenced by optimizeMaterialUsage.

uint NL3D::CMesh::getNbRdrPass uint    matrixBlockIndex const
 

get the number of rendering pass for a given matrix block.

Parameters:
matrixBlockIndex  the index of the matrix block the rendering passes belong to

Definition at line 2309 of file mesh.cpp.

References _MeshGeom.

Referenced by optimizeMaterialUsage.

float NL3D::CMesh::getNumTriangles float    distance [virtual]
 

get trinagle count.

Implements NL3D::IShape.

Definition at line 2324 of file mesh.cpp.

uint32 NL3D::CMesh::getRdrPassMaterial uint    matrixBlockIndex,
uint    renderingPassIndex
const
 

get the material ID associated with a rendering pass of a matrix block.

Parameters:
matrixBlockIndex  the index of the matrix block the renderin pass belong to
renderingPassIndex  the index of the rendering pass in the matrix block

Definition at line 2319 of file mesh.cpp.

References _MeshGeom.

Referenced by optimizeMaterialUsage.

const CPrimitiveBlock & NL3D::CMesh::getRdrPassPrimitiveBlock uint    matrixBlockIndex,
uint    renderingPassIndex
const
 

get the primitive block associated with a rendering pass of a matrix block.

Parameters:
matrixBlockIndex  the index of the matrix block the renderin pass belong to
renderingPassIndex  the index of the rendering pass in the matrix block

Definition at line 2314 of file mesh.cpp.

References _MeshGeom.

const CVertexBuffer & NL3D::CMesh::getVertexBuffer   const
 

get the vertex buffer used by the mesh.

Definition at line 2299 of file mesh.cpp.

References _MeshGeom.

NL3D::CMesh::NLMISC_DECLARE_CLASS CMesh   
 

CMesh & NL3D::CMesh::operator= const CMesh &    mesh
 

Definition at line 2158 of file mesh.cpp.

References _MeshGeom, and NL3D::CMeshBase::CMeshBase.

void NL3D::CMesh::optimizeMaterialUsage std::vector< sint > &    remap
 

Optimize material use.

If a material in CMeshBase is not used by any renderPasses, it is removed, and ids are updated. WARNING: This has a side effect of deleting AnimatedMaterials.

Parameters:
remap  a remap material Id: newId= remap[oldId]. -1 means "no more used"

Definition at line 2184 of file mesh.cpp.

References _MeshGeom, getNbMatrixBlock, getNbRdrPass, getRdrPassMaterial, and size.

void NL3D::CMesh::render IDriver   drv,
CTransformShape   trans,
bool    opaquePass
[virtual]
 

render() this mesh in a driver.

Implements NL3D::IShape.

Definition at line 2253 of file mesh.cpp.

References _MeshGeom.

void NL3D::CMesh::serial NLMISC::IStream   f throw (NLMISC::EStream) [virtual]
 

serial this mesh.

Implements NLMISC::IStreamable.

Definition at line 2267 of file mesh.cpp.

void NL3D::CMesh::setBlendShapes std::vector< CBlendShape > &    bs
 

Definition at line 2208 of file mesh.cpp.

References _MeshGeom.

IMeshGeom * NL3D::CMesh::supportMeshBlockRendering CTransformShape   trans,
float &    polygonCount
const [virtual]
 

return !NULL if this shape can support MeshBlock rendering for a special instance.

NB: Mesh Block render cannot occurs if the Mesh is Skinned/MeshMorphed. NB: Mesh Block render can occurs only in Opaque pass NB: Mesh block render can occurs only for CMeshBase meshes.

Parameters:
trans  the instance to take into account (meshMultiLod may return NULL in blend transition).
polygonCount  the number of polygons to render for the meshGeom returned
Returns:
the meshgeom to render per block if OK, else NULL (default)

Reimplemented from NL3D::IShape.

Definition at line 2350 of file mesh.cpp.

References _MeshGeom.

void NL3D::CMesh::updateSkeletonUsage CSkeletonModel   sm,
bool    increment
 

update Skeleton Usage. increment or decrement.

Definition at line 2343 of file mesh.cpp.

References _MeshGeom, and nlassert.


Member Data Documentation

CMeshGeom* NL3D::CMesh::_MeshGeom [private]
 

Definition at line 314 of file mesh.h.

Referenced by build, clip, CMesh, computeBonesId, createInstance, getBoundingBox, getMeshGeom, getNbMatrixBlock, getNbRdrPass, getRdrPassMaterial, getRdrPassPrimitiveBlock, getVertexBuffer, operator=, optimizeMaterialUsage, render, setBlendShapes, supportMeshBlockRendering, updateSkeletonUsage, and ~CMesh.


The documentation for this class was generated from the following files: