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

The class for building MRMs. More...

#include <mrm_builder.h>

List of all members.

MRM Level Variables.

typedef std::map< CMRMWedgeGeom,
sint, CGeomPred
TGeomMap
TGeomMap _GeomMap

Top Level methods.

typedef std::map< CAttributeKey,
sint
TAttributeMap
sint findInsertAttributeInBaseMesh (CMRMMesh &baseMesh, sint attId, sint vertexId, const CVectorH &att)
sint findInsertNormalInBaseMesh (CMRMMesh &baseMesh, sint attId, sint vertexId, const CVector &normal)
sint findInsertColorInBaseMesh (CMRMMesh &baseMesh, sint attId, sint vertexId, CRGBA col)
sint findInsertUvwInBaseMesh (CMRMMesh &baseMesh, sint attId, sint vertexId, const NLMISC::CUVW &uvw)
CRGBA attToColor (const CVectorH &att) const
NLMISC::CUVW attToUvw (const CVectorH &att) const
uint32 buildMrmBaseMesh (const CMesh::CMeshBuild &mbuild, CMRMMesh &baseMesh)
 from a meshBuild, compute a CMRMMesh. More...

void buildMeshBuildMrm (const CMRMMeshFinal &finalMRM, CMeshMRMGeom::CMeshBuildMRM &mbuild, uint32 vbFlags, uint32 nbMats, const CMesh::CMeshBuild &mb)
 from a final MRM Mesh representation, compute a CMeshBuildMRM. More...

void normalizeBaseMeshSkin (CMRMMesh &baseMesh) const
CMesh::CSkinWeight normalizeSkinWeight (const CMesh::CSkinWeight &sw) const
TAttributeMap _AttributeMap [NL3D_MRM_MAX_ATTRIB]

Mesh Interfaces computing

bool buildMRMSewingMeshes (const CMesh::CMeshBuild &mbuild, uint nWantedLods, uint divisor)
bool _HasMeshInterfaces
std::vector< CMRMSewingMesh_SewingMeshes
uint _CurrentLodComputed

Public Methods

 CMRMBuilder ()
 Constructor. More...

void compileMRM (const CMesh::CMeshBuild &mbuild, std::vector< CMesh::CMeshBuild * > &bsList, const CMRMParameters &params, CMeshMRMGeom::CMeshBuildMRM &mrmMesh, uint numMaxMaterial)
 Compile a MRM mesh info. More...


Private Methods

void computeBsVerticesAttributes (std::vector< CMRMMesh > &srcBsMeshs, std::vector< CMRMMesh > &srcBsMeshsMod)
void makeCoarserBS (std::vector< CMRMBlendShape > &csBsMeshs)
Edge Cost methods.
bool vertexHasOneWedge (sint numvertex)
bool vertexHasOneMaterial (sint numvertex)
bool vertexContinue (sint numvertex)
bool vertexClosed (sint numvertex)
float getDeltaFaceNormals (sint numvertex)
bool edgeContinue (const CMRMEdge &edge)
bool edgeNearUniqueMatFace (const CMRMEdge &edge)
float computeEdgeCost (const CMRMEdge &edge)
Collapse methods.
bool faceShareWedges (CMRMFaceBuild *face, sint attribId, sint numVertex1, sint numVertex2)
void insertFaceIntoEdgeList (CMRMFaceBuild &tmpf)
void removeFaceFromEdgeList (CMRMFaceBuild &f)
sint collapseEdge (const CMRMEdge &edge)
sint followVertex (sint i)
sint followWedge (sint attribId, sint i)
CMesh::CSkinWeight collapseSkinWeight (const CMesh::CSkinWeight &sw1, const CMesh::CSkinWeight &sw2, float InterValue) const
Mesh Level methods.
void init (const CMRMMesh &baseMesh)
void collapseEdges (sint nWantedFaces)
void makeLODMesh (CMRMMeshGeom &lodMesh)
void saveCoarserMesh (CMRMMesh &coarserMesh)
void makeFromMesh (const CMRMMesh &baseMesh, CMRMMeshGeom &lodMesh, CMRMMesh &coarserMesh, sint nWantedFaces)
 this is the root call to compute a single lodMesh and the coarserMesh from a baseMesh. More...

MRM Level Methods.
void buildBlendShapes (CMRMMesh &baseMesh, std::vector< CMesh::CMeshBuild * > &bsList, uint32 VertexFlags)
 build the blend shapes in the same way we constructed the base mesh mrm. More...

void buildAllLods (const CMRMMesh &baseMesh, std::vector< CMRMMeshGeom > &lodMeshs, uint nWantedLods=10, uint divisor=50)
 build all LODs from a baseMesh. More...

void buildFinalMRM (std::vector< CMRMMeshGeom > &lodMeshs, CMRMMeshFinal &finalMRM)
 given a list of LODs, compress/reorganize data, and store in finalMRM mesh. More...


Private Attributes

Mesh Level Tmp Values.
std::vector< CMRMVertexTmpVertices
std::vector< CMRMAttributeTmpAttributes [NL3D_MRM_MAX_ATTRIB]
sint NumAttributes
std::vector< CMRMFaceBuildTmpFaces
TEdgeMap EdgeCollapses
bool _Skinned
CMRMParameters::TSkinReduction _SkinReduction
 If the current build is skinned, control the quality of the skinning redcution. More...


Detailed Description

The class for building MRMs.

Author:
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 51 of file mrm_builder.h.


Member Typedef Documentation

typedef std::map<CAttributeKey, sint> NL3D::CMRMBuilder::TAttributeMap [private]
 

Definition at line 216 of file mrm_builder.h.

typedef std::map<CMRMWedgeGeom, sint, CGeomPred> NL3D::CMRMBuilder::TGeomMap [private]
 

Definition at line 167 of file mrm_builder.h.


Constructor & Destructor Documentation

NL3D::CMRMBuilder::CMRMBuilder  
 

Constructor.

Definition at line 844 of file mrm_builder.cpp.

References _HasMeshInterfaces, _Skinned, and NumAttributes.


Member Function Documentation

CRGBA NL3D::CMRMBuilder::attToColor const CVectorH &    att const [private]
 

Definition at line 1694 of file mrm_builder.cpp.

References NLMISC::clamp.

Referenced by buildMeshBuildMrm.

NLMISC::CUVW NL3D::CMRMBuilder::attToUvw const CVectorH &    att const [private]
 

Definition at line 1712 of file mrm_builder.cpp.

Referenced by buildMeshBuildMrm.

void NL3D::CMRMBuilder::buildAllLods const CMRMMesh   baseMesh,
std::vector< CMRMMeshGeom > &    lodMeshs,
uint    nWantedLods = 10,
uint    divisor = 50
[private]
 

build all LODs from a baseMesh.

NB: the coarsestMesh is stored in lodMeshs[0], and has no geomorph info since it is the coarsest mesh. nWantedLods are created (including the coarsestMesh).

Parameters:
lodMeshs  array created by the function (size of nWantedlods).
nWantedLods  number of LODs wanted.
divisor  the coarsestMesh will have baseMesh.Faces.size()/divisor faces.

Definition at line 1272 of file mrm_builder.cpp.

References _CurrentLodComputed, init, makeFromMesh, and nlassert.

Referenced by compileMRM.

void NL3D::CMRMBuilder::buildBlendShapes CMRMMesh   baseMesh,
std::vector< CMesh::CMeshBuild * > &    bsList,
uint32    VertexFlags
[private]
 

build the blend shapes in the same way we constructed the base mesh mrm.

Definition at line 2396 of file mrm_builder.cpp.

References nlassert.

Referenced by compileMRM.

void NL3D::CMRMBuilder::buildFinalMRM std::vector< CMRMMeshGeom > &    lodMeshs,
CMRMMeshFinal   finalMRM
[private]
 

given a list of LODs, compress/reorganize data, and store in finalMRM mesh.

Definition at line 1321 of file mrm_builder.cpp.

References _GeomMap, _Skinned, NL3D_MESH_SKINNING_MAX_MATRIX, nlassert, and NumAttributes.

Referenced by compileMRM.

void NL3D::CMRMBuilder::buildMeshBuildMrm const CMRMMeshFinal   finalMRM,
CMeshMRMGeom::CMeshBuildMRM   mbuild,
uint32    vbFlags,
uint32    nbMats,
const CMesh::CMeshBuild   mb
[private]
 

from a final MRM Mesh representation, compute a CMeshBuildMRM.

This is the last stage of the algo.

Parameters:
vbFlags  the vertex format returned by earlier call too buildMrmBaseMesh().
nbMats  the number of materials of original MeshBuild.

Definition at line 1903 of file mrm_builder.cpp.

References _Skinned, attToColor, attToUvw, NL3D_MESH_SKINNING_MAX_MATRIX, and nlassert.

Referenced by compileMRM.

uint32 NL3D::CMRMBuilder::buildMrmBaseMesh const CMesh::CMeshBuild   mbuild,
CMRMMesh   baseMesh
[private]
 

from a meshBuild, compute a CMRMMesh.

This is the first stage of the algo.

Returns:
the vertexFormat supported by CMRMBuilder.

Definition at line 1719 of file mrm_builder.cpp.

References _AttributeMap, findInsertColorInBaseMesh, findInsertNormalInBaseMesh, findInsertUvwInBaseMesh, NL3D_MRM_MAX_ATTRIB, and nlassert.

Referenced by compileMRM.

bool NL3D::CMRMBuilder::buildMRMSewingMeshes const CMesh::CMeshBuild   mbuild,
uint    nWantedLods,
uint    divisor
[private]
 

Definition at line 2540 of file mrm_builder.cpp.

References _SewingMeshes, and nlassert.

Referenced by compileMRM.

sint NL3D::CMRMBuilder::collapseEdge const CMRMEdge   edge [private]
 

Definition at line 484 of file mrm_builder.cpp.

References _CurrentLodComputed, _HasMeshInterfaces, _SewingMeshes, collapseSkinWeight, NL3D::deleteElement, EdgeCollapses, faceShareWedges, NL3D::findElement, nlassert, NumAttributes, removeFaceFromEdgeList, TmpAttributes, TmpFaces, TmpVertices, vertexClosed, and vertexContinue.

Referenced by collapseEdges.

void NL3D::CMRMBuilder::collapseEdges sint    nWantedFaces [private]
 

Definition at line 930 of file mrm_builder.cpp.

References collapseEdge, EdgeCollapses, insertFaceIntoEdgeList, NL3D::ItEdgeMap, nlassert, removeFaceFromEdgeList, TmpFaces, and TmpVertices.

Referenced by makeFromMesh.

CMesh::CSkinWeight NL3D::CMRMBuilder::collapseSkinWeight const CMesh::CSkinWeight   sw1,
const CMesh::CSkinWeight   sw2,
float    InterValue
const [private]
 

Definition at line 384 of file mrm_builder.cpp.

References min, NL3D_MESH_SKINNING_MAX_MATRIX, nlassert, and nlstop.

Referenced by collapseEdge.

void NL3D::CMRMBuilder::compileMRM const CMesh::CMeshBuild   mbuild,
std::vector< CMesh::CMeshBuild * > &    bsList,
const CMRMParameters   params,
CMeshMRMGeom::CMeshBuildMRM   mrmMesh,
uint    numMaxMaterial
 

Compile a MRM mesh info.

Parameters:
mbuild  the input mesh
params  the parameters of MRM process.
mrmMesh  the result MRM mesh.

Definition at line 2475 of file mrm_builder.cpp.

References _HasMeshInterfaces, _Skinned, _SkinReduction, buildAllLods, buildBlendShapes, buildFinalMRM, buildMeshBuildMrm, buildMrmBaseMesh, buildMRMSewingMeshes, nlassert, normalizeBaseMeshSkin, and params.

void NL3D::CMRMBuilder::computeBsVerticesAttributes std::vector< CMRMMesh > &    srcBsMeshs,
std::vector< CMRMMesh > &    srcBsMeshsMod
[private]
 

float NL3D::CMRMBuilder::computeEdgeCost const CMRMEdge   edge [private]
 

Definition at line 244 of file mrm_builder.cpp.

References _CurrentLodComputed, _SewingMeshes, edgeContinue, edgeNearUniqueMatFace, getDeltaFaceNormals, TmpVertices, and vertexContinue.

Referenced by insertFaceIntoEdgeList.

bool NL3D::CMRMBuilder::edgeContinue const CMRMEdge   edge [private]
 

Definition at line 169 of file mrm_builder.cpp.

References NumAttributes, TmpFaces, TmpVertices, and w.

Referenced by computeEdgeCost, and edgeNearUniqueMatFace.

bool NL3D::CMRMBuilder::edgeNearUniqueMatFace const CMRMEdge   edge [private]
 

Definition at line 214 of file mrm_builder.cpp.

References edgeContinue, TmpFaces, and TmpVertices.

Referenced by computeEdgeCost.

bool NL3D::CMRMBuilder::faceShareWedges CMRMFaceBuild   face,
sint    attribId,
sint    numVertex1,
sint    numVertex2
[private]
 

Definition at line 318 of file mrm_builder.cpp.

References TmpAttributes.

Referenced by collapseEdge.

sint NL3D::CMRMBuilder::findInsertAttributeInBaseMesh CMRMMesh   baseMesh,
sint    attId,
sint    vertexId,
const CVectorH &    att
[private]
 

Definition at line 1633 of file mrm_builder.cpp.

References _AttributeMap.

Referenced by findInsertColorInBaseMesh, findInsertNormalInBaseMesh, and findInsertUvwInBaseMesh.

sint NL3D::CMRMBuilder::findInsertColorInBaseMesh CMRMMesh   baseMesh,
sint    attId,
sint    vertexId,
CRGBA    col
[private]
 

Definition at line 1670 of file mrm_builder.cpp.

References findInsertAttributeInBaseMesh.

Referenced by buildMrmBaseMesh.

sint NL3D::CMRMBuilder::findInsertNormalInBaseMesh CMRMMesh   baseMesh,
sint    attId,
sint    vertexId,
const CVector &    normal
[private]
 

Definition at line 1660 of file mrm_builder.cpp.

References findInsertAttributeInBaseMesh.

Referenced by buildMrmBaseMesh.

sint NL3D::CMRMBuilder::findInsertUvwInBaseMesh CMRMMesh   baseMesh,
sint    attId,
sint    vertexId,
const NLMISC::CUVW   uvw
[private]
 

Definition at line 1682 of file mrm_builder.cpp.

References findInsertAttributeInBaseMesh, NLMISC::CUVW::U, NLMISC::CUVW::V, and NLMISC::CUVW::W.

Referenced by buildMrmBaseMesh.

sint NL3D::CMRMBuilder::followVertex sint    i [private]
 

Definition at line 817 of file mrm_builder.cpp.

References TmpVertices.

Referenced by makeLODMesh.

sint NL3D::CMRMBuilder::followWedge sint    attribId,
sint    i
[private]
 

Definition at line 826 of file mrm_builder.cpp.

References TmpAttributes.

Referenced by makeLODMesh.

float NL3D::CMRMBuilder::getDeltaFaceNormals sint    numvertex [private]
 

Definition at line 143 of file mrm_builder.cpp.

References TmpFaces, and TmpVertices.

Referenced by computeEdgeCost.

void NL3D::CMRMBuilder::init const CMRMMesh   baseMesh [private]
 

Definition at line 852 of file mrm_builder.cpp.

References EdgeCollapses, insertFaceIntoEdgeList, NL3D_MRM_MAX_ATTRIB, NumAttributes, TmpAttributes, TmpFaces, and TmpVertices.

Referenced by buildAllLods, and makeFromMesh.

void NL3D::CMRMBuilder::insertFaceIntoEdgeList CMRMFaceBuild   tmpf [private]
 

Definition at line 332 of file mrm_builder.cpp.

References computeEdgeCost, and EdgeCollapses.

Referenced by collapseEdges, and init.

void NL3D::CMRMBuilder::makeCoarserBS std::vector< CMRMBlendShape > &    csBsMeshs [private]
 

Definition at line 1188 of file mrm_builder.cpp.

References NumAttributes, TmpAttributes, and TmpVertices.

Referenced by makeFromMesh.

void NL3D::CMRMBuilder::makeFromMesh const CMRMMesh   baseMesh,
CMRMMeshGeom   lodMesh,
CMRMMesh   coarserMesh,
sint    nWantedFaces
[private]
 

this is the root call to compute a single lodMesh and the coarserMesh from a baseMesh.

Definition at line 1241 of file mrm_builder.cpp.

References collapseEdges, init, makeCoarserBS, makeLODMesh, and saveCoarserMesh.

Referenced by buildAllLods.

void NL3D::CMRMBuilder::makeLODMesh CMRMMeshGeom   lodMesh [private]
 

Definition at line 1093 of file mrm_builder.cpp.

References followVertex, followWedge, index, nlassert, NumAttributes, TmpAttributes, and TmpVertices.

Referenced by makeFromMesh.

void NL3D::CMRMBuilder::normalizeBaseMeshSkin CMRMMesh   baseMesh const [private]
 

Definition at line 1890 of file mrm_builder.cpp.

References _Skinned, nlassert, and normalizeSkinWeight.

Referenced by compileMRM.

CMesh::CSkinWeight NL3D::CMRMBuilder::normalizeSkinWeight const CMesh::CSkinWeight   sw const [private]
 

Definition at line 1843 of file mrm_builder.cpp.

References NL3D_MESH_SKINNING_MAX_MATRIX.

Referenced by normalizeBaseMeshSkin.

void NL3D::CMRMBuilder::removeFaceFromEdgeList CMRMFaceBuild   f [private]
 

Definition at line 352 of file mrm_builder.cpp.

References EdgeCollapses.

Referenced by collapseEdge, and collapseEdges.

void NL3D::CMRMBuilder::saveCoarserMesh CMRMMesh   coarserMesh [private]
 

Definition at line 995 of file mrm_builder.cpp.

References index, NL3D_MRM_MAX_ATTRIB, nlassert, NumAttributes, TmpAttributes, TmpFaces, and TmpVertices.

Referenced by makeFromMesh.

bool NL3D::CMRMBuilder::vertexClosed sint    numvertex [private]
 

Definition at line 108 of file mrm_builder.cpp.

References TmpFaces, and TmpVertices.

Referenced by collapseEdge.

bool NL3D::CMRMBuilder::vertexContinue sint    numvertex [private]
 

Definition at line 103 of file mrm_builder.cpp.

References vertexHasOneMaterial, and vertexHasOneWedge.

Referenced by collapseEdge, and computeEdgeCost.

bool NL3D::CMRMBuilder::vertexHasOneMaterial sint    numvertex [private]
 

Definition at line 90 of file mrm_builder.cpp.

References TmpFaces, and TmpVertices.

Referenced by vertexContinue.

bool NL3D::CMRMBuilder::vertexHasOneWedge sint    numvertex [private]
 

Definition at line 74 of file mrm_builder.cpp.

References NumAttributes, TmpFaces, TmpVertices, and w.

Referenced by vertexContinue.


Member Data Documentation

TAttributeMap NL3D::CMRMBuilder::_AttributeMap[NL3D_MRM_MAX_ATTRIB] [private]
 

Definition at line 217 of file mrm_builder.h.

Referenced by buildMrmBaseMesh, and findInsertAttributeInBaseMesh.

uint NL3D::CMRMBuilder::_CurrentLodComputed [private]
 

Definition at line 142 of file mrm_builder.h.

Referenced by buildAllLods, collapseEdge, and computeEdgeCost.

TGeomMap NL3D::CMRMBuilder::_GeomMap [private]
 

Definition at line 168 of file mrm_builder.h.

Referenced by buildFinalMRM.

bool NL3D::CMRMBuilder::_HasMeshInterfaces [private]
 

Definition at line 138 of file mrm_builder.h.

Referenced by CMRMBuilder, collapseEdge, and compileMRM.

std::vector<CMRMSewingMesh> NL3D::CMRMBuilder::_SewingMeshes [private]
 

Definition at line 140 of file mrm_builder.h.

Referenced by buildMRMSewingMeshes, collapseEdge, and computeEdgeCost.

bool NL3D::CMRMBuilder::_Skinned [private]
 

Definition at line 89 of file mrm_builder.h.

Referenced by buildFinalMRM, buildMeshBuildMrm, CMRMBuilder, compileMRM, and normalizeBaseMeshSkin.

CMRMParameters::TSkinReduction NL3D::CMRMBuilder::_SkinReduction [private]
 

If the current build is skinned, control the quality of the skinning redcution.

Definition at line 91 of file mrm_builder.h.

Referenced by compileMRM.

TEdgeMap NL3D::CMRMBuilder::EdgeCollapses [private]
 

Definition at line 86 of file mrm_builder.h.

Referenced by collapseEdge, collapseEdges, init, insertFaceIntoEdgeList, and removeFaceFromEdgeList.

sint NL3D::CMRMBuilder::NumAttributes [private]
 

Definition at line 82 of file mrm_builder.h.

Referenced by buildFinalMRM, CMRMBuilder, collapseEdge, edgeContinue, init, makeCoarserBS, makeLODMesh, saveCoarserMesh, and vertexHasOneWedge.

std::vector<CMRMAttribute> NL3D::CMRMBuilder::TmpAttributes[NL3D_MRM_MAX_ATTRIB] [private]
 

Definition at line 80 of file mrm_builder.h.

Referenced by collapseEdge, faceShareWedges, followWedge, init, makeCoarserBS, makeLODMesh, and saveCoarserMesh.

std::vector<CMRMFaceBuild> NL3D::CMRMBuilder::TmpFaces [private]
 

Definition at line 84 of file mrm_builder.h.

Referenced by collapseEdge, collapseEdges, edgeContinue, edgeNearUniqueMatFace, getDeltaFaceNormals, init, saveCoarserMesh, vertexClosed, vertexHasOneMaterial, and vertexHasOneWedge.

std::vector<CMRMVertex> NL3D::CMRMBuilder::TmpVertices [private]
 

Definition at line 78 of file mrm_builder.h.

Referenced by collapseEdge, collapseEdges, computeEdgeCost, edgeContinue, edgeNearUniqueMatFace, followVertex, getDeltaFaceNormals, init, makeCoarserBS, makeLODMesh, saveCoarserMesh, vertexClosed, vertexHasOneMaterial, and vertexHasOneWedge.


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