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

Mesh with several LOD meshes. More...

#include <mesh_multi_lod.h>

Inheritance diagram for NL3D::CMeshMultiLod:

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

Public Methods

const IMeshGeomgetMeshGeom (uint slot) const
 Geometry accessor. More...

uint getNumSlotMesh () const
 Get slot mesh count. More...

IMeshGeomgetSlotMesh (uint i, bool &coarseMesh)
 Get a slot mesh. More...

bool isStatic () const
 Is static mesh ? More...

void changeMRMDistanceSetup (float distanceFinest, float distanceMiddle, float distanceCoarsest)
 Change MRM Distance setup of the Lod 0 only. More...

virtual float getNumTriangles (float distance)
 should not be called direclty as the intance of this shape will use 'getNumTrianglesWithCoarsestDist' themselves to get the correct distance. More...

float getNumTrianglesWithCoarsestDist (float distance, float coarsestMeshDist) const
Structures for building a multi lod mesh.
void build (CMeshMultiLodBuild &mbuild)
 Build a mesh from material info, and a builded MeshGeom. WARNING: This has a side effect of deleting AnimatedMaterials. 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 void getAABBox (NLMISC::CAABBox &bbox) const
 Get bbox. More...

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

 NLMISC_DECLARE_CLASS (CMeshMultiLod)
 Declare name of the shape. 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 Methods

void clear ()
 Clear the mesh. More...

void renderMeshGeom (uint slot, IDriver *drv, CMeshMultiLodInstance *trans, float numPoylgons, uint32 rdrFlags, float alpha, CCoarseMeshManager *manager)
 Render the MeshGeom of a slot, even if coarseMesh. More...

void renderCoarseMesh (uint slot, IDriver *drv, CMeshMultiLodInstance *trans, CCoarseMeshManager *manager)
 Render the CoarseMesh of a slot. must be a coarseMesh, and shoudl be called only in passOpaque. More...

void compileDistMax ()
 copileDistMax when builded/loaded. More...


Private Attributes

bool _StaticLod
 Static or dynamic load ? More...

std::vector< CMeshSlot_MeshVector
 Vector of meshes. More...


Friends

class CMeshMultiLodBalancingObs

Detailed Description

Mesh with several LOD meshes.

This mesh handle several meshes of any kind of shape (MRM, standard, coarse meshes..) At run time, it chooses what LOD meshes it must render according to its settings.

Author:
Cyril 'Hulud' Corvazier , Nevrax France
Date:
2001

Definition at line 52 of file mesh_multi_lod.h.


Member Function Documentation

void NL3D::CMeshMultiLod::build CMeshMultiLodBuild   mbuild
 

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

Definition at line 50 of file mesh_multi_lod.cpp.

References _MeshVector, _StaticLod, clear, compileDistMax, and nlassert.

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

Change MRM Distance setup of the Lod 0 only.

No op if the lod0 is not a CMeshMRMGeom 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 636 of file mesh_multi_lod.cpp.

References _MeshVector, and getNumSlotMesh.

void NL3D::CMeshMultiLod::clear   [private]
 

Clear the mesh.

Definition at line 452 of file mesh_multi_lod.cpp.

References _MeshVector.

Referenced by build.

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

clip this mesh in a driver.

Reimplemented from NL3D::IShape.

Definition at line 217 of file mesh_multi_lod.cpp.

References _MeshVector.

void NL3D::CMeshMultiLod::compileDistMax   [private]
 

copileDistMax when builded/loaded.

Definition at line 614 of file mesh_multi_lod.cpp.

References _MeshVector.

Referenced by build.

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

Create a CMeshInstance, which contains materials.

Reimplemented from NL3D::IShape.

Definition at line 192 of file mesh_multi_lod.cpp.

References _MeshVector.

void NL3D::CMeshMultiLod::getAABBox NLMISC::CAABBox   bbox const [virtual]
 

Get bbox.

Reimplemented from NL3D::IShape.

Definition at line 432 of file mesh_multi_lod.cpp.

References _MeshVector.

const IMeshGeom & NL3D::CMeshMultiLod::getMeshGeom uint    slot const
 

Geometry accessor.

Definition at line 626 of file mesh_multi_lod.cpp.

References _MeshVector, getNumSlotMesh, and nlassert.

uint NL3D::CMeshMultiLod::getNumSlotMesh   const [inline]
 

Get slot mesh count.

Definition at line 143 of file mesh_multi_lod.h.

References _MeshVector.

Referenced by changeMRMDistanceSetup, and getMeshGeom.

virtual float NL3D::CMeshMultiLod::getNumTriangles float    distance [inline, virtual]
 

should not be called direclty as the intance of this shape will use 'getNumTrianglesWithCoarsestDist' themselves to get the correct distance.

Implements NL3D::IShape.

Definition at line 179 of file mesh_multi_lod.h.

References getNumTrianglesWithCoarsestDist.

float NL3D::CMeshMultiLod::getNumTrianglesWithCoarsestDist float    distance,
float    coarsestMeshDist
const
 

Definition at line 369 of file mesh_multi_lod.cpp.

References _MeshVector.

Referenced by getNumTriangles.

IMeshGeom* NL3D::CMeshMultiLod::getSlotMesh uint    i,
bool &    coarseMesh
[inline]
 

Get a slot mesh.

Definition at line 149 of file mesh_multi_lod.h.

References _MeshVector.

bool NL3D::CMeshMultiLod::isStatic   const [inline]
 

Is static mesh ?

Definition at line 159 of file mesh_multi_lod.h.

References _StaticLod.

NL3D::CMeshMultiLod::NLMISC_DECLARE_CLASS CMeshMultiLod   
 

Declare name of the shape.

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

render() this mesh in a driver.

Implements NL3D::IShape.

Definition at line 238 of file mesh_multi_lod.cpp.

References _MeshVector, nlassert, renderCoarseMesh, and renderMeshGeom.

void NL3D::CMeshMultiLod::renderCoarseMesh uint    slot,
IDriver   drv,
CMeshMultiLodInstance   trans,
CCoarseMeshManager   manager
[private]
 

Render the CoarseMesh of a slot. must be a coarseMesh, and shoudl be called only in passOpaque.

Definition at line 544 of file mesh_multi_lod.cpp.

References _MeshVector, and nlassert.

Referenced by render.

void NL3D::CMeshMultiLod::renderMeshGeom uint    slot,
IDriver   drv,
CMeshMultiLodInstance   trans,
float    numPoylgons,
uint32    rdrFlags,
float    alpha,
CCoarseMeshManager   manager
[private]
 

Render the MeshGeom of a slot, even if coarseMesh.

Definition at line 494 of file mesh_multi_lod.cpp.

References _MeshVector, and alpha.

Referenced by render.

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

serial this mesh.

Implements NLMISC::IStreamable.

Definition at line 345 of file mesh_multi_lod.cpp.

IMeshGeom * NL3D::CMeshMultiLod::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 657 of file mesh_multi_lod.cpp.

References _MeshVector.


Friends And Related Function Documentation

friend class CMeshMultiLodBalancingObs [friend]
 

Definition at line 263 of file mesh_multi_lod.h.


Member Data Documentation

std::vector<CMeshSlot> NL3D::CMeshMultiLod::_MeshVector [private]
 

Vector of meshes.

Definition at line 249 of file mesh_multi_lod.h.

Referenced by build, changeMRMDistanceSetup, clear, clip, compileDistMax, createInstance, getAABBox, getMeshGeom, getNumSlotMesh, getNumTrianglesWithCoarsestDist, getSlotMesh, render, renderCoarseMesh, renderMeshGeom, and supportMeshBlockRendering.

bool NL3D::CMeshMultiLod::_StaticLod [private]
 

Static or dynamic load ?

Definition at line 246 of file mesh_multi_lod.h.

Referenced by build, and isStatic.


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