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

An MRM mesh geometry, with no materials information. More...

#include <mesh_mrm.h>

Inheritance diagram for NL3D::CMeshMRMGeom:

NL3D::IMeshGeom NLMISC::IStreamable NLMISC::IClassable List of all members.

RawSkin optimisation.

uint NumCacheVertexNormal1 = NL_BlockByteL1 / sizeof(CRawVertexNormalSkin1)
uint NumCacheVertexNormal2 = NL_BlockByteL1 / sizeof(CRawVertexNormalSkin2)
uint NumCacheVertexNormal4 = NL_BlockByteL1 / sizeof(CRawVertexNormalSkin4)
void updateRawSkinNormal (bool enabled, CMeshMRMInstance *mi, sint curLodId)
 compute RawSkin info in the MRMInstance according to current skin setup. More...

void dirtMeshDataId ()
 Increment the refCount, so instances RawSkins are no longer valid. More...

void applyArrayRawSkinNormal1 (CRawVertexNormalSkin1 *src, uint8 *destVertexPtr, CMatrix3x4 *boneMat3x4, uint vertexSize, uint nInf)
void applyArrayRawSkinNormal2 (CRawVertexNormalSkin2 *src, uint8 *destVertexPtr, CMatrix3x4 *boneMat3x4, uint vertexSize, uint nInf)
void applyArrayRawSkinNormal3 (CRawVertexNormalSkin4 *src, uint8 *destVertexPtr, CMatrix3x4 *boneMat3x4, uint vertexSize, uint nInf)
void applyArrayRawSkinNormal4 (CRawVertexNormalSkin4 *src, uint8 *destVertexPtr, CMatrix3x4 *boneMat3x4, uint vertexSize, uint nInf)
void applyArrayRawSkinNormal1 (CRawVertexNormalSkin1 *src, uint8 *destVertexPtr, CMatrix3x4SSE *boneMat3x4, uint vertexSize, uint nInf)
void applyArrayRawSkinNormal2 (CRawVertexNormalSkin2 *src, uint8 *destVertexPtr, CMatrix3x4SSE *boneMat3x4, uint vertexSize, uint nInf)
void applyArrayRawSkinNormal3 (CRawVertexNormalSkin4 *src, uint8 *destVertexPtr, CMatrix3x4SSE *boneMat3x4, uint vertexSize, uint nInf)
void applyArrayRawSkinNormal4 (CRawVertexNormalSkin4 *src, uint8 *destVertexPtr, CMatrix3x4SSE *boneMat3x4, uint vertexSize, uint nInf)
uint _MeshDataId
 Each time the mesh is loaded/built, this increment. More...


Hard VB

void updateVertexBufferHard (IDriver *drv, uint32 numVertices)
void deleteVertexBufferHard ()
void fillAGPSkinPartWithVBHardPtr (CLod &lod, uint8 *vertexDst)
CRefPtr< IVertexBufferHard_VBHard
CRefPtr< IDriver_Driver
bool _VertexBufferHardDirty
bool _PreciseClipping
 NB: HERE FOR PACKING ONLY. For clipping. Estimate if we must do a Precise clipping (ie with bboxes). More...


Public Methods

 CMeshMRMGeom ()
 Constructor. More...

 ~CMeshMRMGeom ()
void build (CMesh::CMeshBuild &m, std::vector< CMesh::CMeshBuild * > &bsList, uint numMaxMaterial, const CMRMParameters &params=CMRMParameters())
 Build a mesh, replacing old. More...

void applyMaterialRemap (const std::vector< sint > &remap)
 change materials Ids (called from CMesh::optimizeMaterialUsage()). More...

void changeMRMDistanceSetup (float distanceFinest, float distanceMiddle, float distanceCoarsest)
 Change MRM Distance setup. More...

const CMRMLevelDetailgetLevelDetail () const
 get the MRM level detail information. More...

From IMeshGeom
virtual void initInstance (CMeshBaseInstance *mbi)
 Init instance info. More...

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

virtual void render (IDriver *drv, CTransformShape *trans, float polygonCount, uint32 rdrFlags, float globalAlpha)
 render() this mesh in a driver, given an instance and his materials. More...

virtual void renderSkin (CTransformShape *trans, float alphaMRM)
 render() this mesh as a skin. 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 meshGeom. More...

 NLMISC_DECLARE_CLASS (CMeshMRMGeom)
Lod management.
uint getNbLodLoaded () const
 get the number of LOD currently loaded. More...

void loadFirstLod (NLMISC::IStream &f)
 Load the header and the first lod of a MRM in a stream. More...

void loadNextLod (NLMISC::IStream &f)
 Load next lod of a stream. More...

void unloadNextLod (NLMISC::IStream &f)
 UnLoad Lod getNbLodLoaded()-1 from memory. 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...

const std::vector< CMesh::CSkinWeight > & getSkinWeights () const
 get the skinWeights used by the mrm mesh. NB: same size of the vertexBuffer. empty if !isSkinned(). More...

const std::vector< std::string > & getBonesName () const
 get the bone names of the meshMRM. 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 std::vector< CMRMWedgeGeom > & getGeomorphs (uint lodId) const
 Advanced. get the geomorphs for a special lod. More...

Skinning Behavior
bool isSkinned () const
 Return true if the mesh is skinned, else return false. More...

void computeBonesId (CSkeletonModel *skeleton)
 If the mesh is skinned, still use normal CVertexBuffer. More...

void updateSkeletonUsage (CSkeletonModel *sm, bool increment)
 update Skeleton Usage. increment or decrement. computeBonesId must has been called before. More...

const std::vector< sint32 > & getSkinBoneUsage () const
 return array of bones used by the skin. computeBonesId must has been called before. More...

Mesh Block Render Implementation
virtual bool supportMeshBlockRendering () const
 true if this meshGeom support meshBlock rendering. More...

virtual bool sortPerMaterial () const
 true if the sort criterion must be by material. More...

virtual uint getNumRdrPasses () const
 return the number of renderPasses for this mesh. More...

virtual void beginMesh (CMeshGeomRenderContext &rdrCtx)
 The framework call this method when he will render instances of this meshGeom soon. More...

virtual void activeInstance (CMeshGeomRenderContext &rdrCtx, CMeshBaseInstance *inst, float polygonCount)
 The framework call this method any time a change of instance occurs. More...

virtual void renderPass (CMeshGeomRenderContext &rdrCtx, CMeshBaseInstance *inst, float polygonCount, uint rdrPass)
 The framework call this method to render the current renderPass, with the current instance NB: if the material is blended, DON'T render it!! More...

virtual void endMesh (CMeshGeomRenderContext &rdrCtx)
 The framework call this method when it has done with this meshGeom. More...

Special SkinGrouping Rendering
bool supportSkinGrouping () const
sint renderSkinGroupGeom (CMeshMRMInstance *mi, float alphaMRM, uint remainingVertices, uint8 *vbDest)
void renderSkinGroupPrimitives (CMeshMRMInstance *mi, uint baseVertex)

Private Methods

void serialLodVertexData (NLMISC::IStream &f, uint startWedge, uint endWedge)
 serial a subset of the vertices. More...

sint chooseLod (float alphaMRM, float &alphaLod)
 choose the lod according to the alphaMRM [0,1] given. More...

void applyGeomorph (std::vector< CMRMWedgeGeom > &geoms, float alphaLod, IVertexBufferHard *currentVBHard)
 Apply the geomorph to the _VBuffer, or the VBhard, if exist/used. More...

void applyGeomorphWithVBHardPtr (std::vector< CMRMWedgeGeom > &geoms, float alphaLod, uint8 *vertexDestPtr)
 Apply the geomorph to the VBhard ptr, if not NULL. More...

void applyGeomorphPosNormalUV0 (std::vector< CMRMWedgeGeom > &geoms, uint8 *vertexPtr, uint8 *vertexDestPtr, sint32 vertexSize, float a, float a1)
 Faster, but common geomorph apply. More...

void bkupOriginalSkinVertices ()
 Skinning: bkup Vertex/Normal into _OriginalSkin* from VBuffer. More...

void bkupOriginalSkinVerticesSubset (uint wedgeStart, uint wedgeEnd)
void restoreOriginalSkinVertices ()
 Skinning: restore Vertex/Normal from _OriginalSkin* to VBuffer. More...

void applySkin (CLod &lod, const CSkeletonModel *skeleton)
 Skinning: Apply skinning to the _VBuffer (before geomorph). More...

void applySkinWithNormal (CLod &lod, const CSkeletonModel *skeleton)
 The same as apply skin, but with normal modified. More...

void applySkinWithNormalSSE (CLod &lod, const CSkeletonModel *skeleton)
void applyRawSkinWithNormal (CLod &lod, CRawSkinNormalCache &rawSkinLod, const CSkeletonModel *skeleton)
void applyRawSkinWithNormalSSE (CLod &lod, CRawSkinNormalCache &rawSkinLod, const CSkeletonModel *skeleton)
void applySkinWithTangentSpace (CLod &lod, const CSkeletonModel *skeleton, uint tangentSpaceTexCoord)
 The same as apply skin with normal, but with a tangent space added (encoded in a texture coordinate). More...

void applySkinWithTangentSpaceSSE (CLod &lod, const CSkeletonModel *skeleton, uint tangentSpaceTexCoord)
void restoreOriginalSkinPart (CLod &lod, IVertexBufferHard *currentVBHard)
 Skinning: same as restoreOriginalSkinVertices(), but for one Lod only. More...

sint loadHeader (NLMISC::IStream &f) throw (NLMISC::EStream)
 load the header of this mesh. return the version of the header. More...

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

void save (NLMISC::IStream &f) throw (NLMISC::EStream)
 save the entire mesh. More...

void buildBoneUsageVer2 ()
void compileRunTime ()
void updateShiftedTriangleCache (CMeshMRMInstance *mi, sint curLodId, uint baseVertex)

Private Attributes

bool _Skinned
 Skinning: This tells if the mesh is correctly skinned (suuport skinning). More...

std::vector< CVector > _OriginalSkinVertices
 Skinning: this is the list of vertices (mirror of VBuffer), at the bind Pos. More...

std::vector< CVector > _OriginalSkinNormals
std::vector< CVector > _OriginalTGSpace
CVertexBuffer _VBufferOriginal
 The Original VBuffer. More...

CVertexBuffer _VBufferFinal
 The Final VBuffer. More...

std::vector< CMesh::CSkinWeight_SkinWeights
 This is the array of SkinWeights, same size as the VB. More...

bool _BoneIdComputed
 This boolean is true if the bones id have been passed in the skeleton. More...

bool _BoneIdExtended
 true if the _BonesIdExt have been computed (for bone Usage). More...

bool _SupportSkinGrouping
 if true, then maybe use faster render. More...

uint8 _LastLodComputed
 Last lod rendered. used with renderSkinGroup*() only. More...

std::vector< std::string > _BonesName
 This array give the name of the local bones. More...

std::vector< sint32_BonesId
 This array give the index in the skeleton of the local bones used. computed at first computeBoneId(). More...

std::vector< sint32_BonesIdExt
 Same as _BonesId but with parent of bones added. (used for bone usage). More...

std::vector< CLod_Lods
 List of Lods. More...

NLMISC::CAABBoxExt _BBox
 For clipping. this is the BB of all vertices of all Lods. More...

std::vector< CLodInfo_LodInfos
 Info for pre-loading Lods. More...

uint _NbLodLoaded
CMeshMorpher _MeshMorpher
NLMISC::CSmartPtr< IMeshVertexProgram_MeshVertexProgram
CMRMLevelDetail _LevelDetail

Friends

class CMRMBuilder
Structures for building a MRM mesh.
class CLod

Detailed Description

An MRM mesh geometry, with no materials information.

To build a CMeshMRMGeom, you should:

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

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 80 of file mesh_mrm.h.


Constructor & Destructor Documentation

NL3D::CMeshMRMGeom::CMeshMRMGeom  
 

Constructor.

Definition at line 203 of file mesh_mrm.cpp.

References _BoneIdComputed, _BoneIdExtended, _MeshDataId, _NbLodLoaded, _PreciseClipping, _Skinned, _SupportSkinGrouping, and _VertexBufferHardDirty.

NL3D::CMeshMRMGeom::~CMeshMRMGeom  
 

Definition at line 217 of file mesh_mrm.cpp.

References deleteVertexBufferHard.


Member Function Documentation

void NL3D::CMeshMRMGeom::activeInstance CMeshGeomRenderContext   rdrCtx,
CMeshBaseInstance   inst,
float    polygonCount
[virtual]
 

The framework call this method any time a change of instance occurs.

Implements NL3D::IMeshGeom.

Definition at line 2523 of file mesh_mrm.cpp.

void NL3D::CMeshMRMGeom::applyArrayRawSkinNormal1 CRawVertexNormalSkin1   src,
uint8   destVertexPtr,
CMatrix3x4SSE   boneMat3x4,
uint    vertexSize,
uint    nInf
[private]
 

Definition at line 1631 of file mesh_mrm_skin.cpp.

void NL3D::CMeshMRMGeom::applyArrayRawSkinNormal1 CRawVertexNormalSkin1   src,
uint8   destVertexPtr,
CMatrix3x4   boneMat3x4,
uint    vertexSize,
uint    nInf
[private]
 

Definition at line 870 of file mesh_mrm_skin.cpp.

void NL3D::CMeshMRMGeom::applyArrayRawSkinNormal2 CRawVertexNormalSkin2   src,
uint8   destVertexPtr,
CMatrix3x4SSE   boneMat3x4,
uint    vertexSize,
uint    nInf
[private]
 

Definition at line 1673 of file mesh_mrm_skin.cpp.

void NL3D::CMeshMRMGeom::applyArrayRawSkinNormal2 CRawVertexNormalSkin2   src,
uint8   destVertexPtr,
CMatrix3x4   boneMat3x4,
uint    vertexSize,
uint    nInf
[private]
 

Definition at line 912 of file mesh_mrm_skin.cpp.

void NL3D::CMeshMRMGeom::applyArrayRawSkinNormal3 CRawVertexNormalSkin4   src,
uint8   destVertexPtr,
CMatrix3x4SSE   boneMat3x4,
uint    vertexSize,
uint    nInf
[private]
 

Definition at line 1716 of file mesh_mrm_skin.cpp.

void NL3D::CMeshMRMGeom::applyArrayRawSkinNormal3 CRawVertexNormalSkin4   src,
uint8   destVertexPtr,
CMatrix3x4   boneMat3x4,
uint    vertexSize,
uint    nInf
[private]
 

Definition at line 955 of file mesh_mrm_skin.cpp.

void NL3D::CMeshMRMGeom::applyArrayRawSkinNormal4 CRawVertexNormalSkin4   src,
uint8   destVertexPtr,
CMatrix3x4SSE   boneMat3x4,
uint    vertexSize,
uint    nInf
[private]
 

Definition at line 1760 of file mesh_mrm_skin.cpp.

void NL3D::CMeshMRMGeom::applyArrayRawSkinNormal4 CRawVertexNormalSkin4   src,
uint8   destVertexPtr,
CMatrix3x4   boneMat3x4,
uint    vertexSize,
uint    nInf
[private]
 

Definition at line 999 of file mesh_mrm_skin.cpp.

void NL3D::CMeshMRMGeom::applyGeomorph std::vector< CMRMWedgeGeom > &    geoms,
float    alphaLod,
IVertexBufferHard   currentVBHard
[private]
 

Apply the geomorph to the _VBuffer, or the VBhard, if exist/used.

Definition at line 473 of file mesh_mrm.cpp.

References _VBufferFinal, applyGeomorphWithVBHardPtr, and nlassert.

Referenced by render, and renderSkin.

void NL3D::CMeshMRMGeom::applyGeomorphPosNormalUV0 std::vector< CMRMWedgeGeom > &    geoms,
uint8   vertexPtr,
uint8   vertexDestPtr,
sint32    vertexSize,
float    a,
float    a1
[private]
 

Faster, but common geomorph apply.

Definition at line 811 of file mesh_mrm.cpp.

References nlassert.

Referenced by applyGeomorphWithVBHardPtr.

void NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr std::vector< CMRMWedgeGeom > &    geoms,
float    alphaLod,
uint8   vertexDestPtr
[private]
 

Apply the geomorph to the VBhard ptr, if not NULL.

Definition at line 494 of file mesh_mrm.cpp.

References _VBufferFinal, applyGeomorphPosNormalUV0, NLMISC::clamp, and nlassert.

Referenced by applyGeomorph, and renderSkinGroupGeom.

void NL3D::CMeshMRMGeom::applyMaterialRemap const std::vector< sint > &    remap
 

change materials Ids (called from CMesh::optimizeMaterialUsage()).

Definition at line 458 of file mesh_mrm.cpp.

References _Lods, getNbLod, getNbRdrPass, and nlassert.

void NL3D::CMeshMRMGeom::applyRawSkinWithNormal CLod   lod,
CRawSkinNormalCache   rawSkinLod,
const CSkeletonModel   skeleton
[private]
 

Definition at line 1045 of file mesh_mrm_skin.cpp.

Referenced by renderSkin, and renderSkinGroupGeom.

void NL3D::CMeshMRMGeom::applyRawSkinWithNormalSSE CLod   lod,
CRawSkinNormalCache   rawSkinLod,
const CSkeletonModel   skeleton
[private]
 

Definition at line 1807 of file mesh_mrm_skin.cpp.

Referenced by renderSkin, and renderSkinGroupGeom.

void NL3D::CMeshMRMGeom::applySkin CLod   lod,
const CSkeletonModel   skeleton
[private]
 

Skinning: Apply skinning to the _VBuffer (before geomorph).

Definition at line 205 of file mesh_mrm_skin.cpp.

References _OriginalSkinVertices, _Skinned, _SkinWeights, _VBufferFinal, NL3D::computeBoneMatrixes3x4, index, NL3D_MESH_SKINNING_MAX_MATRIX, and nlassert.

Referenced by renderSkin.

void NL3D::CMeshMRMGeom::applySkinWithNormal CLod   lod,
const CSkeletonModel   skeleton
[private]
 

The same as apply skin, but with normal modified.

Normal is not normalized. 4 versions from slower to faster.

Definition at line 725 of file mesh_mrm_skin.cpp.

Referenced by renderSkin, and renderSkinGroupGeom.

void NL3D::CMeshMRMGeom::applySkinWithNormalSSE CLod   lod,
const CSkeletonModel   skeleton
[private]
 

Definition at line 1487 of file mesh_mrm_skin.cpp.

Referenced by renderSkin, and renderSkinGroupGeom.

void NL3D::CMeshMRMGeom::applySkinWithTangentSpace CLod   lod,
const CSkeletonModel   skeleton,
uint    tangentSpaceTexCoord
[private]
 

The same as apply skin with normal, but with a tangent space added (encoded in a texture coordinate).

The tangent space is modified, but not normalized (must be done in a vertex program). 4 versions from slower to faster.

Definition at line 789 of file mesh_mrm_skin.cpp.

Referenced by renderSkin.

void NL3D::CMeshMRMGeom::applySkinWithTangentSpaceSSE CLod   lod,
const CSkeletonModel   skeleton,
uint    tangentSpaceTexCoord
[private]
 

Definition at line 1550 of file mesh_mrm_skin.cpp.

Referenced by renderSkin.

void NL3D::CMeshMRMGeom::beginMesh CMeshGeomRenderContext   rdrCtx [virtual]
 

The framework call this method when he will render instances of this meshGeom soon.

Implements NL3D::IMeshGeom.

Definition at line 2519 of file mesh_mrm.cpp.

void NL3D::CMeshMRMGeom::bkupOriginalSkinVertices   [private]
 

Skinning: bkup Vertex/Normal into _OriginalSkin* from VBuffer.

Definition at line 2034 of file mesh_mrm.cpp.

References _Skinned, _VBufferFinal, bkupOriginalSkinVerticesSubset, and nlassert.

Referenced by build.

void NL3D::CMeshMRMGeom::bkupOriginalSkinVerticesSubset uint    wedgeStart,
uint    wedgeEnd
[private]
 

Definition at line 2044 of file mesh_mrm.cpp.

References _MeshVertexProgram, _OriginalSkinNormals, _OriginalSkinVertices, _OriginalTGSpace, _Skinned, _VBufferFinal, and nlassert.

Referenced by bkupOriginalSkinVertices, and serialLodVertexData.

void NL3D::CMeshMRMGeom::build CMesh::CMeshBuild   m,
std::vector< CMesh::CMeshBuild * > &    bsList,
uint    numMaxMaterial,
const CMRMParameters   params = CMRMParameters()
 

Build a mesh, replacing old.

this is much slower than CMeshGeom::build(), because it computes the MRM.

Parameters:
params  parameters of the MRM build process.

Definition at line 242 of file mesh_mrm.cpp.

References _BBox, _BonesName, _LevelDetail, _LodInfos, _Lods, _MeshMorpher, _MeshVertexProgram, _NbLodLoaded, _Skinned, _SkinWeights, _VBufferFinal, _VertexBufferHardDirty, bkupOriginalSkinVertices, CLod, CMRMBuilder, compileRunTime, dirtMeshDataId, NL3D::makeBBox, matrix, NL3D_MESH_SKINNING_MAX_MATRIX, nlassert, params, NLMISC::CAABBoxExt::setCenter, and NLMISC::CAABBoxExt::setSize.

void NL3D::CMeshMRMGeom::buildBoneUsageVer2   [private]
 

Definition at line 2403 of file mesh_mrm.cpp.

References _BonesId, _SkinWeights, and NL3D_MESH_SKINNING_MAX_MATRIX.

Referenced by loadFirstLod.

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

References _LevelDetail.

sint NL3D::CMeshMRMGeom::chooseLod float    alphaMRM,
float &    alphaLod
[inline, private]
 

choose the lod according to the alphaMRM [0,1] given.

Definition at line 892 of file mesh_mrm.cpp.

References _Lods, and _NbLodLoaded.

Referenced by render, renderSkin, and renderSkinGroupGeom.

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

clip this mesh in a driver. true if visible.

Reimplemented from NL3D::IMeshGeom.

Definition at line 850 of file mesh_mrm.cpp.

References _BBox, NLMISC::CAABBoxExt::clipBack, NLMISC::CAABBoxExt::getCenter, and NLMISC::CAABBoxExt::getRadius.

void NL3D::CMeshMRMGeom::compileRunTime   [private]
 

Definition at line 2475 of file mesh_mrm.cpp.

References _BBox, _Lods, _MeshVertexProgram, _PreciseClipping, _Skinned, _SupportSkinGrouping, _VBufferFinal, NLMISC::CAABBoxExt::getRadius, NL3D_MESH_PRECISE_CLIP_THRESHOLD, NL3D_MESH_SKIN_MANAGER_MAXVERTICES, and NL3D_MESH_SKIN_MANAGER_VERTEXFORMAT.

Referenced by build.

void NL3D::CMeshMRMGeom::computeBonesId CSkeletonModel   skeleton
 

If the mesh is skinned, still use normal CVertexBuffer.

Doens't use VBuffer hard when Skinned, for AGP memory optimisation. See renderSkin() note. It's because most of the MRM skins are rendered through renderSkinGroup*() methods, which use a global VBHard NB: meshs which are skinned but not skin applied are not optimized too. But this case is not a "realtime" game situation

Also, if the driver has slow VBhard unlock() (ie ATI gl extension), avoid use of them if MeshMorpher is used.

Definition at line 2282 of file mesh_mrm.cpp.

References _BoneIdComputed, _BoneIdExtended, _BonesId, _BonesIdExt, _BonesName, _Lods, _SkinWeights, matrix, NL3D_MESH_SKINNING_MAX_MATRIX, nlassert, and nlwarning.

void NL3D::CMeshMRMGeom::deleteVertexBufferHard   [private]
 

Definition at line 2198 of file mesh_mrm.cpp.

References _Driver, _VBHard, and nlassert.

Referenced by ~CMeshMRMGeom.

void NL3D::CMeshMRMGeom::dirtMeshDataId   [private]
 

Increment the refCount, so instances RawSkins are no longer valid.

Definition at line 2693 of file mesh_mrm.cpp.

References _MeshDataId.

Referenced by build.

void NL3D::CMeshMRMGeom::endMesh CMeshGeomRenderContext   rdrCtx [virtual]
 

The framework call this method when it has done with this meshGeom.

Implements NL3D::IMeshGeom.

Definition at line 2531 of file mesh_mrm.cpp.

void NL3D::CMeshMRMGeom::fillAGPSkinPartWithVBHardPtr CLod   lod,
uint8   vertexDst
[private]
 

Definition at line 1890 of file mesh_mrm_skin.cpp.

Referenced by renderSkinGroupGeom.

const std::vector<std::string>& NL3D::CMeshMRMGeom::getBonesName   const [inline]
 

get the bone names of the meshMRM.

Definition at line 178 of file mesh_mrm.h.

References _BonesName.

const NLMISC::CAABBoxExt& NL3D::CMeshMRMGeom::getBoundingBox   const [inline, virtual]
 

get the extended axis aligned bounding box of the mesh.

Implements NL3D::IMeshGeom.

Definition at line 166 of file mesh_mrm.h.

References _BBox.

const std::vector<CMRMWedgeGeom>& NL3D::CMeshMRMGeom::getGeomorphs uint    lodId const [inline]
 

Advanced. get the geomorphs for a special lod.

Definition at line 212 of file mesh_mrm.h.

References _Lods.

const CMRMLevelDetail& NL3D::CMeshMRMGeom::getLevelDetail   const [inline]
 

get the MRM level detail information.

Definition at line 260 of file mesh_mrm.h.

References _LevelDetail.

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

get the number of LOD.

Definition at line 182 of file mesh_mrm.h.

References _Lods.

Referenced by applyMaterialRemap, and loadNextLod.

uint NL3D::CMeshMRMGeom::getNbLodLoaded   const [inline]
 

get the number of LOD currently loaded.

Definition at line 136 of file mesh_mrm.h.

References _NbLodLoaded.

Referenced by loadNextLod, and unloadNextLod.

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

get the number of rendering pass of a LOD.

Parameters:
lodId  the id of the LOD.

Definition at line 188 of file mesh_mrm.h.

References _Lods.

Referenced by applyMaterialRemap.

uint NL3D::CMeshMRMGeom::getNumRdrPasses   const [virtual]
 

return the number of renderPasses for this mesh.

Implements NL3D::IMeshGeom.

Definition at line 2514 of file mesh_mrm.cpp.

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

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

Implements NL3D::IMeshGeom.

Definition at line 2189 of file mesh_mrm.cpp.

References _LevelDetail.

uint32 NL3D::CMeshMRMGeom::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 205 of file mesh_mrm.h.

References _Lods.

const CPrimitiveBlock& NL3D::CMeshMRMGeom::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 195 of file mesh_mrm.h.

References _Lods.

const std::vector<sint32>& NL3D::CMeshMRMGeom::getSkinBoneUsage   const [inline]
 

return array of bones used by the skin. computeBonesId must has been called before.

Definition at line 236 of file mesh_mrm.h.

References _BonesId.

const std::vector<CMesh::CSkinWeight>& NL3D::CMeshMRMGeom::getSkinWeights   const [inline]
 

get the skinWeights used by the mrm mesh. NB: same size of the vertexBuffer. empty if !isSkinned().

Definition at line 175 of file mesh_mrm.h.

References _SkinWeights.

const CVertexBuffer& NL3D::CMeshMRMGeom::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 172 of file mesh_mrm.h.

References _VBufferFinal.

void NL3D::CMeshMRMGeom::initInstance CMeshBaseInstance   mbi [virtual]
 

Init instance info.

Implements NL3D::IMeshGeom.

Definition at line 841 of file mesh_mrm.cpp.

References _MeshVertexProgram.

bool NL3D::CMeshMRMGeom::isSkinned   const [inline]
 

Return true if the mesh is skinned, else return false.

Definition at line 224 of file mesh_mrm.h.

References _Skinned.

void NL3D::CMeshMRMGeom::load NLMISC::IStream   f throw (NLMISC::EStream) [private]
 

load this mesh.

Definition at line 1754 of file mesh_mrm.cpp.

void NL3D::CMeshMRMGeom::loadFirstLod NLMISC::IStream   f
 

Load the header and the first lod of a MRM in a stream.

Parameters:
f  the input stream to read. NB: after load, f.getPos() return the position of the second lod in the stream.

Definition at line 1940 of file mesh_mrm.cpp.

References _LodInfos, _Lods, _NbLodLoaded, _VertexBufferHardDirty, buildBoneUsageVer2, loadHeader, NLMISC::IStream::serial, and serialLodVertexData.

sint NL3D::CMeshMRMGeom::loadHeader NLMISC::IStream   f throw (NLMISC::EStream) [private]
 

load the header of this mesh. return the version of the header.

Definition at line 1635 of file mesh_mrm.cpp.

References NLMISC::contReset.

Referenced by loadFirstLod.

void NL3D::CMeshMRMGeom::loadNextLod NLMISC::IStream   f
 

Load next lod of a stream.

use getNbLodLoaded() to know what Lod will be loaded. NB: if getNbLodLoaded() == getNbLod(), no op.

Parameters:
f  the same input stream passed to loadFirstLod(). NB: after load, f.getPos() is "unedfined" (actually return the position of the next lod in the stream).

Definition at line 1990 of file mesh_mrm.cpp.

References _LodInfos, _Lods, _NbLodLoaded, _VertexBufferHardDirty, getNbLod, getNbLodLoaded, NLMISC::IStream::seek, NLMISC::IStream::serial, and serialLodVertexData.

NL3D::CMeshMRMGeom::NLMISC_DECLARE_CLASS CMeshMRMGeom   
 

void NL3D::CMeshMRMGeom::render IDriver   drv,
CTransformShape   trans,
float    polygonCount,
uint32    rdrFlags,
float    globalAlpha
[virtual]
 

render() this mesh in a driver, given an instance and his materials.

Implements NL3D::IMeshGeom.

Definition at line 921 of file mesh_mrm.cpp.

References _LevelDetail, _Lods, _MeshMorpher, _MeshVertexProgram, _OriginalSkinNormals, _OriginalSkinVertices, _OriginalTGSpace, _Skinned, _VBHard, _VBufferFinal, _VBufferOriginal, applyGeomorph, chooseLod, CLod, H_AUTO, nlassert, NL3D::OptFastFloor, restoreOriginalSkinPart, and updateVertexBufferHard.

void NL3D::CMeshMRMGeom::renderPass CMeshGeomRenderContext   rdrCtx,
CMeshBaseInstance   inst,
float    polygonCount,
uint    rdrPass
[virtual]
 

The framework call this method to render the current renderPass, with the current instance NB: if the material is blended, DON'T render it!!

Implements NL3D::IMeshGeom.

Definition at line 2527 of file mesh_mrm.cpp.

void NL3D::CMeshMRMGeom::renderSkin CTransformShape   trans,
float    alphaMRM
[virtual]
 

render() this mesh as a skin.

Implements NL3D::IMeshGeom.

Definition at line 1140 of file mesh_mrm.cpp.

References _Lods, _MeshMorpher, _MeshVertexProgram, _OriginalSkinNormals, _OriginalSkinVertices, _OriginalTGSpace, _Skinned, _VBufferFinal, _VBufferOriginal, applyGeomorph, applyRawSkinWithNormal, applyRawSkinWithNormalSSE, applySkin, applySkinWithNormal, applySkinWithNormalSSE, applySkinWithTangentSpace, applySkinWithTangentSpaceSSE, chooseLod, CLod, H_AUTO_USE, nlassert, and updateRawSkinNormal.

sint NL3D::CMeshMRMGeom::renderSkinGroupGeom CMeshMRMInstance   mi,
float    alphaMRM,
uint    remainingVertices,
uint8   vbDest
 

Definition at line 1337 of file mesh_mrm.cpp.

References _LastLodComputed, _Lods, _MeshMorpher, _OriginalSkinNormals, _OriginalSkinVertices, _Skinned, _VBufferFinal, _VBufferOriginal, applyGeomorphWithVBHardPtr, applyRawSkinWithNormal, applyRawSkinWithNormalSSE, applySkinWithNormal, applySkinWithNormalSSE, chooseLod, CLod, fillAGPSkinPartWithVBHardPtr, H_AUTO_USE, nlassert, and updateRawSkinNormal.

void NL3D::CMeshMRMGeom::renderSkinGroupPrimitives CMeshMRMInstance   mi,
uint    baseVertex
 

Definition at line 1453 of file mesh_mrm.cpp.

References _LastLodComputed, _Lods, CLod, H_AUTO_USE, min, nlassert, and updateShiftedTriangleCache.

void NL3D::CMeshMRMGeom::restoreOriginalSkinPart CLod   lod,
IVertexBufferHard   currentVBHard
[private]
 

Skinning: same as restoreOriginalSkinVertices(), but for one Lod only.

Definition at line 2120 of file mesh_mrm.cpp.

References _OriginalSkinNormals, _OriginalSkinVertices, _Skinned, _VBufferFinal, index, NL3D_MESH_SKINNING_MAX_MATRIX, and nlassert.

Referenced by render.

void NL3D::CMeshMRMGeom::restoreOriginalSkinVertices   [private]
 

Skinning: restore Vertex/Normal from _OriginalSkin* to VBuffer.

Definition at line 2084 of file mesh_mrm.cpp.

References _MeshVertexProgram, _OriginalSkinNormals, _OriginalSkinVertices, _OriginalTGSpace, _Skinned, _VBufferFinal, and nlassert.

void NL3D::CMeshMRMGeom::save NLMISC::IStream   f throw (NLMISC::EStream) [private]
 

save the entire mesh.

Definition at line 1789 of file mesh_mrm.cpp.

References nlassert.

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

serial this meshGeom.

Implements NLMISC::IStreamable.

Definition at line 1621 of file mesh_mrm.cpp.

void NL3D::CMeshMRMGeom::serialLodVertexData NLMISC::IStream   f,
uint    startWedge,
uint    endWedge
[private]
 

serial a subset of the vertices.

Definition at line 1907 of file mesh_mrm.cpp.

References _SkinWeights, _VBufferFinal, bkupOriginalSkinVerticesSubset, NLMISC::IStream::isReading, NLMISC::IStream::serial, and NLMISC::IStream::serialVersion.

Referenced by loadFirstLod, and loadNextLod.

bool NL3D::CMeshMRMGeom::sortPerMaterial   const [virtual]
 

true if the sort criterion must be by material.

Else, sort per instance.

Implements NL3D::IMeshGeom.

Definition at line 2509 of file mesh_mrm.cpp.

bool NL3D::CMeshMRMGeom::supportMeshBlockRendering   const [virtual]
 

true if this meshGeom support meshBlock rendering.

return false if skinned/meshMorphed.

Implements NL3D::IMeshGeom.

Definition at line 2502 of file mesh_mrm.cpp.

bool NL3D::CMeshMRMGeom::supportSkinGrouping   const
 

Definition at line 1331 of file mesh_mrm.cpp.

References _SupportSkinGrouping.

void NL3D::CMeshMRMGeom::unloadNextLod NLMISC::IStream   f
 

UnLoad Lod getNbLodLoaded()-1 from memory.

use getNbLodLoaded()-1 to know what Lod will be unloaded. NB: if getNbLodLoaded() <= 1, no op.

Definition at line 2018 of file mesh_mrm.cpp.

References _Lods, _NbLodLoaded, NLMISC::contReset, and getNbLodLoaded.

void NL3D::CMeshMRMGeom::updateRawSkinNormal bool    enabled,
CMeshMRMInstance   mi,
sint    curLodId
[private]
 

compute RawSkin info in the MRMInstance according to current skin setup.

Definition at line 2701 of file mesh_mrm.cpp.

References _Lods, _MeshDataId, _OriginalSkinNormals, _OriginalSkinVertices, _SkinWeights, CLod, H_AUTO, NL3D_MESH_SKINNING_MAX_MATRIX, and nlassert.

Referenced by renderSkin, and renderSkinGroupGeom.

void NL3D::CMeshMRMGeom::updateShiftedTriangleCache CMeshMRMInstance   mi,
sint    curLodId,
uint    baseVertex
[private]
 

Definition at line 1548 of file mesh_mrm.cpp.

References _Lods, _MeshDataId, and CLod.

Referenced by renderSkinGroupPrimitives.

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

update Skeleton Usage. increment or decrement. computeBonesId must has been called before.

Definition at line 2456 of file mesh_mrm.cpp.

References _BonesIdExt, and nlerror.

void NL3D::CMeshMRMGeom::updateVertexBufferHard IDriver   drv,
uint32    numVertices
[private]
 

Definition at line 2213 of file mesh_mrm.cpp.

References _Driver, _MeshMorpher, _Skinned, _VBHard, _VBufferFinal, _VertexBufferHardDirty, and nlassert.

Referenced by render.


Friends And Related Function Documentation

friend class CLod [friend]
 

Definition at line 355 of file mesh_mrm.h.

Referenced by build, render, renderSkin, renderSkinGroupGeom, renderSkinGroupPrimitives, updateRawSkinNormal, and updateShiftedTriangleCache.

friend class CMRMBuilder [friend]
 

Definition at line 273 of file mesh_mrm.h.

Referenced by build.


Member Data Documentation

NLMISC::CAABBoxExt NL3D::CMeshMRMGeom::_BBox [private]
 

For clipping. this is the BB of all vertices of all Lods.

Definition at line 452 of file mesh_mrm.h.

Referenced by build, clip, compileRunTime, and getBoundingBox.

bool NL3D::CMeshMRMGeom::_BoneIdComputed [private]
 

This boolean is true if the bones id have been passed in the skeleton.

Definition at line 432 of file mesh_mrm.h.

Referenced by CMeshMRMGeom, and computeBonesId.

bool NL3D::CMeshMRMGeom::_BoneIdExtended [private]
 

true if the _BonesIdExt have been computed (for bone Usage).

Definition at line 434 of file mesh_mrm.h.

Referenced by CMeshMRMGeom, and computeBonesId.

std::vector<sint32> NL3D::CMeshMRMGeom::_BonesId [private]
 

This array give the index in the skeleton of the local bones used. computed at first computeBoneId().

Definition at line 445 of file mesh_mrm.h.

Referenced by buildBoneUsageVer2, computeBonesId, and getSkinBoneUsage.

std::vector<sint32> NL3D::CMeshMRMGeom::_BonesIdExt [private]
 

Same as _BonesId but with parent of bones added. (used for bone usage).

Definition at line 447 of file mesh_mrm.h.

Referenced by computeBonesId, and updateSkeletonUsage.

std::vector<std::string> NL3D::CMeshMRMGeom::_BonesName [private]
 

This array give the name of the local bones.

Definition at line 443 of file mesh_mrm.h.

Referenced by build, computeBonesId, and getBonesName.

CRefPtr<IDriver> NL3D::CMeshMRMGeom::_Driver [private]
 

Definition at line 471 of file mesh_mrm.h.

Referenced by deleteVertexBufferHard, and updateVertexBufferHard.

uint8 NL3D::CMeshMRMGeom::_LastLodComputed [private]
 

Last lod rendered. used with renderSkinGroup*() only.

Definition at line 440 of file mesh_mrm.h.

Referenced by renderSkinGroupGeom, and renderSkinGroupPrimitives.

CMRMLevelDetail NL3D::CMeshMRMGeom::_LevelDetail [private]
 

Definition at line 462 of file mesh_mrm.h.

Referenced by build, changeMRMDistanceSetup, getLevelDetail, getNumTriangles, and render.

std::vector<CLodInfo> NL3D::CMeshMRMGeom::_LodInfos [private]
 

Info for pre-loading Lods.

Definition at line 456 of file mesh_mrm.h.

Referenced by build, loadFirstLod, and loadNextLod.

std::vector<CLod> NL3D::CMeshMRMGeom::_Lods [private]
 

List of Lods.

Definition at line 450 of file mesh_mrm.h.

Referenced by applyMaterialRemap, build, chooseLod, compileRunTime, computeBonesId, getGeomorphs, getNbLod, getNbRdrPass, getRdrPassMaterial, getRdrPassPrimitiveBlock, loadFirstLod, loadNextLod, render, renderSkin, renderSkinGroupGeom, renderSkinGroupPrimitives, unloadNextLod, updateRawSkinNormal, and updateShiftedTriangleCache.

uint NL3D::CMeshMRMGeom::_MeshDataId [private]
 

Each time the mesh is loaded/built, this increment.

Definition at line 560 of file mesh_mrm.h.

Referenced by CMeshMRMGeom, dirtMeshDataId, updateRawSkinNormal, and updateShiftedTriangleCache.

CMeshMorpher NL3D::CMeshMRMGeom::_MeshMorpher [private]
 

Definition at line 489 of file mesh_mrm.h.

Referenced by build, render, renderSkin, renderSkinGroupGeom, and updateVertexBufferHard.

NLMISC::CSmartPtr<IMeshVertexProgram> NL3D::CMeshMRMGeom::_MeshVertexProgram [private]
 

Definition at line 492 of file mesh_mrm.h.

Referenced by bkupOriginalSkinVerticesSubset, build, compileRunTime, initInstance, render, renderSkin, and restoreOriginalSkinVertices.

uint NL3D::CMeshMRMGeom::_NbLodLoaded [private]
 

Definition at line 457 of file mesh_mrm.h.

Referenced by build, chooseLod, CMeshMRMGeom, getNbLodLoaded, loadFirstLod, loadNextLod, and unloadNextLod.

std::vector<CVector> NL3D::CMeshMRMGeom::_OriginalSkinNormals [private]
 

Definition at line 420 of file mesh_mrm.h.

Referenced by bkupOriginalSkinVerticesSubset, render, renderSkin, renderSkinGroupGeom, restoreOriginalSkinPart, restoreOriginalSkinVertices, and updateRawSkinNormal.

std::vector<CVector> NL3D::CMeshMRMGeom::_OriginalSkinVertices [private]
 

Skinning: this is the list of vertices (mirror of VBuffer), at the bind Pos.

Definition at line 419 of file mesh_mrm.h.

Referenced by applySkin, bkupOriginalSkinVerticesSubset, render, renderSkin, renderSkinGroupGeom, restoreOriginalSkinPart, restoreOriginalSkinVertices, and updateRawSkinNormal.

std::vector<CVector> NL3D::CMeshMRMGeom::_OriginalTGSpace [private]
 

Definition at line 421 of file mesh_mrm.h.

Referenced by bkupOriginalSkinVerticesSubset, render, renderSkin, and restoreOriginalSkinVertices.

bool NL3D::CMeshMRMGeom::_PreciseClipping [private]
 

NB: HERE FOR PACKING ONLY. For clipping. Estimate if we must do a Precise clipping (ie with bboxes).

Definition at line 475 of file mesh_mrm.h.

Referenced by CMeshMRMGeom, and compileRunTime.

bool NL3D::CMeshMRMGeom::_Skinned [private]
 

Skinning: This tells if the mesh is correctly skinned (suuport skinning).

Definition at line 417 of file mesh_mrm.h.

Referenced by applySkin, bkupOriginalSkinVertices, bkupOriginalSkinVerticesSubset, build, CMeshMRMGeom, compileRunTime, isSkinned, render, renderSkin, renderSkinGroupGeom, restoreOriginalSkinPart, restoreOriginalSkinVertices, and updateVertexBufferHard.

std::vector<CMesh::CSkinWeight> NL3D::CMeshMRMGeom::_SkinWeights [private]
 

This is the array of SkinWeights, same size as the VB.

Definition at line 429 of file mesh_mrm.h.

Referenced by applySkin, build, buildBoneUsageVer2, computeBonesId, getSkinWeights, serialLodVertexData, and updateRawSkinNormal.

bool NL3D::CMeshMRMGeom::_SupportSkinGrouping [private]
 

if true, then maybe use faster render.

Definition at line 437 of file mesh_mrm.h.

Referenced by CMeshMRMGeom, compileRunTime, and supportSkinGrouping.

CRefPtr<IVertexBufferHard> NL3D::CMeshMRMGeom::_VBHard [private]
 

Definition at line 469 of file mesh_mrm.h.

Referenced by deleteVertexBufferHard, render, and updateVertexBufferHard.

CVertexBuffer NL3D::CMeshMRMGeom::_VBufferFinal [private]
 

The Final VBuffer.

Definition at line 426 of file mesh_mrm.h.

Referenced by applyGeomorph, applyGeomorphWithVBHardPtr, applySkin, bkupOriginalSkinVertices, bkupOriginalSkinVerticesSubset, build, compileRunTime, getVertexBuffer, render, renderSkin, renderSkinGroupGeom, restoreOriginalSkinPart, restoreOriginalSkinVertices, serialLodVertexData, and updateVertexBufferHard.

CVertexBuffer NL3D::CMeshMRMGeom::_VBufferOriginal [private]
 

The Original VBuffer.

Definition at line 424 of file mesh_mrm.h.

Referenced by render, renderSkin, and renderSkinGroupGeom.

bool NL3D::CMeshMRMGeom::_VertexBufferHardDirty [private]
 

Definition at line 472 of file mesh_mrm.h.

Referenced by build, CMeshMRMGeom, loadFirstLod, loadNextLod, and updateVertexBufferHard.

uint NL3D::CMeshMRMGeom::NumCacheVertexNormal1 = NL_BlockByteL1 / sizeof(CRawVertexNormalSkin1) [static]
 

Definition at line 342 of file mesh_mrm_skin.cpp.

uint NL3D::CMeshMRMGeom::NumCacheVertexNormal2 = NL_BlockByteL1 / sizeof(CRawVertexNormalSkin2) [static]
 

Definition at line 344 of file mesh_mrm_skin.cpp.

uint NL3D::CMeshMRMGeom::NumCacheVertexNormal4 = NL_BlockByteL1 / sizeof(CRawVertexNormalSkin4) [static]
 

Definition at line 346 of file mesh_mrm_skin.cpp.


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