# 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::CMeshMRM Class Reference

An instanciable MRM mesh. More...

#include <mesh_mrm.h>

Inheritance diagram for NL3D::CMeshMRM:

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

Public Methods

 CMeshMRM ()
 Constructor. More...

void build (CMeshBase::CMeshBaseBuild &mBase, CMesh::CMeshBuild &m, std::vector< CMesh::CMeshBuild * > &listBS, const CMRMParameters &params=CMRMParameters())
 Build a mesh, replacing old. More...

void build (CMeshBase::CMeshBaseBuild &m, const CMeshMRMGeom &mgeom)
 Build a mesh, replacing old. More...

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

void computeBonesId (CSkeletonModel *skeleton)
 Compute skinning id. More...

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

void changeMRMDistanceSetup (float distanceFinest, float distanceMiddle, float distanceCoarsest)
 Change MRM Distance setup. 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 passOpaque)
 render() this mesh in a driver. More...

virtual float getNumTriangles (float distance)
 get an approximation of the number of triangles this instance will render for a fixed distance. More...

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

 NLMISC_DECLARE_CLASS (CMeshMRM)
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 mrm mesh. NB: this VB store all Vertices used by All LODs. More...

uint getNbLod () const
 get the number of LOD. More...

uint getNbRdrPass (uint lodId) const
 get the number of rendering pass of a LOD. More...

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

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

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


Private Attributes

CMeshMRMGeom _MeshMRMGeom

Detailed Description

An instanciable MRM mesh.

To build a CMeshMRM, you should:

NB: internally, build() use CMRMBuilder, a builder of MRM.

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 612 of file mesh_mrm.h.


Constructor & Destructor Documentation

NL3D::CMeshMRM::CMeshMRM  
 

Constructor.

Definition at line 2545 of file mesh_mrm.cpp.


Member Function Documentation

void NL3D::CMeshMRM::build CMeshBase::CMeshBaseBuild   m,
const CMeshMRMGeom   mgeom
 

Build a mesh, replacing old.

build from a CMeshBaseBuild (materials info) and a previously builded CMeshMRMGeom. WARNING: This has a side effect of deleting AnimatedMaterials. this is much slower than CMesh::build(), because it computes the MRM.

Parameters:
params  parameters of the MRM build process.

Definition at line 2560 of file mesh_mrm.cpp.

References _MeshMRMGeom.

void NL3D::CMeshMRM::build CMeshBase::CMeshBaseBuild   mBase,
CMesh::CMeshBuild   m,
std::vector< CMesh::CMeshBuild * > &    listBS,
const CMRMParameters   params = CMRMParameters()
 

Build a mesh, replacing old.

WARNING: This has a side effect of deleting AnimatedMaterials. this is much slower than CMesh::build(), because it computes the MRM.

Parameters:
params  parameters of the MRM build process.

Definition at line 2549 of file mesh_mrm.cpp.

References _MeshMRMGeom, and params.

void NL3D::CMeshMRM::changeMRMDistanceSetup float    distanceFinest,
float    distanceMiddle,
float    distanceCoarsest
 

Change MRM Distance setup.

NB: no-op if distanceFinest<0, distanceMiddle<=distanceFinest or if distanceCoarsest<=distanceMiddle.

Parameters:
distanceFinest  The MRM has its max faces when dist<=distanceFinest.
distanceMiddle  The MRM has 50% of its faces at dist==distanceMiddle.
distanceCoarsest  The MRM has faces/Divisor (ie near 0) when dist>=distanceCoarsest.

Definition at line 2680 of file mesh_mrm.cpp.

References _MeshMRMGeom.

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

clip this mesh in a driver.

Reimplemented from NL3D::IShape.

Definition at line 2615 of file mesh_mrm.cpp.

References _MeshMRMGeom.

void NL3D::CMeshMRM::computeBonesId CSkeletonModel   skeleton
 

Compute skinning id.

Definition at line 2668 of file mesh_mrm.cpp.

References _MeshMRMGeom.

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

Create a CMeshInstance, which contains materials.

Reimplemented from NL3D::IShape.

Definition at line 2595 of file mesh_mrm.cpp.

References _MeshMRMGeom.

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

Get bbox.

Reimplemented from NL3D::IShape.

Definition at line 674 of file mesh_mrm.h.

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

const NLMISC::CAABBoxExt& NL3D::CMeshMRM::getBoundingBox   const [inline]
 

get the extended axis aligned bounding box of the mesh.

Definition at line 683 of file mesh_mrm.h.

References _MeshMRMGeom.

Referenced by getAABBox.

const CMeshMRMGeom & NL3D::CMeshMRM::getMeshGeom   const
 

Get the mesh geom.

Definition at line 2661 of file mesh_mrm.cpp.

References _MeshMRMGeom.

uint NL3D::CMeshMRM::getNbLod   const [inline]
 

get the number of LOD.

Definition at line 694 of file mesh_mrm.h.

References _MeshMRMGeom.

Referenced by optimizeMaterialUsage.

uint NL3D::CMeshMRM::getNbRdrPass uint    lodId const [inline]
 

get the number of rendering pass of a LOD.

Parameters:
lodId  the id of the LOD.

Definition at line 700 of file mesh_mrm.h.

References _MeshMRMGeom.

Referenced by optimizeMaterialUsage.

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

get an approximation of the number of triangles this instance will render for a fixed distance.

Implements NL3D::IShape.

Definition at line 2654 of file mesh_mrm.cpp.

References _MeshMRMGeom.

uint32 NL3D::CMeshMRM::getRdrPassMaterial uint    lodId,
uint    renderingPassIndex
const [inline]
 

get the material ID associated with a rendering pass of a LOD.

Parameters:
lodId  the id of the LOD.
renderingPassIndex  the index of the rendering pass in the matrix block

Definition at line 717 of file mesh_mrm.h.

References _MeshMRMGeom.

Referenced by optimizeMaterialUsage.

const CPrimitiveBlock& NL3D::CMeshMRM::getRdrPassPrimitiveBlock uint    lodId,
uint    renderingPassIndex
const [inline]
 

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

Parameters:
lodId  the id of the LOD.
renderingPassIndex  the index of the rendering pass

Definition at line 707 of file mesh_mrm.h.

References _MeshMRMGeom.

const CVertexBuffer& NL3D::CMeshMRM::getVertexBuffer   const [inline]
 

get the vertex buffer used by the mrm mesh. NB: this VB store all Vertices used by All LODs.

Definition at line 689 of file mesh_mrm.h.

References _MeshMRMGeom.

NL3D::CMeshMRM::NLMISC_DECLARE_CLASS CMeshMRM   
 

void NL3D::CMeshMRM::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 2571 of file mesh_mrm.cpp.

References _MeshMRMGeom, getNbLod, getNbRdrPass, getRdrPassMaterial, and size.

void NL3D::CMeshMRM::render IDriver   drv,
CTransformShape   trans,
bool    passOpaque
[virtual]
 

render() this mesh in a driver.

Implements NL3D::IShape.

Definition at line 2622 of file mesh_mrm.cpp.

References _MeshMRMGeom.

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

serial this mesh.

Implements NLMISC::IStreamable.

Definition at line 2636 of file mesh_mrm.cpp.

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

update Skeleton Usage. increment or decrement.

Definition at line 2674 of file mesh_mrm.cpp.

References _MeshMRMGeom.


Member Data Documentation

CMeshMRMGeom NL3D::CMeshMRM::_MeshMRMGeom [private]
 

Definition at line 731 of file mesh_mrm.h.

Referenced by build, changeMRMDistanceSetup, clip, computeBonesId, createInstance, getBoundingBox, getMeshGeom, getNbLod, getNbRdrPass, getNumTriangles, getRdrPassMaterial, getRdrPassPrimitiveBlock, getVertexBuffer, optimizeMaterialUsage, render, and updateSkeletonUsage.


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