diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02951.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a02951.html | 5176 |
1 files changed, 5176 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02951.html b/docs/doxygen/nel/a02951.html new file mode 100644 index 00000000..6aee51ac --- /dev/null +++ b/docs/doxygen/nel/a02951.html @@ -0,0 +1,5176 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NL3D::CMRMBuilder class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NL3D::CMRMBuilder Class Reference</h1><code>#include <<a class="el" href="a06056.html">mrm_builder.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +The class for building MRMs. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2000 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00052">52</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Top Level methods.</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< <a class="el" href="a02952.html">CAttributeKey</a>,<br> + <a class="el" href="a04558.html#a14">sint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_0">TAttributeMap</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">CRGBA</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a> (const <a class="el" href="a03668.html">CVectorH</a> &att) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03641.html">NLMISC::CUVW</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a> (const <a class="el" href="a03668.html">CVectorH</a> &att) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_3">buildMeshBuildMrm</a> (const <a class="el" href="a02961.html">CMRMMeshFinal</a> &finalMRM, <a class="el" href="a02903.html">CMeshMRMSkinnedGeom::CMeshBuildMRM</a> &mbuild, <a class="el" href="a04558.html#a11">uint32</a> vbFlags, <a class="el" href="a04558.html#a11">uint32</a> nbMats, const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mb)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_4">buildMeshBuildMrm</a> (const <a class="el" href="a02961.html">CMRMMeshFinal</a> &finalMRM, <a class="el" href="a02895.html">CMeshMRMGeom::CMeshBuildMRM</a> &mbuild, <a class="el" href="a04558.html#a11">uint32</a> vbFlags, <a class="el" href="a04558.html#a11">uint32</a> nbMats, const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mb)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh</a> (const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mbuild, <a class="el" href="a02960.html">CMRMMesh</a> &baseMesh)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_6">findInsertAttributeInBaseMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a04558.html#a14">sint</a> attId, <a class="el" href="a04558.html#a14">sint</a> vertexId, const <a class="el" href="a03668.html">CVectorH</a> &att)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_7">findInsertColorInBaseMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a04558.html#a14">sint</a> attId, <a class="el" href="a04558.html#a14">sint</a> vertexId, <a class="el" href="a03337.html">CRGBA</a> col)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_8">findInsertNormalInBaseMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a04558.html#a14">sint</a> attId, <a class="el" href="a04558.html#a14">sint</a> vertexId, const <a class="el" href="a03128.html">CVector</a> &normal)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_9">findInsertUvwInBaseMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a04558.html#a14">sint</a> attId, <a class="el" href="a04558.html#a14">sint</a> vertexId, const <a class="el" href="a03641.html">NLMISC::CUVW</a> &uvw)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_10">normalizeBaseMeshSkin</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02865.html">CMesh::CSkinWeight</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_11">normalizeSkinWeight</a> (const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> &sw) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_0">TAttributeMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">_AttributeMap</a> [NL3D_MRM_MAX_ATTRIB]</td></tr> + +<tr><td colspan=2><br><h2>MRM Level Variables.</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< <a class="el" href="a02971.html">CMRMWedgeGeom</a>,<br> + <a class="el" href="a04558.html#a14">sint</a>, <a class="el" href="a02953.html">CGeomPred</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_0">TGeomMap</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_0">TGeomMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a></td></tr> + +<tr><td colspan=2><br><h2>Mesh Interfaces computing</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_0">buildMRMSewingMeshes</a> (const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mbuild, <a class="el" href="a04558.html#a15">uint</a> nWantedLods, <a class="el" href="a04558.html#a15">uint</a> divisor)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_1">_CurrentLodComputed</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02968.html">CMRMSewingMesh</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a></td></tr> + +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuildera0">CMRMBuilder</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NL3D_1_1CMRMBuildera0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuildera1">compileMRM</a> (const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mbuild, std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > &bsList, const <a class="el" href="a02967.html">CMRMParameters</a> &<a class="el" href="a04223.html#a565">params</a>, <a class="el" href="a02903.html">CMeshMRMSkinnedGeom::CMeshBuildMRM</a> &mrmMesh, <a class="el" href="a04558.html#a15">uint</a> numMaxMaterial)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuildera2">compileMRM</a> (const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> &mbuild, std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > &bsList, const <a class="el" href="a02967.html">CMRMParameters</a> &<a class="el" href="a04223.html#a565">params</a>, <a class="el" href="a02895.html">CMeshMRMGeom::CMeshBuildMRM</a> &mrmMesh, <a class="el" href="a04558.html#a15">uint</a> numMaxMaterial)</td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderd0">computeBsVerticesAttributes</a> (std::vector< <a class="el" href="a02960.html">CMRMMesh</a> > &srcBsMeshs, std::vector< <a class="el" href="a02960.html">CMRMMesh</a> > &srcBsMeshsMod)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderd1">makeCoarserBS</a> (std::vector< <a class="el" href="a02950.html">CMRMBlendShape</a> > &csBsMeshs)</td></tr> + +<tr><td colspan="2"><div class="groupHeader">MRM Level Methods.</div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz565_0">buildAllLods</a> (const <a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, std::vector< <a class="el" href="a02966.html">CMRMMeshGeom</a> > &lodMeshs, <a class="el" href="a04558.html#a15">uint</a> nWantedLods=10, <a class="el" href="a04558.html#a15">uint</a> divisor=50)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz565_1">buildBlendShapes</a> (<a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > &bsList, <a class="el" href="a04558.html#a11">uint32</a> VertexFlags)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz565_2">buildFinalMRM</a> (std::vector< <a class="el" href="a02966.html">CMRMMeshGeom</a> > &lodMeshs, <a class="el" href="a02961.html">CMRMMeshFinal</a> &finalMRM)</td></tr> + +<tr><td colspan="2"><div class="groupHeader">Collapse methods.</div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_0">collapseEdge</a> (const <a class="el" href="a02955.html">CMRMEdge</a> &edge)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02865.html">CMesh::CSkinWeight</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_1">collapseSkinWeight</a> (const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> &sw1, const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> &sw2, float InterValue) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_2">faceShareWedges</a> (<a class="el" href="a02958.html">CMRMFaceBuild</a> *face, <a class="el" href="a04558.html#a14">sint</a> attribId, <a class="el" href="a04558.html#a14">sint</a> numVertex1, <a class="el" href="a04558.html#a14">sint</a> numVertex2)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_3">followVertex</a> (<a class="el" href="a04558.html#a14">sint</a> i)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_4">followWedge</a> (<a class="el" href="a04558.html#a14">sint</a> attribId, <a class="el" href="a04558.html#a14">sint</a> i)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_5">insertFaceIntoEdgeList</a> (<a class="el" href="a02958.html">CMRMFaceBuild</a> &tmpf)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz557_6">removeFaceFromEdgeList</a> (<a class="el" href="a02958.html">CMRMFaceBuild</a> &f)</td></tr> + +<tr><td colspan="2"><div class="groupHeader">Mesh Level methods.</div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_0">collapseEdges</a> (<a class="el" href="a04558.html#a14">sint</a> nWantedFaces)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_1">init</a> (const <a class="el" href="a02960.html">CMRMMesh</a> &baseMesh)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_2">makeFromMesh</a> (const <a class="el" href="a02960.html">CMRMMesh</a> &baseMesh, <a class="el" href="a02966.html">CMRMMeshGeom</a> &lodMesh, <a class="el" href="a02960.html">CMRMMesh</a> &coarserMesh, <a class="el" href="a04558.html#a14">sint</a> nWantedFaces)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">this is the root call to compute a single lodMesh and the coarserMesh from a baseMesh. <a href="#NL3D_1_1CMRMBuilderz559_2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_3">makeLODMesh</a> (<a class="el" href="a02966.html">CMRMMeshGeom</a> &lodMesh)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz559_4">saveCoarserMesh</a> (<a class="el" href="a02960.html">CMRMMesh</a> &coarserMesh)</td></tr> + +<tr><td colspan="2"><div class="groupHeader">Edge Cost methods.</div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_0">computeEdgeCost</a> (const <a class="el" href="a02955.html">CMRMEdge</a> &edge)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a> (const <a class="el" href="a02955.html">CMRMEdge</a> &edge)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_2">edgeNearUniqueMatFace</a> (const <a class="el" href="a02955.html">CMRMEdge</a> &edge)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_3">getDeltaFaceNormals</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_4">vertexClosed</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_6">vertexHasOneMaterial</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz555_7">vertexHasOneWedge</a> (<a class="el" href="a04558.html#a14">sint</a> numvertex)</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td colspan="2"><div class="groupHeader">Mesh Level Tmp Values.</div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02967.html#NL3D_1_1CMRMParametersw3">CMRMParameters::TSkinReduction</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">_SkinReduction</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">If the current build is skinned, control the quality of the skinning redcution. <a href="#NL3D_1_1CMRMBuilderz553_1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05363.html#a152">TEdgeMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02949.html">CMRMAttribute</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a> [NL3D_MRM_MAX_ATTRIB]</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02958.html">CMRMFaceBuild</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02970.html">CMRMVertex</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a></td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_0" doxytag="NL3D::CMRMBuilder::TAttributeMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::map<<a class="el" href="a02952.html">CAttributeKey</a>, <a class="el" href="a04558.html#a14">sint</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_0">NL3D::CMRMBuilder::TAttributeMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00228">228</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz563_0" doxytag="NL3D::CMRMBuilder::TGeomMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::map<<a class="el" href="a02971.html">CMRMWedgeGeom</a>, <a class="el" href="a04558.html#a14">sint</a>, <a class="el" href="a02953.html">CGeomPred</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_0">NL3D::CMRMBuilder::TGeomMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00179">179</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NL3D_1_1CMRMBuildera0" doxytag="NL3D::CMRMBuilder::CMRMBuilder" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NL3D::CMRMBuilder::CMRMBuilder </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor. +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00859">859</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, and <a class="el" href="a06056.html#l00094">NumAttributes</a>. +<p> +<div class="fragment"><pre>00860 { +00861 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>= 0; +00862 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= <span class="keyword">false</span>; +00863 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>= <span class="keyword">false</span>; +00864 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_1" doxytag="NL3D::CMRMBuilder::attToColor" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">CRGBA</a> NL3D::CMRMBuilder::attToColor </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03668.html">CVectorH</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>att</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01709">1709</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a06340.html#l00338">NLMISC::CRGBA::B</a>, <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a06340.html#l00336">NLMISC::CRGBA::G</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01918">buildMeshBuildMrm()</a>. +<p> +<div class="fragment"><pre>01710 { +01711 <a class="code" href="a03337.html">CRGBA</a> ret; +01712 <span class="keywordtype">float</span> tmp; +01713 tmp= att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>; <a class="code" href="a05378.html#a374">clamp</a>(tmp, 0, 255); +01714 ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo3">R</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(<a class="code" href="a04558.html#a15">uint</a>)tmp; +01715 tmp= att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>; <a class="code" href="a05378.html#a374">clamp</a>(tmp, 0, 255); +01716 ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo2">G</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(<a class="code" href="a04558.html#a15">uint</a>)tmp; +01717 tmp= att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>; <a class="code" href="a05378.html#a374">clamp</a>(tmp, 0, 255); +01718 ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo1">B</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(<a class="code" href="a04558.html#a15">uint</a>)tmp; +01719 tmp= att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>; <a class="code" href="a05378.html#a374">clamp</a>(tmp, 0, 255); +01720 ret.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>= (<a class="code" href="a04558.html#a7">uint8</a>)(<a class="code" href="a04558.html#a15">uint</a>)tmp; +01721 +01722 <span class="keywordflow">return</span> ret; +01723 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_2" doxytag="NL3D::CMRMBuilder::attToUvw" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03641.html">NLMISC::CUVW</a> NL3D::CMRMBuilder::attToUvw </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03668.html">CVectorH</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>att</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01727">1727</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01918">buildMeshBuildMrm()</a>. +<p> +<div class="fragment"><pre>01728 { +01729 <span class="keywordflow">return</span> <a class="code" href="a03641.html">CUVW</a>(att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>); +01730 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz565_0" doxytag="NL3D::CMRMBuilder::buildAllLods" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildAllLods </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname" nowrap> <em>baseMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a02966.html">CMRMMeshGeom</a> > & </td> + <td class="mdname" nowrap> <em>lodMeshs</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>nWantedLods</em> = 10, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>divisor</em> = 50</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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). <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>lodMeshs</em> </td><td>array created by the function (size of nWantedlods). </td></tr> + <tr><td valign=top><em>nWantedLods</em> </td><td>number of LODs wanted. </td></tr> + <tr><td valign=top><em>divisor</em> </td><td>the coarsestMesh will have <a class="el" href="a04223.html#a587">baseMesh.Faces.size()</a>/divisor faces.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06055.html#l01287">1287</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00154">_CurrentLodComputed</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01256">makeFromMesh()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>. +<p> +<div class="fragment"><pre>01289 { +01290 <a class="code" href="a04558.html#a14">sint</a> nFaces= baseMesh.Faces.size(); +01291 <a class="code" href="a04558.html#a14">sint</a> nBaseFaces; +01292 <a class="code" href="a04558.html#a14">sint</a> i; +01293 CMRMMesh srcMesh = baseMesh; +01294 +01295 <span class="comment">// coarsest LOD will have those number of faces.</span> +01296 nBaseFaces=nFaces/divisor; +01297 nBaseFaces=max(nBaseFaces,4); +01298 +01299 <span class="comment">// must have at least 2 LOD to be really intersting. But the rest of the process work too with only one Lod!!</span> +01300 <a class="code" href="a04199.html#a6">nlassert</a>(nWantedLods>=1); +01301 lodMeshs.resize(nWantedLods); +01302 +01303 <span class="comment">// If only one lod asked, must init some Tmp Global values (like NumAttributes)</span> +01304 <span class="keywordflow">if</span>(nWantedLods==1) +01305 { +01306 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_1">_CurrentLodComputed</a>= 0; +01307 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_1">init</a>(baseMesh); +01308 } +01309 +01310 <span class="comment">// must fill all LODs, from end to start. do not proces last lod since it will be the coarsest mesh.</span> +01311 <span class="keywordflow">for</span>(i=nWantedLods-1;i>0;i--) +01312 { +01313 <a class="code" href="a04558.html#a14">sint</a> nbWantedFaces; +01314 +01315 <span class="comment">// for sewing computing</span> +01316 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_1">_CurrentLodComputed</a>= i; +01317 +01318 <span class="comment">// Linear.</span> +01319 nbWantedFaces= nBaseFaces + (nFaces-nBaseFaces) * (i-1)/(nWantedLods-1); +01320 nbWantedFaces=max(nbWantedFaces,4); +01321 +01322 <span class="comment">// Build this LOD.</span> +01323 CMRMMesh csMesh; +01324 <span class="comment">// The mesh</span> +01325 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_2">makeFromMesh</a>(srcMesh, lodMeshs[i], csMesh, nbWantedFaces); +01326 +01327 <span class="comment">// next mesh to process is csMesh.</span> +01328 srcMesh = csMesh; +01329 } +01330 <span class="comment">// the first lodMedsh gets the coarsest mesh.</span> +01331 lodMeshs[0]= srcMesh; +01332 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz565_1" doxytag="NL3D::CMRMBuilder::buildBlendShapes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildBlendShapes </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname" nowrap> <em>baseMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > & </td> + <td class="mdname" nowrap> <em>bsList</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>VertexFlags</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +build the blend shapes in the same way we constructed the base mesh mrm +<p> +Definition at line <a class="el" href="a06055.html#l02912">2912</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a06340.html#l00338">NLMISC::CRGBA::B</a>, <a class="el" href="a06062.html#l00133">NL3D::CMRMMesh::BlendShapes</a>, <a class="el" href="a05990.html#l00090">NL3D::CMesh::CCorner::Color</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a06340.html#l00336">NLMISC::CRGBA::G</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05990.html#l00088">NL3D::CMesh::CCorner::Normal</a>, <a class="el" href="a06062.html#l00127">NL3D::CMRMMesh::NumAttributes</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a05990.html#l00091">NL3D::CMesh::CCorner::Specular</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::U</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00089">NL3D::CMesh::CCorner::Uvws</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::V</a>, <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::W</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>. +<p> +Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>. +<p> +<div class="fragment"><pre>02914 { +02915 <a class="code" href="a04558.html#a11">uint32</a> i, j, k, m, destIndex; +02916 <a class="code" href="a04558.html#a11">uint32</a> attId; +02917 <a class="code" href="a03668.html">CVectorH</a> vh; +02918 vector<CMRMBlendShape> &bsMeshes= baseMesh.BlendShapes; +02919 +02920 bsMeshes.resize (bsList.size()); +02921 +02922 <span class="keywordflow">for</span> (i = 0; i < bsList.size(); ++i) +02923 { +02924 <span class="comment">// Construct a blend shape like a mrm mesh</span> +02925 <a class="code" href="a04199.html#a6">nlassert</a> (baseMesh.Vertices.size() == bsList[i]->Vertices.size()); +02926 bsMeshes[i].Vertices.resize (baseMesh.Vertices.size()); +02927 bsMeshes[i].Vertices = bsList[i]->Vertices; +02928 +02929 bsMeshes[i].NumAttributes = baseMesh.NumAttributes; +02930 <span class="keywordflow">for</span> (j = 0; j < (<a class="code" href="a04558.html#a11">uint32</a>)bsMeshes[i].NumAttributes; ++j) +02931 bsMeshes[i].Attributes[j].resize(baseMesh.Attributes[j].size()); +02932 +02933 <span class="comment">// For all corners parse the faces (given by the baseMesh) and construct blend shape mrm meshes</span> +02934 <span class="keywordflow">for</span> (j = 0; j < baseMesh.Faces.size(); ++j) +02935 <span class="keywordflow">for</span> (k = 0; k < 3; ++k) +02936 { +02937 <span class="keyword">const</span> CMesh::CCorner &srcCorner = bsList[i]->Faces[j].Corner[k]; +02938 CMRMCorner &neutralCorner = baseMesh.Faces[j].Corner[k]; +02939 +02940 attId= 0; +02941 +02942 <span class="keywordflow">if</span> (VertexFlags & CVertexBuffer::NormalFlag) +02943 { +02944 destIndex = neutralCorner.Attributes[attId]; +02945 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = srcCorner.Normal.x; +02946 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = srcCorner.Normal.y; +02947 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = srcCorner.Normal.z; +02948 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = 0.0f; +02949 bsMeshes[i].Attributes[attId].operator[](destIndex) = vh; +02950 attId++; +02951 } +02952 <span class="keywordflow">if</span> (VertexFlags & CVertexBuffer::PrimaryColorFlag) +02953 { +02954 destIndex = neutralCorner.Attributes[attId]; +02955 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = srcCorner.Color.R; +02956 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = srcCorner.Color.G; +02957 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = srcCorner.Color.B; +02958 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = srcCorner.Color.A; +02959 bsMeshes[i].Attributes[attId].operator[](destIndex) = vh; +02960 attId++; +02961 } +02962 <span class="keywordflow">if</span> (VertexFlags & CVertexBuffer::SecondaryColorFlag) +02963 { +02964 destIndex = neutralCorner.Attributes[attId]; +02965 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = srcCorner.Specular.R; +02966 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = srcCorner.Specular.G; +02967 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = srcCorner.Specular.B; +02968 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = srcCorner.Specular.A; +02969 bsMeshes[i].Attributes[attId].operator[](destIndex) = vh; +02970 attId++; +02971 } +02972 <span class="keywordflow">for</span> (m = 0; m < CVertexBuffer::MaxStage; ++m) +02973 { +02974 <span class="keywordflow">if</span> (VertexFlags & (CVertexBuffer::TexCoord0Flag<<m)) +02975 { +02976 destIndex = neutralCorner.Attributes[attId]; +02977 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = srcCorner.Uvws[m].U; +02978 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = srcCorner.Uvws[m].V; +02979 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = srcCorner.Uvws[m].W; +02980 vh.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = 0.0f; +02981 bsMeshes[i].Attributes[attId].operator[](destIndex) = vh; +02982 attId++; +02983 } +02984 } +02985 } +02986 } +02987 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz565_2" doxytag="NL3D::CMRMBuilder::buildFinalMRM" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildFinalMRM </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::vector< <a class="el" href="a02966.html">CMRMMeshGeom</a> > & </td> + <td class="mdname" nowrap> <em>lodMeshs</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02961.html">CMRMMeshFinal</a> & </td> + <td class="mdname" nowrap> <em>finalMRM</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +given a list of LODs, compress/reorganize data, and store in finalMRM mesh. +<p> +Definition at line <a class="el" href="a06055.html#l01336">1336</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00180">_GeomMap</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a06062.html#l00215">NL3D::CMRMMeshFinal::CWedge::Attributes</a>, <a class="el" href="a06062.html#l00133">NL3D::CMRMMesh::BlendShapes</a>, <a class="el" href="a06062.html#l00155">NL3D::CMRMMeshGeom::CoarserFaces</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06062.html#l00185">NL3D::CMRMWedgeGeom::End</a>, <a class="el" href="a06062.html#l00266">NL3D::CMRMMeshFinal::CLod::Faces</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a06061.html#l00051">NL3D::CMRMMeshFinal::findInsertWedge()</a>, <a class="el" href="a06062.html#l00268">NL3D::CMRMMeshFinal::CLod::Geomorphs</a>, <a class="el" href="a06062.html#l00289">NL3D::CMRMMeshFinal::Lods</a>, <a class="el" href="a06062.html#l00083">NL3D::CMRMFace::MaterialId</a>, <a class="el" href="a06062.html#l00256">NL3D::CMRMMeshFinal::CFace::MaterialId</a>, <a class="el" href="a06062.html#l00292">NL3D::CMRMMeshFinal::MRMBlendShapesFinals</a>, <a class="el" href="a06062.html#l00283">NL3D::CMRMMeshFinal::NGeomSpace</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06062.html#l00213">NL3D::CMRMMeshFinal::CWedge::NSkinMatUsed</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06062.html#l00285">NL3D::CMRMMeshFinal::NumAttributes</a>, <a class="el" href="a06062.html#l00305">NL3D::CMRMMeshFinal::reset()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06062.html#l00287">NL3D::CMRMMeshFinal::Skinned</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, <a class="el" href="a06062.html#l00183">NL3D::CMRMWedgeGeom::Start</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, <a class="el" href="a06062.html#l00214">NL3D::CMRMMeshFinal::CWedge::Vertex</a>, <a class="el" href="a06062.html#l00211">NL3D::CMRMMeshFinal::CWedge::VertexSkin</a>, <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>, <a class="el" href="a06062.html#l00065">NL3D::CMRMCorner::WedgeEndId</a>, <a class="el" href="a06062.html#l00066">NL3D::CMRMCorner::WedgeGeomId</a>, <a class="el" href="a06062.html#l00254">NL3D::CMRMMeshFinal::CFace::WedgeId</a>, <a class="el" href="a06062.html#l00274">NL3D::CMRMMeshFinal::CMRMBlendShapeFinal::Wedges</a>, <a class="el" href="a06062.html#l00281">NL3D::CMRMMeshFinal::Wedges</a>, <a class="el" href="a06062.html#l00064">NL3D::CMRMCorner::WedgeStartId</a>, and <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>. +<p> +Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>. +<p> +<div class="fragment"><pre>01337 { +01338 <a class="code" href="a04558.html#a14">sint</a> i,j; +01339 <a class="code" href="a04558.html#a14">sint</a> lodId, attId; +01340 <a class="code" href="a04558.html#a14">sint</a> nLods= lodMeshs.size(); +01341 +01342 <span class="comment">// Init.</span> +01343 <span class="comment">// ===============</span> +01344 finalMRM.reset(); +01345 finalMRM.NumAttributes= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>; +01346 finalMRM.Skinned= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>; +01347 CMRMMeshFinal::CWedge::NumAttributesToCompare= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>; +01348 CMRMMeshFinal::CWedge::CompareSkinning= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>; +01349 finalMRM.Lods.resize(nLods); +01350 +01351 +01352 <span class="comment">// Build Wedges, and faces index.</span> +01353 <span class="comment">// ===============</span> +01354 <span class="comment">// for all lods.</span> +01355 <span class="keywordflow">for</span>(lodId=0; lodId<nLods; lodId++) +01356 { +01357 CMRMMeshGeom &lodMesh= lodMeshs[lodId]; +01358 CMRMMeshGeom &lodMeshPrec= lodMeshs[lodId==0?0:lodId-1]; +01359 <span class="comment">// for all face corner.</span> +01360 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size();i++) +01361 { +01362 <span class="comment">// The current face.</span> +01363 CMRMFace &face= lodMesh.Faces[i]; +01364 <span class="comment">// the current face, but which points to the prec LOD vertices/attributes.</span> +01365 CMRMFace &faceCoarser= lodMesh.CoarserFaces[i]; +01366 <span class="comment">// for 3 corners.</span> +01367 <span class="keywordflow">for</span>(j=0;j<3;j++) +01368 { +01369 CMRMCorner &corner= face.Corner[j]; +01370 CMRMCorner &cornerCoarser= faceCoarser.Corner[j]; +01371 <span class="comment">// start and end wedge (geomorph), maybe same.</span> +01372 CMRMMeshFinal::CWedge wedgeStart; +01373 CMRMMeshFinal::CWedge wedgeEnd; +01374 +01375 <span class="comment">// fill wedgeStart with values from lodMesh.</span> +01376 wedgeStart.Vertex= lodMesh.Vertices[corner.Vertex]; +01377 <span class="keywordflow">if</span>(_Skinned) +01378 wedgeStart.VertexSkin= lodMesh.SkinWeights[corner.Vertex]; +01379 <span class="keywordflow">for</span>(attId=0; attId<NumAttributes; attId++) +01380 { +01381 wedgeStart.Attributes[attId]= lodMesh.Attributes[attId][corner.Attributes[attId]]; +01382 } +01383 +01384 <span class="comment">// if geomorph possible (ie not lod 0).</span> +01385 <span class="keywordflow">if</span>(lodId>0) +01386 { +01387 <span class="comment">// fill wedgeEnd with values from coarser lodMesh.</span> +01388 wedgeEnd.Vertex= lodMeshPrec.Vertices[cornerCoarser.Vertex]; +01389 <span class="keywordflow">if</span>(_Skinned) +01390 wedgeEnd.VertexSkin= lodMeshPrec.SkinWeights[cornerCoarser.Vertex]; +01391 <span class="keywordflow">for</span>(attId=0; attId<NumAttributes; attId++) +01392 { +01393 wedgeEnd.Attributes[attId]= lodMeshPrec.Attributes[attId][cornerCoarser.Attributes[attId]]; +01394 } +01395 } +01396 <span class="keywordflow">else</span> +01397 { +01398 <span class="comment">// no geomorph.</span> +01399 wedgeEnd= wedgeStart; +01400 } +01401 +01402 <span class="comment">// find/insert wedge, and get Ids. NB: if start/end same, same indices.</span> +01403 <a class="code" href="a04558.html#a14">sint</a> wedgeStartId= finalMRM.findInsertWedge(wedgeStart); +01404 <a class="code" href="a04558.html#a14">sint</a> wedgeEndId= finalMRM.findInsertWedge(wedgeEnd); +01405 +01406 <span class="comment">// store in TmpCorner.</span> +01407 corner.WedgeStartId= wedgeStartId; +01408 corner.WedgeEndId= wedgeEndId; +01409 } +01410 } +01411 +01412 <span class="comment">// Here, the number of wedge indicate the max number of wedge this LOD needs.</span> +01413 finalMRM.Lods[lodId].NWedges= finalMRM.Wedges.size(); +01414 } +01415 +01416 +01417 <span class="comment">// Count NBWedges necessary for geomorph, and compute Dest geomorph wedges ids.</span> +01418 <span class="comment">// ===============</span> +01419 <span class="comment">// the number of geomorph required for one LOD.</span> +01420 <a class="code" href="a04558.html#a14">sint</a> sglmGeom; +01421 <span class="comment">// the number of geomorph required for all LOD (max of sglmGeom).</span> +01422 <a class="code" href="a04558.html#a14">sint</a> sglmGeomMax= 0; +01423 +01424 <span class="comment">// Do not process lod 0, since no geomorph.</span> +01425 <span class="keywordflow">for</span>(lodId=1; lodId<nLods; lodId++) +01426 { +01427 CMRMMeshGeom &lodMesh= lodMeshs[lodId]; +01428 +01429 <span class="comment">// reset the GeomMap, the one which indicate if we have already inserted a geomorph.</span> +01430 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.clear(); +01431 sglmGeom= 0; +01432 +01433 <span class="comment">// for all face corner.</span> +01434 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size();i++) +01435 { +01436 <span class="comment">// The current face.</span> +01437 CMRMFace &face= lodMesh.Faces[i]; +01438 <span class="comment">// for 3 corners.</span> +01439 <span class="keywordflow">for</span>(j=0;j<3;j++) +01440 { +01441 CMRMCorner &corner= face.Corner[j]; +01442 +01443 <span class="comment">// if not same wedge Ids, this is a geomorphed wedge.</span> +01444 <span class="keywordflow">if</span>(corner.WedgeStartId != corner.WedgeEndId) +01445 { +01446 <span class="comment">// search if it exist yet in the set.</span> +01447 CMRMWedgeGeom geom; +01448 geom.Start= corner.WedgeStartId; +01449 geom.End= corner.WedgeEndId; +01450 <a class="code" href="a04558.html#a14">sint</a> geomDest= sglmGeom; +01451 <span class="comment">// if don't find this geom in the set, then it is a new one.</span> +01452 TGeomMap::const_iterator it= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.find(geom); +01453 <span class="keywordflow">if</span>(it == <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.end()) +01454 { +01455 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.insert( make_pair(geom, geomDest) ); +01456 sglmGeom++; +01457 } +01458 <span class="keywordflow">else</span> +01459 geomDest= it->second; +01460 +01461 <span class="comment">// store this Geom Id in the corner.</span> +01462 corner.WedgeGeomId= geomDest; +01463 } +01464 } +01465 } +01466 +01467 <span class="comment">// take the max.</span> +01468 sglmGeomMax= max(sglmGeomMax, sglmGeom); +01469 } +01470 +01471 +01472 <span class="comment">// inform the finalMRM.</span> +01473 finalMRM.NGeomSpace= sglmGeomMax; +01474 +01475 +01476 <span class="comment">// decal all wedges/ face index.</span> +01477 <span class="comment">// ===============</span> +01478 <span class="comment">// insert an empty space for dest geomorph.</span> +01479 finalMRM.Wedges.insert(finalMRM.Wedges.begin(), sglmGeomMax, CMRMMeshFinal::CWedge()); +01480 +01481 <span class="comment">// Parse all faces corner of All lods, and decal Start/End Wedge index.</span> +01482 <span class="keywordflow">for</span>(lodId=0; lodId<nLods; lodId++) +01483 { +01484 CMRMMeshGeom &lodMesh= lodMeshs[lodId]; +01485 +01486 <span class="comment">// for all face corner.</span> +01487 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size();i++) +01488 { +01489 <span class="comment">// The current face.</span> +01490 CMRMFace &face= lodMesh.Faces[i]; +01491 <span class="comment">// for 3 corners.</span> +01492 <span class="keywordflow">for</span>(j=0;j<3;j++) +01493 { +01494 CMRMCorner &corner= face.Corner[j]; +01495 +01496 <span class="comment">// decal indices.</span> +01497 corner.WedgeStartId+= sglmGeomMax; +01498 corner.WedgeEndId+= sglmGeomMax; +01499 } +01500 } +01501 +01502 <span class="comment">// increment too the number of wedge required for this Lod.</span> +01503 finalMRM.Lods[lodId].NWedges+= sglmGeomMax; +01504 } +01505 +01506 +01507 <span class="comment">// fill faces.</span> +01508 <span class="comment">// ===============</span> +01509 <span class="comment">// Parse all faces corner of All lods, and build Faces/Geomorphs..</span> +01510 <span class="keywordflow">for</span>(lodId=0; lodId<nLods; lodId++) +01511 { +01512 CMRMMeshGeom &lodMesh= lodMeshs[lodId]; +01513 CMRMMeshFinal::CLod &lodDest= finalMRM.Lods[lodId]; +01514 +01515 <span class="comment">// alloc final faces of this LOD.</span> +01516 lodDest.Faces.resize(lodMesh.Faces.size()); +01517 +01518 <span class="comment">// reset the GeomMap, the one which indicate if we have already inserted a geomorph.</span> +01519 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.clear(); +01520 +01521 <span class="comment">// for all face corner.</span> +01522 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size();i++) +01523 { +01524 <span class="comment">// The current face.</span> +01525 CMRMFace &face= lodMesh.Faces[i]; +01526 <span class="comment">// The dest face.</span> +01527 CMRMMeshFinal::CFace &faceDest= lodDest.Faces[i]; +01528 <span class="comment">// fill good material.</span> +01529 faceDest.MaterialId= face.MaterialId; +01530 +01531 <span class="comment">// for 3 corners.</span> +01532 <span class="keywordflow">for</span>(j=0;j<3;j++) +01533 { +01534 CMRMCorner &corner= face.Corner[j]; +01535 +01536 <span class="comment">// if not same wedge Ids, this is a geomorphed wedge.</span> +01537 <span class="keywordflow">if</span>(corner.WedgeStartId != corner.WedgeEndId) +01538 { +01539 <span class="comment">// geomorph, so point to geomorphed wedge.</span> +01540 faceDest.WedgeId[j]= corner.WedgeGeomId; +01541 +01542 <span class="comment">// Build the geomorph, add it to the list (if not yet inserted).</span> +01543 CMRMWedgeGeom geom; +01544 geom.Start= corner.WedgeStartId; +01545 geom.End= corner.WedgeEndId; +01546 <span class="comment">// if don't find this geom in the set, then it is a new one.</span> +01547 TGeomMap::const_iterator it= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.find(geom); +01548 <span class="keywordflow">if</span>(it == <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.end()) +01549 { +01550 <span class="comment">// mark it as inserted.</span> +01551 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">_GeomMap</a>.insert( make_pair(geom, corner.WedgeGeomId) ); +01552 <span class="comment">// and we must insert this geom in the array.</span> +01553 <a class="code" href="a04199.html#a6">nlassert</a>( corner.WedgeGeomId==(<a class="code" href="a04558.html#a14">sint</a>)lodDest.Geomorphs.size() ); +01554 lodDest.Geomorphs.push_back(geom); +01555 } +01556 } +01557 <span class="keywordflow">else</span> +01558 { +01559 <span class="comment">// no geomorph, so just point to good wedge.</span> +01560 faceDest.WedgeId[j]= corner.WedgeStartId; +01561 } +01562 } +01563 } +01564 } +01565 +01566 +01567 <span class="comment">// process all wedges, and compute NSkinMatUsed, skipping geomorphs.</span> +01568 <span class="comment">// ===============</span> +01569 <span class="comment">// NB: this works because weights are sorted from biggest to lowest.</span> +01570 <span class="keywordflow">if</span>(_Skinned) +01571 { +01572 <span class="keywordflow">for</span>(i=finalMRM.NGeomSpace; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Wedges.size();i++) +01573 { +01574 CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[i]; +01575 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++) +01576 { +01577 <span class="keywordflow">if</span>(wedge.VertexSkin.Weights[j]==0) +01578 <span class="keywordflow">break</span>; +01579 } +01580 <a class="code" href="a04199.html#a6">nlassert</a>(j>0); +01581 wedge.NSkinMatUsed= j; +01582 } +01583 } +01584 +01585 <span class="comment">// Blend Shape Stuff</span> +01586 finalMRM.MRMBlendShapesFinals.resize (lodMeshs[0].BlendShapes.size()); +01587 <span class="keywordflow">for</span> (lodId = 0; lodId < nLods; ++lodId) +01588 { +01589 CMRMMeshGeom &lodMesh= lodMeshs[lodId]; +01590 CMRMMeshGeom &lodMeshPrec= lodMeshs[lodId==0?0:lodId-1]; +01591 +01592 <span class="comment">// for all face corner.</span> +01593 <span class="keywordflow">for</span> (i = 0; i < (<a class="code" href="a04558.html#a14">sint</a>)lodMesh.Faces.size(); ++i) +01594 { +01595 <span class="comment">// The current face.</span> +01596 CMRMFace &face = lodMesh.Faces[i]; +01597 <span class="comment">// the current face, but which points to the prec LOD vertices/attributes.</span> +01598 CMRMFace &faceCoarser = lodMesh.CoarserFaces[i]; +01599 <span class="comment">// for 3 corners.</span> +01600 <span class="keywordflow">for</span> (j = 0; j < 3; ++j) +01601 { +01602 CMRMCorner &corner = face.Corner[j]; +01603 CMRMCorner &cornerCoarser = faceCoarser.Corner[j]; +01604 +01605 <a class="code" href="a04558.html#a14">sint</a> startDestIndex = corner.WedgeStartId; +01606 +01607 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a14">sint</a> k = 0; k < (<a class="code" href="a04558.html#a14">sint</a>)finalMRM.MRMBlendShapesFinals.size(); ++k) +01608 { +01609 CMRMMeshFinal::CMRMBlendShapeFinal &rBSFinal = finalMRM.MRMBlendShapesFinals[k]; +01610 +01611 rBSFinal.Wedges.resize (finalMRM.Wedges.size()); +01612 <span class="comment">// Fill WedgeStart used by this corner.</span> +01613 rBSFinal.Wedges[startDestIndex].Vertex = lodMesh.BlendShapes[k].Vertices[corner.Vertex]; +01614 <span class="keywordflow">for</span> (attId = 0; attId < NumAttributes; ++attId) +01615 { +01616 rBSFinal.Wedges[startDestIndex].Attributes[attId] = lodMesh.BlendShapes[k].Attributes[attId][corner.Attributes[attId]]; +01617 } +01618 +01619 <span class="comment">// If geomorph, must fill the end too</span> +01620 <span class="keywordflow">if</span>(lodId>0 && corner.WedgeStartId != corner.WedgeEndId) +01621 { +01622 <a class="code" href="a04558.html#a14">sint</a> endDestIndex = corner.WedgeEndId; +01623 +01624 rBSFinal.Wedges[endDestIndex].Vertex = lodMeshPrec.BlendShapes[k].Vertices[cornerCoarser.Vertex]; +01625 <span class="keywordflow">for</span> (attId = 0; attId < NumAttributes; ++attId) +01626 { +01627 rBSFinal.Wedges[endDestIndex].Attributes[attId] = lodMeshPrec.BlendShapes[k].Attributes[attId][cornerCoarser.Attributes[attId]]; +01628 } +01629 } +01630 } +01631 +01632 } +01633 } +01634 } +01635 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_3" doxytag="NL3D::CMRMBuilder::buildMeshBuildMrm" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildMeshBuildMrm </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02961.html">CMRMMeshFinal</a> & </td> + <td class="mdname" nowrap> <em>finalMRM</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02903.html">CMeshMRMSkinnedGeom::CMeshBuildMRM</a> & </td> + <td class="mdname" nowrap> <em>mbuild</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>vbFlags</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>nbMats</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td> + <td class="mdname" nowrap> <em>mb</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +from a final MRM Mesh representation, compute a CMeshBuildMRM. This is the last stage of the algo. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>vbFlags</em> </td><td>the vertex format returned by earlier call too <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh()</a>. </td></tr> + <tr><td valign=top><em>nbMats</em> </td><td>the number of materials of original MeshBuild.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06055.html#l02414">2414</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06340.html#l00661">NLMISC::CRGBAF::A</a>, <a class="el" href="a06710.html#l00338">NL3D::CVertexBuffer::addValueEx()</a>, <a class="el" href="a06062.html#l00215">NL3D::CMRMMeshFinal::CWedge::Attributes</a>, <a class="el" href="a06055.html#l01709">attToColor()</a>, <a class="el" href="a06055.html#l01727">attToUvw()</a>, <a class="el" href="a06340.html#l00659">NLMISC::CRGBAF::B</a>, <a class="el" href="a06012.html#l00403">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::BlendShapes</a>, <a class="el" href="a06710.html#l00271">NL3D::CVertexBuffer::clearValueEx()</a>, <a class="el" href="a06004.html#l00052">NL3D::CBlendShape::deltaCol</a>, <a class="el" href="a06004.html#l00049">NL3D::CBlendShape::deltaNorm</a>, <a class="el" href="a06004.html#l00048">NL3D::CBlendShape::deltaPos</a>, <a class="el" href="a06004.html#l00050">NL3D::CBlendShape::deltaTgSpace</a>, <a class="el" href="a06004.html#l00051">NL3D::CBlendShape::deltaUV</a>, <a class="el" href="a06062.html#l00266">NL3D::CMRMMeshFinal::CLod::Faces</a>, <a class="el" href="a06340.html#l00657">NLMISC::CRGBAF::G</a>, <a class="el" href="a06062.html#l00268">NL3D::CMRMMeshFinal::CLod::Geomorphs</a>, <a class="el" href="a06012.html#l00353">NL3D::CMeshMRMSkinnedGeom::CLod::Geomorphs</a>, <a class="el" href="a06012.html#l00360">NL3D::CMeshMRMSkinnedGeom::CLod::InfluencedVertices</a>, <a class="el" href="a06710.html#l00369">NL3D::CVertexBuffer::initEx()</a>, <a class="el" href="a06062.html#l00289">NL3D::CMRMMeshFinal::Lods</a>, <a class="el" href="a06012.html#l00400">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::Lods</a>, <a class="el" href="a05990.html#l00116">NL3D::CMesh::CSkinWeight::MatrixId</a>, <a class="el" href="a06012.html#l00362">NL3D::CMeshMRMSkinnedGeom::CLod::MatrixInfluences</a>, <a class="el" href="a05990.html#l00202">NL3D::CMesh::CMeshBuild::MeshVertexProgram</a>, <a class="el" href="a06062.html#l00292">NL3D::CMRMMeshFinal::MRMBlendShapesFinals</a>, <a class="el" href="a06062.html#l00283">NL3D::CMRMMeshFinal::NGeomSpace</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06682.html#l00115">NLMISC::CVector::norm()</a>, <a class="el" href="a05990.html#l00180">NL3D::CMesh::CMeshBuild::NumCoords</a>, <a class="el" href="a06062.html#l00264">NL3D::CMRMMeshFinal::CLod::NWedges</a>, <a class="el" href="a06012.html#l00351">NL3D::CMeshMRMSkinnedGeom::CLod::NWedges</a>, <a class="el" href="a06340.html#l00655">NLMISC::CRGBAF::R</a>, <a class="el" href="a06012.html#l00355">NL3D::CMeshMRMSkinnedGeom::CLod::RdrPass</a>, <a class="el" href="a06711.html#l00568">NL3D::CVertexBuffer::setColor()</a>, <a class="el" href="a06711.html#l00554">NL3D::CVertexBuffer::setNormalCoord()</a>, <a class="el" href="a06710.html#l00409">NL3D::CVertexBuffer::setNumVertices()</a>, <a class="el" href="a06711.html#l00584">NL3D::CVertexBuffer::setSpecular()</a>, <a class="el" href="a06711.html#l00600">NL3D::CVertexBuffer::setTexCoord()</a>, <a class="el" href="a06711.html#l00505">NL3D::CVertexBuffer::setUVRouting()</a>, <a class="el" href="a06711.html#l00795">NL3D::CVertexBuffer::setValueFloat3Ex()</a>, <a class="el" href="a06711.html#l00524">NL3D::CVertexBuffer::setVertexCoord()</a>, <a class="el" href="a06710.html#l00169">NL3D::CVertexBuffer::setVertexFormat()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06012.html#l00391">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::Skinned</a>, <a class="el" href="a06012.html#l00394">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::SkinWeights</a>, <a class="el" href="a06655.html#l00049">NLMISC::CUV::U</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::U</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00181">NL3D::CMesh::CMeshBuild::UVRouting</a>, <a class="el" href="a06655.html#l00049">NLMISC::CUV::V</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::V</a>, <a class="el" href="a06012.html#l00397">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::VBuffer</a>, <a class="el" href="a06062.html#l00214">NL3D::CMRMMeshFinal::CWedge::Vertex</a>, <a class="el" href="a06062.html#l00211">NL3D::CMRMMeshFinal::CWedge::VertexSkin</a>, <a class="el" href="a06004.html#l00054">NL3D::CBlendShape::VertRefs</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::W</a>, <a class="el" href="a06062.html#l00281">NL3D::CMRMMeshFinal::Wedges</a>, <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>. +<p> +<div class="fragment"><pre>02415 { +02416 <a class="code" href="a04558.html#a14">sint</a> i,j,k; +02417 <a class="code" href="a04558.html#a14">sint</a> attId; +02418 +02419 <span class="comment">// reset the mbuild.</span> +02420 mbuild= CMeshMRMSkinnedGeom::CMeshBuildMRM(); +02421 <span class="comment">// Setup VB.</span> +02422 +02423 <span class="keywordtype">bool</span> useFormatExt = <span class="keyword">false</span>; +02424 <span class="comment">// Check wether there are texture coordinates with more than 2 compnents, which force us to use an extended vertex format</span> +02425 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k) +02426 { +02427 <span class="keywordflow">if</span> ( +02428 (vbFlags & (CVertexBuffer::TexCoord0Flag << k)) +02429 && mb.NumCoords[k] != 2) +02430 { +02431 useFormatExt = <span class="keyword">true</span>; +02432 <span class="keywordflow">break</span>; +02433 } +02434 } +02435 +02436 <a class="code" href="a04558.html#a15">uint</a> numTexCoordUsed = 0; +02437 +02438 +02439 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k) +02440 { +02441 <span class="keywordflow">if</span> (vbFlags & (CVertexBuffer::TexCoord0Flag << k)) +02442 { +02443 numTexCoordUsed = k; +02444 } +02445 } +02446 +02447 <span class="keywordflow">if</span> (!useFormatExt) +02448 { +02449 <span class="comment">// setup standard format</span> +02450 mbuild.VBuffer.setVertexFormat(vbFlags); +02451 } +02452 <span class="keywordflow">else</span> <span class="comment">// setup extended format</span> +02453 { +02454 mbuild.VBuffer.clearValueEx(); +02455 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PositionFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Position, CVertexBuffer::Float3); +02456 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::NormalFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Normal, CVertexBuffer::Float3); +02457 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PrimaryColorFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::PrimaryColor, CVertexBuffer::UChar4); +02458 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::SecondaryColorFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::SecondaryColor, CVertexBuffer::UChar4); +02459 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::WeightFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Weight, CVertexBuffer::Float4); +02460 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PaletteSkinFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::PaletteSkin, CVertexBuffer::UChar4); +02461 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::FogFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Fog, CVertexBuffer::Float1); +02462 +02463 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k) +02464 { +02465 <span class="keywordflow">if</span> (vbFlags & (CVertexBuffer::TexCoord0Flag << k)) +02466 { +02467 <span class="keywordflow">switch</span>(mb.NumCoords[k]) +02468 { +02469 <span class="keywordflow">case</span> 2: +02470 mbuild.VBuffer.addValueEx((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), CVertexBuffer::Float2); +02471 <span class="keywordflow">break</span>; +02472 <span class="keywordflow">case</span> 3: +02473 mbuild.VBuffer.addValueEx((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), CVertexBuffer::Float3); +02474 <span class="keywordflow">break</span>; +02475 <span class="keywordflow">default</span>: +02476 <a class="code" href="a04199.html#a6">nlassert</a>(0); +02477 <span class="keywordflow">break</span>; +02478 } +02479 } +02480 } +02481 mbuild.VBuffer.initEx(); +02482 } +02483 +02484 <span class="comment">// Copy the UVRouting</span> +02485 <span class="keywordflow">for</span> (i=0; i<CVertexBuffer::MaxStage; i++) +02486 { +02487 mbuild.VBuffer.setUVRouting (i, mb.UVRouting[i]); +02488 } +02489 +02490 <span class="comment">// Setup the VertexBuffer.</span> +02491 <span class="comment">// ========================</span> +02492 <span class="comment">// resize the VB.</span> +02493 mbuild.VBuffer.setNumVertices(finalMRM.Wedges.size()); +02494 <span class="comment">// Setup SkinWeights.</span> +02495 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +02496 mbuild.SkinWeights.resize(finalMRM.Wedges.size()); +02497 +02498 <span class="comment">// fill the VB.</span> +02499 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Wedges.size(); i++) +02500 { +02501 <span class="keyword">const</span> CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[i]; +02502 +02503 <span class="comment">// setup Vertex.</span> +02504 mbuild.VBuffer.setVertexCoord(i, wedge.Vertex); +02505 +02506 <span class="comment">// seutp attributes.</span> +02507 attId= 0; +02508 +02509 <span class="comment">// For all activated attributes in mbuild, retriev the attribute from the finalMRM.</span> +02510 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::NormalFlag) +02511 { +02512 mbuild.VBuffer.setNormalCoord(i, wedge.Attributes[attId] ); +02513 attId++; +02514 } +02515 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::PrimaryColorFlag) +02516 { +02517 mbuild.VBuffer.setColor(i, <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a>(wedge.Attributes[attId]) ); +02518 attId++; +02519 } +02520 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::SecondaryColorFlag) +02521 { +02522 mbuild.VBuffer.setSpecular(i, <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a>(wedge.Attributes[attId]) ); +02523 attId++; +02524 } +02525 <span class="keywordflow">for</span>(k=0; k<CVertexBuffer::MaxStage;k++) +02526 { +02527 <span class="keywordflow">if</span>(vbFlags & (CVertexBuffer::TexCoord0Flag<<k)) +02528 { +02529 <span class="keywordflow">switch</span>(mb.NumCoords[k]) +02530 { +02531 <span class="keywordflow">case</span> 2: +02532 mbuild.VBuffer.setTexCoord(i, k, (CUV) <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a>(wedge.Attributes[attId]) ); +02533 <span class="keywordflow">break</span>; +02534 <span class="keywordflow">case</span> 3: +02535 { +02536 <a class="code" href="a03641.html">CUVW</a> uvw = <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a>(wedge.Attributes[attId]); +02537 mbuild.VBuffer.setValueFloat3Ex((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), i, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo0">U</a>, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo1">V</a>, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo2">W</a>); +02538 } +02539 <span class="keywordflow">break</span>; +02540 <span class="keywordflow">default</span>: +02541 <a class="code" href="a04199.html#a6">nlassert</a>(0); +02542 <span class="keywordflow">break</span>; +02543 } +02544 attId++; +02545 } +02546 } +02547 +02548 <span class="comment">// Setup SkinWeights.</span> +02549 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +02550 { +02551 mbuild.SkinWeights[i]= wedge.VertexSkin; +02552 } +02553 } +02554 +02555 +02556 <span class="comment">// Build Lods.</span> +02557 <span class="comment">// ========================</span> +02558 <span class="comment">// resize</span> +02559 mbuild.Lods.resize(finalMRM.Lods.size()); +02560 <span class="comment">// fill.</span> +02561 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Lods.size(); i++) +02562 { +02563 <span class="keyword">const</span> CMRMMeshFinal::CLod &srcLod= finalMRM.Lods[i]; +02564 CMeshMRMSkinnedGeom::CLod &destLod= mbuild.Lods[i]; +02565 +02566 <span class="comment">// Basic.</span> +02567 <span class="comment">//---------</span> +02568 +02569 <span class="comment">// Copy NWedges infos.</span> +02570 destLod.NWedges= srcLod.NWedges; +02571 <span class="comment">// Copy Geomorphs infos.</span> +02572 destLod.Geomorphs= srcLod.Geomorphs; +02573 +02574 +02575 <span class="comment">// Reorder faces by rdrpass.</span> +02576 <span class="comment">//---------</span> +02577 +02578 <span class="comment">// First count the number of faces used by this LOD for each material </span> +02579 vector<sint> matCount; +02580 <span class="comment">// resize, and reset to 0.</span> +02581 matCount.clear(); +02582 matCount.resize(nbMats, 0); +02583 <span class="comment">// For each face of this Lods, incr the mat face counter.</span> +02584 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++) +02585 { +02586 <a class="code" href="a04558.html#a14">sint</a> matId= srcLod.Faces[j].MaterialId; +02587 <a class="code" href="a04199.html#a6">nlassert</a>(matId>=0); +02588 <a class="code" href="a04199.html#a6">nlassert</a>(matId<(<a class="code" href="a04558.html#a14">sint</a>)nbMats); +02589 <span class="comment">// increment the refcount of this material by this LOD.</span> +02590 matCount[matId]++; +02591 } +02592 +02593 <span class="comment">// Then for each material not empty, create a rdrPass, and ref it for this material.</span> +02594 vector<sint> rdrPassIndex; <span class="comment">// material to rdrPass map.</span> +02595 rdrPassIndex.resize(nbMats); +02596 <span class="keywordflow">for</span>(j=0; j<(<a class="code" href="a04558.html#a14">sint</a>)nbMats; j++) +02597 { +02598 <span class="keywordflow">if</span>(matCount[j]==0) +02599 rdrPassIndex[j]= -1; +02600 <span class="keywordflow">else</span> +02601 { +02602 <span class="comment">// map material to rdrPass.</span> +02603 <a class="code" href="a04558.html#a14">sint</a> idRdrPass= destLod.RdrPass.size(); +02604 rdrPassIndex[j]= idRdrPass; +02605 <span class="comment">// create a rdrPass.</span> +02606 destLod.RdrPass.push_back(CMeshMRMSkinnedGeom::CRdrPass()); +02607 <span class="comment">// assign the good materialId to this rdrPass.</span> +02608 destLod.RdrPass[idRdrPass].MaterialId= j; +02609 <span class="comment">// reserve the array of faces of this rdrPass.</span> +02610 destLod.RdrPass[idRdrPass].PBlock.reserve(3*matCount[j]); +02611 } +02612 } +02613 +02614 <span class="comment">// Then for each face, add it to the good rdrPass of this Lod.</span> +02615 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++) +02616 { +02617 <a class="code" href="a04558.html#a14">sint</a> matId= srcLod.Faces[j].MaterialId; +02618 <a class="code" href="a04558.html#a14">sint</a> idRdrPass= rdrPassIndex[matId]; +02619 <span class="comment">// add this face to the good rdrPass.</span> +02620 <a class="code" href="a04558.html#a14">sint</a> w0= srcLod.Faces[j].WedgeId[0]; +02621 <a class="code" href="a04558.html#a14">sint</a> w1= srcLod.Faces[j].WedgeId[1]; +02622 <a class="code" href="a04558.html#a14">sint</a> w2= srcLod.Faces[j].WedgeId[2]; +02623 destLod.RdrPass[idRdrPass].PBlock.push_back (w0); +02624 destLod.RdrPass[idRdrPass].PBlock.push_back (w1); +02625 destLod.RdrPass[idRdrPass].PBlock.push_back (w2); +02626 } +02627 +02628 +02629 <span class="comment">// Build skin info for this Lod.</span> +02630 <span class="comment">//---------</span> +02631 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++) +02632 { +02633 destLod.InfluencedVertices[j].clear(); +02634 } +02635 destLod.MatrixInfluences.clear(); +02636 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +02637 { +02638 <span class="comment">// This is the set which tell what wedge has already been inserted.</span> +02639 set<uint> wedgeInfSet; +02640 +02641 <span class="comment">// First, build the list of vertices influenced by this Lod.</span> +02642 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++) +02643 { +02644 <span class="keywordflow">for</span>(k=0; k<3; k++) +02645 { +02646 <a class="code" href="a04558.html#a14">sint</a> wedgeId= srcLod.Faces[j].WedgeId[k]; +02647 <span class="comment">// If it is a geomorph</span> +02648 <span class="keywordflow">if</span>(wedgeId<finalMRM.NGeomSpace) +02649 { +02650 <span class="comment">// add the start and end to the list (if not here). NB: wedgeId is both the id </span> +02651 <span class="comment">// of the dest wedge, and the id of the geomorph.</span> +02652 <a class="code" href="a04558.html#a14">sint</a> wedgeStartId= destLod.Geomorphs[wedgeId].Start; +02653 <a class="code" href="a04558.html#a14">sint</a> wedgeEndId= destLod.Geomorphs[wedgeId].End; +02654 <a class="code" href="a04558.html#a15">uint</a> nMatUsedStart= finalMRM.Wedges[wedgeStartId].NSkinMatUsed; +02655 <a class="code" href="a04558.html#a15">uint</a> nMatUsedEnd= finalMRM.Wedges[wedgeEndId].NSkinMatUsed; +02656 +02657 <span class="comment">// if insertion in the set work, add to the good array.</span> +02658 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeStartId).second ) +02659 destLod.InfluencedVertices[nMatUsedStart-1].push_back(wedgeStartId); +02660 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeEndId).second ) +02661 destLod.InfluencedVertices[nMatUsedEnd-1].push_back(wedgeEndId); +02662 } +02663 <span class="keywordflow">else</span> +02664 { +02665 <a class="code" href="a04558.html#a15">uint</a> nMatUsed= finalMRM.Wedges[wedgeId].NSkinMatUsed; +02666 +02667 <span class="comment">// just add this wedge to the list (if not here).</span> +02668 <span class="comment">// if insertion in the set work, add to the array.</span> +02669 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeId).second ) +02670 destLod.InfluencedVertices[nMatUsed-1].push_back(wedgeId); +02671 } +02672 } +02673 } +02674 +02675 <span class="comment">// Optimisation: for better cache, sort the destLod.InfluencedVertices in increasing order.</span> +02676 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++) +02677 { +02678 sort(destLod.InfluencedVertices[j].begin(), destLod.InfluencedVertices[j].end()); +02679 } +02680 +02681 +02682 <span class="comment">// Then Build the MatrixInfluences array, for all thoses Influenced Vertices only.</span> +02683 <span class="comment">// This is the map MatrixId -> MatrixInfId.</span> +02684 map<uint, uint> matrixInfMap; +02685 +02686 <span class="comment">// For all influenced vertices, flags matrix they use.</span> +02687 <a class="code" href="a04558.html#a15">uint</a> iSkinMat; +02688 <span class="keywordflow">for</span>(iSkinMat= 0; iSkinMat<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; iSkinMat++) +02689 { +02690 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)destLod.InfluencedVertices[iSkinMat].size(); j++) +02691 { +02692 <a class="code" href="a04558.html#a15">uint</a> wedgeId= destLod.InfluencedVertices[iSkinMat][j]; +02693 +02694 <span class="comment">// take the original wedge.</span> +02695 <span class="keyword">const</span> CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[wedgeId]; +02696 <span class="comment">// For all matrix with not null influence...</span> +02697 <span class="keywordflow">for</span>(k= 0; k<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; k++) +02698 { +02699 <span class="keywordtype">float</span> matWeight= wedge.VertexSkin.Weights[k]; +02700 +02701 <span class="comment">// This check the validity of skin weights sort. If false, problem before in the algo.</span> +02702 <span class="keywordflow">if</span>((<a class="code" href="a04558.html#a15">uint</a>)k<iSkinMat+1) +02703 { +02704 <a class="code" href="a04199.html#a6">nlassert</a>( matWeight>0 ); +02705 } +02706 <span class="keywordflow">else</span> +02707 { +02708 <a class="code" href="a04199.html#a6">nlassert</a>( matWeight==0 ); +02709 } +02710 <span class="comment">// if not null influence.</span> +02711 <span class="keywordflow">if</span>(matWeight>0) +02712 { +02713 <a class="code" href="a04558.html#a15">uint</a> matId= wedge.VertexSkin.MatrixId[k]; +02714 +02715 <span class="comment">// search/insert the matrixInfId.</span> +02716 map<uint, uint>::iterator it= matrixInfMap.find(matId); +02717 <span class="keywordflow">if</span>( it==matrixInfMap.end() ) +02718 { +02719 <a class="code" href="a04558.html#a15">uint</a> matInfId= destLod.MatrixInfluences.size(); +02720 matrixInfMap.insert( make_pair(matId, matInfId) ); +02721 <span class="comment">// create the new MatrixInfluence.</span> +02722 destLod.MatrixInfluences.push_back(matId); +02723 } +02724 } +02725 } +02726 } +02727 } +02728 +02729 } +02730 +02731 } +02732 +02733 <span class="comment">// Indicate Skinning.</span> +02734 mbuild.Skinned= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>; +02735 +02736 +02737 +02738 <span class="keywordtype">bool</span> useTgSpace = mb.MeshVertexProgram != NULL ? mb.MeshVertexProgram->needTangentSpace() : false; +02739 +02740 <span class="comment">// Construct Blend Shapes</span> +02742 <span class="comment"></span> mbuild.BlendShapes.resize (finalMRM.MRMBlendShapesFinals.size()); +02743 <span class="keywordflow">for</span> (k = 0; k < (<a class="code" href="a04558.html#a14">sint</a>)mbuild.BlendShapes.size(); ++k) +02744 { +02745 CBlendShape &rBS = mbuild.BlendShapes[k]; +02746 <a class="code" href="a04558.html#a10">sint32</a> nNbVertVB = finalMRM.Wedges.size(); +02747 <span class="keywordtype">bool</span> bIsDeltaPos = <span class="keyword">false</span>; +02748 rBS.deltaPos.resize (nNbVertVB, CVector(0.0f,0.0f,0.0f)); +02749 <span class="keywordtype">bool</span> bIsDeltaNorm = <span class="keyword">false</span>; +02750 rBS.deltaNorm.resize (nNbVertVB, CVector(0.0f,0.0f,0.0f)); +02751 <span class="keywordtype">bool</span> bIsDeltaUV = <span class="keyword">false</span>; +02752 rBS.deltaUV.resize (nNbVertVB, CUV(0.0f,0.0f)); +02753 <span class="keywordtype">bool</span> bIsDeltaCol = <span class="keyword">false</span>; +02754 rBS.deltaCol.resize (nNbVertVB, <a class="code" href="a03338.html">CRGBAF</a>(0.0f,0.0f,0.0f,0.0f)); +02755 <span class="keywordtype">bool</span> bIsDeltaTgSpace = <span class="keyword">false</span>; +02756 <span class="keywordflow">if</span> (useTgSpace) +02757 { +02758 rBS.deltaTgSpace.resize(nNbVertVB, CVector::Null); +02759 } +02760 +02761 rBS.VertRefs.resize (nNbVertVB, 0xffffffff); +02762 +02763 <span class="keywordflow">for</span> (i = 0; i < nNbVertVB; i++) +02764 { +02765 <span class="keyword">const</span> CMRMMeshFinal::CWedge &rWedgeRef = finalMRM.Wedges[i]; +02766 <span class="keyword">const</span> CMRMMeshFinal::CWedge &rWedgeTar = finalMRM.MRMBlendShapesFinals[k].Wedges[i]; +02767 +02768 CVector delta = rWedgeTar.Vertex - rWedgeRef.Vertex; +02769 <a class="code" href="a03668.html">CVectorH</a> attr; +02770 +02771 <span class="keywordflow">if</span> (delta.norm() > 0.001f) +02772 { +02773 rBS.deltaPos[i] = delta; +02774 rBS.VertRefs[i] = i; +02775 bIsDeltaPos = <span class="keyword">true</span>; +02776 } +02777 +02778 attId = 0; +02779 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::NormalFlag) +02780 { +02781 attr = rWedgeRef.Attributes[attId]; +02782 CVector NormRef = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>); +02783 attr = rWedgeTar.Attributes[attId]; +02784 CVector NormTar = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>); +02785 delta = NormTar - NormRef; +02786 <span class="keywordflow">if</span> (delta.norm() > 0.001f) +02787 { +02788 rBS.deltaNorm[i] = delta; +02789 rBS.VertRefs[i] = i; +02790 bIsDeltaNorm = <span class="keyword">true</span>; +02791 } +02792 attId++; +02793 } +02794 +02795 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PrimaryColorFlag) +02796 { +02797 attr = rWedgeRef.Attributes[attId]; +02798 <a class="code" href="a03338.html">CRGBAF</a> RGBARef = <a class="code" href="a03338.html">CRGBAF</a>(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>/255.0f); +02799 attr = rWedgeTar.Attributes[attId]; +02800 CRGBAF RGBATar = CRGBAF(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>/255.0f); +02801 CRGBAF deltaRGBA = RGBATar - RGBARef; +02802 <span class="keywordflow">if</span> ((deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo3">R</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo3">R</a> + deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo2">G</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo2">G</a> + +02803 deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo1">B</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo1">B</a> + deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo0">A</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo0">A</a>) > 0.0001f) +02804 { +02805 rBS.deltaCol[i] = deltaRGBA; +02806 rBS.VertRefs[i] = i; +02807 bIsDeltaCol = <span class="keyword">true</span>; +02808 } +02809 attId++; +02810 } +02811 +02812 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::SecondaryColorFlag) +02813 { <span class="comment">// Nothing to do !</span> +02814 attId++; +02815 } +02816 +02817 <span class="comment">// Do that only for the UV0</span> +02818 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::TexCoord0Flag) +02819 { +02820 attr = rWedgeRef.Attributes[attId]; +02821 CUV UVRef = CUV(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>); +02822 attr = rWedgeTar.Attributes[attId]; +02823 CUV UVTar = CUV(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>); +02824 CUV deltaUV = UVTar - UVRef; +02825 <span class="keywordflow">if</span> ((deltaUV.U*deltaUV.U + deltaUV.V*deltaUV.V) > 0.0001f) +02826 { +02827 rBS.deltaUV[i] = deltaUV; +02828 rBS.VertRefs[i] = i; +02829 bIsDeltaUV = <span class="keyword">true</span>; +02830 } +02831 attId++; +02832 } +02833 +02834 <span class="keywordflow">if</span> (useTgSpace) +02835 { +02836 attr = rWedgeRef.Attributes[attId]; +02837 CVector TgSpaceRef = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>); +02838 attr = rWedgeTar.Attributes[attId]; +02839 CVector TgSpaceTar = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>); +02840 delta = TgSpaceTar - TgSpaceRef; +02841 <span class="keywordflow">if</span> (delta.norm() > 0.001f) +02842 { +02843 rBS.deltaTgSpace[i] = delta; +02844 rBS.VertRefs[i] = i; +02845 bIsDeltaTgSpace = <span class="keyword">true</span>; +02846 } +02847 attId++; +02848 } +02849 +02850 } <span class="comment">// End of all vertices added in blend shape</span> +02851 +02852 <span class="comment">// Delete unused items and calculate the number of vertex used (blended)</span> +02853 +02854 <a class="code" href="a04558.html#a10">sint32</a> nNbVertUsed = nNbVertVB; +02855 <a class="code" href="a04558.html#a10">sint32</a> nDstPos = 0; +02856 <span class="keywordflow">for</span> (j = 0; j < nNbVertVB; ++j) +02857 { +02858 <span class="keywordflow">if</span> (rBS.VertRefs[j] == 0xffffffff) <span class="comment">// Is vertex UNused</span> +02859 { +02860 --nNbVertUsed; +02861 } +02862 <span class="keywordflow">else</span> <span class="comment">// Vertex used</span> +02863 { +02864 <span class="keywordflow">if</span> (nDstPos != j) +02865 { +02866 rBS.VertRefs[nDstPos] = rBS.VertRefs[j]; +02867 rBS.deltaPos[nDstPos] = rBS.deltaPos[j]; +02868 rBS.deltaNorm[nDstPos] = rBS.deltaNorm[j]; +02869 rBS.deltaUV[nDstPos] = rBS.deltaUV[j]; +02870 rBS.deltaCol[nDstPos] = rBS.deltaCol[j]; +02871 <span class="keywordflow">if</span> (useTgSpace) +02872 { +02873 rBS.deltaTgSpace[nDstPos] = rBS.deltaTgSpace[j]; +02874 } +02875 } +02876 ++nDstPos; +02877 } +02878 } +02879 +02880 <span class="keywordflow">if</span> (bIsDeltaPos) +02881 rBS.deltaPos.resize (nNbVertUsed); +02882 <span class="keywordflow">else</span> +02883 rBS.deltaPos.resize (0); +02884 +02885 <span class="keywordflow">if</span> (bIsDeltaNorm) +02886 rBS.deltaNorm.resize (nNbVertUsed); +02887 <span class="keywordflow">else</span> +02888 rBS.deltaNorm.resize (0); +02889 +02890 <span class="keywordflow">if</span> (bIsDeltaUV) +02891 rBS.deltaUV.resize (nNbVertUsed); +02892 <span class="keywordflow">else</span> +02893 rBS.deltaUV.resize (0); +02894 +02895 <span class="keywordflow">if</span> (bIsDeltaCol) +02896 rBS.deltaCol.resize (nNbVertUsed); +02897 <span class="keywordflow">else</span> +02898 rBS.deltaCol.resize (0); +02899 +02900 <span class="keywordflow">if</span> (bIsDeltaTgSpace) +02901 rBS.deltaTgSpace.resize (nNbVertUsed); +02902 <span class="keywordflow">else</span> +02903 rBS.deltaTgSpace.resize (0); +02904 +02905 +02906 rBS.VertRefs.resize (nNbVertUsed); +02907 +02908 } +02909 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_4" doxytag="NL3D::CMRMBuilder::buildMeshBuildMrm" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::buildMeshBuildMrm </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02961.html">CMRMMeshFinal</a> & </td> + <td class="mdname" nowrap> <em>finalMRM</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02895.html">CMeshMRMGeom::CMeshBuildMRM</a> & </td> + <td class="mdname" nowrap> <em>mbuild</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>vbFlags</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>nbMats</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td> + <td class="mdname" nowrap> <em>mb</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +from a final MRM Mesh representation, compute a CMeshBuildMRM. This is the last stage of the algo. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>vbFlags</em> </td><td>the vertex format returned by earlier call too <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh()</a>. </td></tr> + <tr><td valign=top><em>nbMats</em> </td><td>the number of materials of original MeshBuild.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06055.html#l01918">1918</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06340.html#l00661">NLMISC::CRGBAF::A</a>, <a class="el" href="a06710.html#l00338">NL3D::CVertexBuffer::addValueEx()</a>, <a class="el" href="a06062.html#l00215">NL3D::CMRMMeshFinal::CWedge::Attributes</a>, <a class="el" href="a06055.html#l01709">attToColor()</a>, <a class="el" href="a06055.html#l01727">attToUvw()</a>, <a class="el" href="a06340.html#l00659">NLMISC::CRGBAF::B</a>, <a class="el" href="a06006.html#l00436">NL3D::CMeshMRMGeom::CMeshBuildMRM::BlendShapes</a>, <a class="el" href="a06710.html#l00271">NL3D::CVertexBuffer::clearValueEx()</a>, <a class="el" href="a06004.html#l00052">NL3D::CBlendShape::deltaCol</a>, <a class="el" href="a06004.html#l00049">NL3D::CBlendShape::deltaNorm</a>, <a class="el" href="a06004.html#l00048">NL3D::CBlendShape::deltaPos</a>, <a class="el" href="a06004.html#l00050">NL3D::CBlendShape::deltaTgSpace</a>, <a class="el" href="a06004.html#l00051">NL3D::CBlendShape::deltaUV</a>, <a class="el" href="a06062.html#l00266">NL3D::CMRMMeshFinal::CLod::Faces</a>, <a class="el" href="a06340.html#l00657">NLMISC::CRGBAF::G</a>, <a class="el" href="a06062.html#l00268">NL3D::CMRMMeshFinal::CLod::Geomorphs</a>, <a class="el" href="a06006.html#l00383">NL3D::CMeshMRMGeom::CLod::Geomorphs</a>, <a class="el" href="a06006.html#l00390">NL3D::CMeshMRMGeom::CLod::InfluencedVertices</a>, <a class="el" href="a06710.html#l00369">NL3D::CVertexBuffer::initEx()</a>, <a class="el" href="a06062.html#l00289">NL3D::CMRMMeshFinal::Lods</a>, <a class="el" href="a06006.html#l00433">NL3D::CMeshMRMGeom::CMeshBuildMRM::Lods</a>, <a class="el" href="a05990.html#l00116">NL3D::CMesh::CSkinWeight::MatrixId</a>, <a class="el" href="a06006.html#l00392">NL3D::CMeshMRMGeom::CLod::MatrixInfluences</a>, <a class="el" href="a05990.html#l00202">NL3D::CMesh::CMeshBuild::MeshVertexProgram</a>, <a class="el" href="a06062.html#l00292">NL3D::CMRMMeshFinal::MRMBlendShapesFinals</a>, <a class="el" href="a06062.html#l00283">NL3D::CMRMMeshFinal::NGeomSpace</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06682.html#l00115">NLMISC::CVector::norm()</a>, <a class="el" href="a05990.html#l00180">NL3D::CMesh::CMeshBuild::NumCoords</a>, <a class="el" href="a06062.html#l00264">NL3D::CMRMMeshFinal::CLod::NWedges</a>, <a class="el" href="a06006.html#l00381">NL3D::CMeshMRMGeom::CLod::NWedges</a>, <a class="el" href="a06340.html#l00655">NLMISC::CRGBAF::R</a>, <a class="el" href="a06006.html#l00385">NL3D::CMeshMRMGeom::CLod::RdrPass</a>, <a class="el" href="a06711.html#l00568">NL3D::CVertexBuffer::setColor()</a>, <a class="el" href="a06711.html#l00554">NL3D::CVertexBuffer::setNormalCoord()</a>, <a class="el" href="a06710.html#l00409">NL3D::CVertexBuffer::setNumVertices()</a>, <a class="el" href="a06711.html#l00584">NL3D::CVertexBuffer::setSpecular()</a>, <a class="el" href="a06711.html#l00600">NL3D::CVertexBuffer::setTexCoord()</a>, <a class="el" href="a06711.html#l00505">NL3D::CVertexBuffer::setUVRouting()</a>, <a class="el" href="a06711.html#l00795">NL3D::CVertexBuffer::setValueFloat3Ex()</a>, <a class="el" href="a06711.html#l00524">NL3D::CVertexBuffer::setVertexCoord()</a>, <a class="el" href="a06710.html#l00169">NL3D::CVertexBuffer::setVertexFormat()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06006.html#l00424">NL3D::CMeshMRMGeom::CMeshBuildMRM::Skinned</a>, <a class="el" href="a06006.html#l00427">NL3D::CMeshMRMGeom::CMeshBuildMRM::SkinWeights</a>, <a class="el" href="a06655.html#l00049">NLMISC::CUV::U</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::U</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00181">NL3D::CMesh::CMeshBuild::UVRouting</a>, <a class="el" href="a06655.html#l00049">NLMISC::CUV::V</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::V</a>, <a class="el" href="a06006.html#l00430">NL3D::CMeshMRMGeom::CMeshBuildMRM::VBuffer</a>, <a class="el" href="a06062.html#l00214">NL3D::CMRMMeshFinal::CWedge::Vertex</a>, <a class="el" href="a06062.html#l00211">NL3D::CMRMMeshFinal::CWedge::VertexSkin</a>, <a class="el" href="a06004.html#l00054">NL3D::CBlendShape::VertRefs</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::W</a>, <a class="el" href="a06062.html#l00281">NL3D::CMRMMeshFinal::Wedges</a>, <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>. +<p> +Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>. +<p> +<div class="fragment"><pre>01919 { +01920 <a class="code" href="a04558.html#a14">sint</a> i,j,k; +01921 <a class="code" href="a04558.html#a14">sint</a> attId; +01922 +01923 <span class="comment">// reset the mbuild.</span> +01924 mbuild= CMeshMRMGeom::CMeshBuildMRM(); +01925 <span class="comment">// Setup VB.</span> +01926 +01927 <span class="keywordtype">bool</span> useFormatExt = <span class="keyword">false</span>; +01928 <span class="comment">// Check wether there are texture coordinates with more than 2 compnents, which force us to use an extended vertex format</span> +01929 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k) +01930 { +01931 <span class="keywordflow">if</span> ( +01932 (vbFlags & (CVertexBuffer::TexCoord0Flag << k)) +01933 && mb.NumCoords[k] != 2) +01934 { +01935 useFormatExt = <span class="keyword">true</span>; +01936 <span class="keywordflow">break</span>; +01937 } +01938 } +01939 +01940 <a class="code" href="a04558.html#a15">uint</a> numTexCoordUsed = 0; +01941 +01942 +01943 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k) +01944 { +01945 <span class="keywordflow">if</span> (vbFlags & (CVertexBuffer::TexCoord0Flag << k)) +01946 { +01947 numTexCoordUsed = k; +01948 } +01949 } +01950 +01951 <span class="keywordflow">if</span> (!useFormatExt) +01952 { +01953 <span class="comment">// setup standard format</span> +01954 mbuild.VBuffer.setVertexFormat(vbFlags); +01955 } +01956 <span class="keywordflow">else</span> <span class="comment">// setup extended format</span> +01957 { +01958 mbuild.VBuffer.clearValueEx(); +01959 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PositionFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Position, CVertexBuffer::Float3); +01960 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::NormalFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Normal, CVertexBuffer::Float3); +01961 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PrimaryColorFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::PrimaryColor, CVertexBuffer::UChar4); +01962 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::SecondaryColorFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::SecondaryColor, CVertexBuffer::UChar4); +01963 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::WeightFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Weight, CVertexBuffer::Float4); +01964 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PaletteSkinFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::PaletteSkin, CVertexBuffer::UChar4); +01965 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::FogFlag) mbuild.VBuffer.addValueEx(CVertexBuffer::Fog, CVertexBuffer::Float1); +01966 +01967 <span class="keywordflow">for</span> (k = 0; k < CVertexBuffer::MaxStage; ++k) +01968 { +01969 <span class="keywordflow">if</span> (vbFlags & (CVertexBuffer::TexCoord0Flag << k)) +01970 { +01971 <span class="keywordflow">switch</span>(mb.NumCoords[k]) +01972 { +01973 <span class="keywordflow">case</span> 2: +01974 mbuild.VBuffer.addValueEx((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), CVertexBuffer::Float2); +01975 <span class="keywordflow">break</span>; +01976 <span class="keywordflow">case</span> 3: +01977 mbuild.VBuffer.addValueEx((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), CVertexBuffer::Float3); +01978 <span class="keywordflow">break</span>; +01979 <span class="keywordflow">default</span>: +01980 <a class="code" href="a04199.html#a6">nlassert</a>(0); +01981 <span class="keywordflow">break</span>; +01982 } +01983 } +01984 } +01985 mbuild.VBuffer.initEx(); +01986 } +01987 +01988 <span class="comment">// Copy the UVRouting</span> +01989 <span class="keywordflow">for</span> (i=0; i<CVertexBuffer::MaxStage; i++) +01990 { +01991 mbuild.VBuffer.setUVRouting (i, mb.UVRouting[i]); +01992 } +01993 +01994 <span class="comment">// Setup the VertexBuffer.</span> +01995 <span class="comment">// ========================</span> +01996 <span class="comment">// resize the VB.</span> +01997 mbuild.VBuffer.setNumVertices(finalMRM.Wedges.size()); +01998 <span class="comment">// Setup SkinWeights.</span> +01999 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +02000 mbuild.SkinWeights.resize(finalMRM.Wedges.size()); +02001 +02002 <span class="comment">// fill the VB.</span> +02003 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Wedges.size(); i++) +02004 { +02005 <span class="keyword">const</span> CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[i]; +02006 +02007 <span class="comment">// setup Vertex.</span> +02008 mbuild.VBuffer.setVertexCoord(i, wedge.Vertex); +02009 +02010 <span class="comment">// seutp attributes.</span> +02011 attId= 0; +02012 +02013 <span class="comment">// For all activated attributes in mbuild, retriev the attribute from the finalMRM.</span> +02014 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::NormalFlag) +02015 { +02016 mbuild.VBuffer.setNormalCoord(i, wedge.Attributes[attId] ); +02017 attId++; +02018 } +02019 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::PrimaryColorFlag) +02020 { +02021 mbuild.VBuffer.setColor(i, <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a>(wedge.Attributes[attId]) ); +02022 attId++; +02023 } +02024 <span class="keywordflow">if</span>(vbFlags & CVertexBuffer::SecondaryColorFlag) +02025 { +02026 mbuild.VBuffer.setSpecular(i, <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_1">attToColor</a>(wedge.Attributes[attId]) ); +02027 attId++; +02028 } +02029 <span class="keywordflow">for</span>(k=0; k<CVertexBuffer::MaxStage;k++) +02030 { +02031 <span class="keywordflow">if</span>(vbFlags & (CVertexBuffer::TexCoord0Flag<<k)) +02032 { +02033 <span class="keywordflow">switch</span>(mb.NumCoords[k]) +02034 { +02035 <span class="keywordflow">case</span> 2: +02036 mbuild.VBuffer.setTexCoord(i, k, (CUV) <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a>(wedge.Attributes[attId]) ); +02037 <span class="keywordflow">break</span>; +02038 <span class="keywordflow">case</span> 3: +02039 { +02040 <a class="code" href="a03641.html">CUVW</a> uvw = <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_2">attToUvw</a>(wedge.Attributes[attId]); +02041 mbuild.VBuffer.setValueFloat3Ex((CVertexBuffer::TValue) (CVertexBuffer::TexCoord0 + k), i, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo0">U</a>, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo1">V</a>, uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo2">W</a>); +02042 } +02043 <span class="keywordflow">break</span>; +02044 <span class="keywordflow">default</span>: +02045 <a class="code" href="a04199.html#a6">nlassert</a>(0); +02046 <span class="keywordflow">break</span>; +02047 } +02048 attId++; +02049 } +02050 } +02051 +02052 <span class="comment">// Setup SkinWeights.</span> +02053 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +02054 { +02055 mbuild.SkinWeights[i]= wedge.VertexSkin; +02056 } +02057 } +02058 +02059 +02060 <span class="comment">// Build Lods.</span> +02061 <span class="comment">// ========================</span> +02062 <span class="comment">// resize</span> +02063 mbuild.Lods.resize(finalMRM.Lods.size()); +02064 <span class="comment">// fill.</span> +02065 <span class="keywordflow">for</span>(i=0; i<(<a class="code" href="a04558.html#a14">sint</a>)finalMRM.Lods.size(); i++) +02066 { +02067 <span class="keyword">const</span> CMRMMeshFinal::CLod &srcLod= finalMRM.Lods[i]; +02068 CMeshMRMGeom::CLod &destLod= mbuild.Lods[i]; +02069 +02070 <span class="comment">// Basic.</span> +02071 <span class="comment">//---------</span> +02072 +02073 <span class="comment">// Copy NWedges infos.</span> +02074 destLod.NWedges= srcLod.NWedges; +02075 <span class="comment">// Copy Geomorphs infos.</span> +02076 destLod.Geomorphs= srcLod.Geomorphs; +02077 +02078 +02079 <span class="comment">// Reorder faces by rdrpass.</span> +02080 <span class="comment">//---------</span> +02081 +02082 <span class="comment">// First count the number of faces used by this LOD for each material </span> +02083 vector<sint> matCount; +02084 <span class="comment">// resize, and reset to 0.</span> +02085 matCount.clear(); +02086 matCount.resize(nbMats, 0); +02087 <span class="comment">// For each face of this Lods, incr the mat face counter.</span> +02088 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++) +02089 { +02090 <a class="code" href="a04558.html#a14">sint</a> matId= srcLod.Faces[j].MaterialId; +02091 <a class="code" href="a04199.html#a6">nlassert</a>(matId>=0); +02092 <a class="code" href="a04199.html#a6">nlassert</a>(matId<(<a class="code" href="a04558.html#a14">sint</a>)nbMats); +02093 <span class="comment">// increment the refcount of this material by this LOD.</span> +02094 matCount[matId]++; +02095 } +02096 +02097 <span class="comment">// Then for each material not empty, create a rdrPass, and ref it for this material.</span> +02098 vector<sint> rdrPassIndex; <span class="comment">// material to rdrPass map.</span> +02099 rdrPassIndex.resize(nbMats); +02100 <span class="keywordflow">for</span>(j=0; j<(<a class="code" href="a04558.html#a14">sint</a>)nbMats; j++) +02101 { +02102 <span class="keywordflow">if</span>(matCount[j]==0) +02103 rdrPassIndex[j]= -1; +02104 <span class="keywordflow">else</span> +02105 { +02106 <span class="comment">// map material to rdrPass.</span> +02107 <a class="code" href="a04558.html#a14">sint</a> idRdrPass= destLod.RdrPass.size(); +02108 rdrPassIndex[j]= idRdrPass; +02109 <span class="comment">// create a rdrPass.</span> +02110 destLod.RdrPass.push_back(CMeshMRMGeom::CRdrPass()); +02111 <span class="comment">// assign the good materialId to this rdrPass.</span> +02112 destLod.RdrPass[idRdrPass].MaterialId= j; +02113 <span class="comment">// reserve the array of faces of this rdrPass.</span> +02114 destLod.RdrPass[idRdrPass].PBlock.reserveTri(matCount[j]); +02115 } +02116 } +02117 +02118 <span class="comment">// Then for each face, add it to the good rdrPass of this Lod.</span> +02119 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++) +02120 { +02121 <a class="code" href="a04558.html#a14">sint</a> matId= srcLod.Faces[j].MaterialId; +02122 <a class="code" href="a04558.html#a14">sint</a> idRdrPass= rdrPassIndex[matId]; +02123 <span class="comment">// add this face to the good rdrPass.</span> +02124 <a class="code" href="a04558.html#a14">sint</a> w0= srcLod.Faces[j].WedgeId[0]; +02125 <a class="code" href="a04558.html#a14">sint</a> w1= srcLod.Faces[j].WedgeId[1]; +02126 <a class="code" href="a04558.html#a14">sint</a> w2= srcLod.Faces[j].WedgeId[2]; +02127 destLod.RdrPass[idRdrPass].PBlock.addTri(w0, w1, w2); +02128 } +02129 +02130 +02131 <span class="comment">// Build skin info for this Lod.</span> +02132 <span class="comment">//---------</span> +02133 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++) +02134 { +02135 destLod.InfluencedVertices[j].clear(); +02136 } +02137 destLod.MatrixInfluences.clear(); +02138 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +02139 { +02140 <span class="comment">// This is the set which tell what wedge has already been inserted.</span> +02141 set<uint> wedgeInfSet; +02142 +02143 <span class="comment">// First, build the list of vertices influenced by this Lod.</span> +02144 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)srcLod.Faces.size(); j++) +02145 { +02146 <span class="keywordflow">for</span>(k=0; k<3; k++) +02147 { +02148 <a class="code" href="a04558.html#a14">sint</a> wedgeId= srcLod.Faces[j].WedgeId[k]; +02149 <span class="comment">// If it is a geomorph</span> +02150 <span class="keywordflow">if</span>(wedgeId<finalMRM.NGeomSpace) +02151 { +02152 <span class="comment">// add the start and end to the list (if not here). NB: wedgeId is both the id </span> +02153 <span class="comment">// of the dest wedge, and the id of the geomorph.</span> +02154 <a class="code" href="a04558.html#a14">sint</a> wedgeStartId= destLod.Geomorphs[wedgeId].Start; +02155 <a class="code" href="a04558.html#a14">sint</a> wedgeEndId= destLod.Geomorphs[wedgeId].End; +02156 <a class="code" href="a04558.html#a15">uint</a> nMatUsedStart= finalMRM.Wedges[wedgeStartId].NSkinMatUsed; +02157 <a class="code" href="a04558.html#a15">uint</a> nMatUsedEnd= finalMRM.Wedges[wedgeEndId].NSkinMatUsed; +02158 +02159 <span class="comment">// if insertion in the set work, add to the good array.</span> +02160 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeStartId).second ) +02161 destLod.InfluencedVertices[nMatUsedStart-1].push_back(wedgeStartId); +02162 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeEndId).second ) +02163 destLod.InfluencedVertices[nMatUsedEnd-1].push_back(wedgeEndId); +02164 } +02165 <span class="keywordflow">else</span> +02166 { +02167 <a class="code" href="a04558.html#a15">uint</a> nMatUsed= finalMRM.Wedges[wedgeId].NSkinMatUsed; +02168 +02169 <span class="comment">// just add this wedge to the list (if not here).</span> +02170 <span class="comment">// if insertion in the set work, add to the array.</span> +02171 <span class="keywordflow">if</span>( wedgeInfSet.insert(wedgeId).second ) +02172 destLod.InfluencedVertices[nMatUsed-1].push_back(wedgeId); +02173 } +02174 } +02175 } +02176 +02177 <span class="comment">// Optimisation: for better cache, sort the destLod.InfluencedVertices in increasing order.</span> +02178 <span class="keywordflow">for</span>(j=0; j<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; j++) +02179 { +02180 sort(destLod.InfluencedVertices[j].begin(), destLod.InfluencedVertices[j].end()); +02181 } +02182 +02183 +02184 <span class="comment">// Then Build the MatrixInfluences array, for all thoses Influenced Vertices only.</span> +02185 <span class="comment">// This is the map MatrixId -> MatrixInfId.</span> +02186 map<uint, uint> matrixInfMap; +02187 +02188 <span class="comment">// For all influenced vertices, flags matrix they use.</span> +02189 <a class="code" href="a04558.html#a15">uint</a> iSkinMat; +02190 <span class="keywordflow">for</span>(iSkinMat= 0; iSkinMat<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; iSkinMat++) +02191 { +02192 <span class="keywordflow">for</span>(j= 0; j<(<a class="code" href="a04558.html#a14">sint</a>)destLod.InfluencedVertices[iSkinMat].size(); j++) +02193 { +02194 <a class="code" href="a04558.html#a15">uint</a> wedgeId= destLod.InfluencedVertices[iSkinMat][j]; +02195 +02196 <span class="comment">// take the original wedge.</span> +02197 <span class="keyword">const</span> CMRMMeshFinal::CWedge &wedge= finalMRM.Wedges[wedgeId]; +02198 <span class="comment">// For all matrix with not null influence...</span> +02199 <span class="keywordflow">for</span>(k= 0; k<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; k++) +02200 { +02201 <span class="keywordtype">float</span> matWeight= wedge.VertexSkin.Weights[k]; +02202 +02203 <span class="comment">// This check the validity of skin weights sort. If false, problem before in the algo.</span> +02204 <span class="keywordflow">if</span>((<a class="code" href="a04558.html#a15">uint</a>)k<iSkinMat+1) +02205 { +02206 <a class="code" href="a04199.html#a6">nlassert</a>( matWeight>0 ); +02207 } +02208 <span class="keywordflow">else</span> +02209 { +02210 <a class="code" href="a04199.html#a6">nlassert</a>( matWeight==0 ); +02211 } +02212 <span class="comment">// if not null influence.</span> +02213 <span class="keywordflow">if</span>(matWeight>0) +02214 { +02215 <a class="code" href="a04558.html#a15">uint</a> matId= wedge.VertexSkin.MatrixId[k]; +02216 +02217 <span class="comment">// search/insert the matrixInfId.</span> +02218 map<uint, uint>::iterator it= matrixInfMap.find(matId); +02219 <span class="keywordflow">if</span>( it==matrixInfMap.end() ) +02220 { +02221 <a class="code" href="a04558.html#a15">uint</a> matInfId= destLod.MatrixInfluences.size(); +02222 matrixInfMap.insert( make_pair(matId, matInfId) ); +02223 <span class="comment">// create the new MatrixInfluence.</span> +02224 destLod.MatrixInfluences.push_back(matId); +02225 } +02226 } +02227 } +02228 } +02229 } +02230 +02231 } +02232 +02233 } +02234 +02235 <span class="comment">// Indicate Skinning.</span> +02236 mbuild.Skinned= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>; +02237 +02238 +02239 +02240 <span class="keywordtype">bool</span> useTgSpace = mb.MeshVertexProgram != NULL ? mb.MeshVertexProgram->needTangentSpace() : false; +02241 +02242 <span class="comment">// Construct Blend Shapes</span> +02244 <span class="comment"></span> mbuild.BlendShapes.resize (finalMRM.MRMBlendShapesFinals.size()); +02245 <span class="keywordflow">for</span> (k = 0; k < (<a class="code" href="a04558.html#a14">sint</a>)mbuild.BlendShapes.size(); ++k) +02246 { +02247 CBlendShape &rBS = mbuild.BlendShapes[k]; +02248 <a class="code" href="a04558.html#a10">sint32</a> nNbVertVB = finalMRM.Wedges.size(); +02249 <span class="keywordtype">bool</span> bIsDeltaPos = <span class="keyword">false</span>; +02250 rBS.deltaPos.resize (nNbVertVB, CVector(0.0f,0.0f,0.0f)); +02251 <span class="keywordtype">bool</span> bIsDeltaNorm = <span class="keyword">false</span>; +02252 rBS.deltaNorm.resize (nNbVertVB, CVector(0.0f,0.0f,0.0f)); +02253 <span class="keywordtype">bool</span> bIsDeltaUV = <span class="keyword">false</span>; +02254 rBS.deltaUV.resize (nNbVertVB, CUV(0.0f,0.0f)); +02255 <span class="keywordtype">bool</span> bIsDeltaCol = <span class="keyword">false</span>; +02256 rBS.deltaCol.resize (nNbVertVB, <a class="code" href="a03338.html">CRGBAF</a>(0.0f,0.0f,0.0f,0.0f)); +02257 <span class="keywordtype">bool</span> bIsDeltaTgSpace = <span class="keyword">false</span>; +02258 <span class="keywordflow">if</span> (useTgSpace) +02259 { +02260 rBS.deltaTgSpace.resize(nNbVertVB, CVector::Null); +02261 } +02262 +02263 rBS.VertRefs.resize (nNbVertVB, 0xffffffff); +02264 +02265 <span class="keywordflow">for</span> (i = 0; i < nNbVertVB; i++) +02266 { +02267 <span class="keyword">const</span> CMRMMeshFinal::CWedge &rWedgeRef = finalMRM.Wedges[i]; +02268 <span class="keyword">const</span> CMRMMeshFinal::CWedge &rWedgeTar = finalMRM.MRMBlendShapesFinals[k].Wedges[i]; +02269 +02270 CVector delta = rWedgeTar.Vertex - rWedgeRef.Vertex; +02271 <a class="code" href="a03668.html">CVectorH</a> attr; +02272 +02273 <span class="keywordflow">if</span> (delta.norm() > 0.001f) +02274 { +02275 rBS.deltaPos[i] = delta; +02276 rBS.VertRefs[i] = i; +02277 bIsDeltaPos = <span class="keyword">true</span>; +02278 } +02279 +02280 attId = 0; +02281 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::NormalFlag) +02282 { +02283 attr = rWedgeRef.Attributes[attId]; +02284 CVector NormRef = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>); +02285 attr = rWedgeTar.Attributes[attId]; +02286 CVector NormTar = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>); +02287 delta = NormTar - NormRef; +02288 <span class="keywordflow">if</span> (delta.norm() > 0.001f) +02289 { +02290 rBS.deltaNorm[i] = delta; +02291 rBS.VertRefs[i] = i; +02292 bIsDeltaNorm = <span class="keyword">true</span>; +02293 } +02294 attId++; +02295 } +02296 +02297 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::PrimaryColorFlag) +02298 { +02299 attr = rWedgeRef.Attributes[attId]; +02300 <a class="code" href="a03338.html">CRGBAF</a> RGBARef = <a class="code" href="a03338.html">CRGBAF</a>(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>/255.0f); +02301 attr = rWedgeTar.Attributes[attId]; +02302 CRGBAF RGBATar = CRGBAF(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>/255.0f, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>/255.0f); +02303 CRGBAF deltaRGBA = RGBATar - RGBARef; +02304 <span class="keywordflow">if</span> ((deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo3">R</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo3">R</a> + deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo2">G</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo2">G</a> + +02305 deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo1">B</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo1">B</a> + deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo0">A</a>*deltaRGBA.<a class="code" href="a03338.html#NLMISC_1_1CRGBAFo0">A</a>) > 0.0001f) +02306 { +02307 rBS.deltaCol[i] = deltaRGBA; +02308 rBS.VertRefs[i] = i; +02309 bIsDeltaCol = <span class="keyword">true</span>; +02310 } +02311 attId++; +02312 } +02313 +02314 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::SecondaryColorFlag) +02315 { <span class="comment">// Nothing to do !</span> +02316 attId++; +02317 } +02318 +02319 <span class="comment">// Do that only for the UV0</span> +02320 <span class="keywordflow">if</span> (vbFlags & CVertexBuffer::TexCoord0Flag) +02321 { +02322 attr = rWedgeRef.Attributes[attId]; +02323 CUV UVRef = CUV(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>); +02324 attr = rWedgeTar.Attributes[attId]; +02325 CUV UVTar = CUV(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>); +02326 CUV deltaUV = UVTar - UVRef; +02327 <span class="keywordflow">if</span> ((deltaUV.U*deltaUV.U + deltaUV.V*deltaUV.V) > 0.0001f) +02328 { +02329 rBS.deltaUV[i] = deltaUV; +02330 rBS.VertRefs[i] = i; +02331 bIsDeltaUV = <span class="keyword">true</span>; +02332 } +02333 attId++; +02334 } +02335 +02336 <span class="keywordflow">if</span> (useTgSpace) +02337 { +02338 attr = rWedgeRef.Attributes[attId]; +02339 CVector TgSpaceRef = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>); +02340 attr = rWedgeTar.Attributes[attId]; +02341 CVector TgSpaceTar = CVector(attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>, attr.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>); +02342 delta = TgSpaceTar - TgSpaceRef; +02343 <span class="keywordflow">if</span> (delta.norm() > 0.001f) +02344 { +02345 rBS.deltaTgSpace[i] = delta; +02346 rBS.VertRefs[i] = i; +02347 bIsDeltaTgSpace = <span class="keyword">true</span>; +02348 } +02349 attId++; +02350 } +02351 +02352 } <span class="comment">// End of all vertices added in blend shape</span> +02353 +02354 <span class="comment">// Delete unused items and calculate the number of vertex used (blended)</span> +02355 +02356 <a class="code" href="a04558.html#a10">sint32</a> nNbVertUsed = nNbVertVB; +02357 <a class="code" href="a04558.html#a10">sint32</a> nDstPos = 0; +02358 <span class="keywordflow">for</span> (j = 0; j < nNbVertVB; ++j) +02359 { +02360 <span class="keywordflow">if</span> (rBS.VertRefs[j] == 0xffffffff) <span class="comment">// Is vertex UNused</span> +02361 { +02362 --nNbVertUsed; +02363 } +02364 <span class="keywordflow">else</span> <span class="comment">// Vertex used</span> +02365 { +02366 <span class="keywordflow">if</span> (nDstPos != j) +02367 { +02368 rBS.VertRefs[nDstPos] = rBS.VertRefs[j]; +02369 rBS.deltaPos[nDstPos] = rBS.deltaPos[j]; +02370 rBS.deltaNorm[nDstPos] = rBS.deltaNorm[j]; +02371 rBS.deltaUV[nDstPos] = rBS.deltaUV[j]; +02372 rBS.deltaCol[nDstPos] = rBS.deltaCol[j]; +02373 <span class="keywordflow">if</span> (useTgSpace) +02374 { +02375 rBS.deltaTgSpace[nDstPos] = rBS.deltaTgSpace[j]; +02376 } +02377 } +02378 ++nDstPos; +02379 } +02380 } +02381 +02382 <span class="keywordflow">if</span> (bIsDeltaPos) +02383 rBS.deltaPos.resize (nNbVertUsed); +02384 <span class="keywordflow">else</span> +02385 rBS.deltaPos.resize (0); +02386 +02387 <span class="keywordflow">if</span> (bIsDeltaNorm) +02388 rBS.deltaNorm.resize (nNbVertUsed); +02389 <span class="keywordflow">else</span> +02390 rBS.deltaNorm.resize (0); +02391 +02392 <span class="keywordflow">if</span> (bIsDeltaUV) +02393 rBS.deltaUV.resize (nNbVertUsed); +02394 <span class="keywordflow">else</span> +02395 rBS.deltaUV.resize (0); +02396 +02397 <span class="keywordflow">if</span> (bIsDeltaCol) +02398 rBS.deltaCol.resize (nNbVertUsed); +02399 <span class="keywordflow">else</span> +02400 rBS.deltaCol.resize (0); +02401 +02402 <span class="keywordflow">if</span> (bIsDeltaTgSpace) +02403 rBS.deltaTgSpace.resize (nNbVertUsed); +02404 <span class="keywordflow">else</span> +02405 rBS.deltaTgSpace.resize (0); +02406 +02407 +02408 rBS.VertRefs.resize (nNbVertUsed); +02409 +02410 } +02411 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_5" doxytag="NL3D::CMRMBuilder::buildMrmBaseMesh" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NL3D::CMRMBuilder::buildMrmBaseMesh </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td> + <td class="mdname" nowrap> <em>mbuild</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname" nowrap> <em>baseMesh</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +from a meshBuild, compute a <a class="el" href="a02960.html">CMRMMesh</a>. This is the first stage of the algo. <dl compact><dt><b>Returns:</b></dt><dd>the vertexFormat supported by <a class="el" href="a02951.html">CMRMBuilder</a>.</dd></dl> + +<p> +Definition at line <a class="el" href="a06055.html#l01734">1734</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00229">_AttributeMap</a>, <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a05990.html#l00090">NL3D::CMesh::CCorner::Color</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a05990.html#l00193">NL3D::CMesh::CMeshBuild::Faces</a>, <a class="el" href="a06055.html#l01685">findInsertColorInBaseMesh()</a>, <a class="el" href="a06055.html#l01675">findInsertNormalInBaseMesh()</a>, <a class="el" href="a06055.html#l01697">findInsertUvwInBaseMesh()</a>, <a class="el" href="a05990.html#l00207">NL3D::CMesh::CMeshBuild::InterfaceLinks</a>, <a class="el" href="a06062.html#l00123">NL3D::CMRMMesh::InterfaceLinks</a>, <a class="el" href="a06062.html#l00046">NL3D_MRM_MAX_ATTRIB</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05990.html#l00088">NL3D::CMesh::CCorner::Normal</a>, <a class="el" href="a06062.html#l00127">NL3D::CMRMMesh::NumAttributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05990.html#l00187">NL3D::CMesh::CMeshBuild::SkinWeights</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, <a class="el" href="a05990.html#l00091">NL3D::CMesh::CCorner::Specular</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00089">NL3D::CMesh::CCorner::Uvws</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, <a class="el" href="a05990.html#l00179">NL3D::CMesh::CMeshBuild::VertexFlags</a>, <a class="el" href="a05990.html#l00184">NL3D::CMesh::CMeshBuild::Vertices</a>, and <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>. +<p> +Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>. +<p> +<div class="fragment"><pre>01735 { +01736 <a class="code" href="a04558.html#a14">sint</a> i,j,k; +01737 <a class="code" href="a04558.html#a14">sint</a> nFaces; +01738 <a class="code" href="a04558.html#a14">sint</a> attId; +01739 <span class="comment">// build the supported VertexFormat.</span> +01740 <a class="code" href="a04558.html#a11">uint32</a> retVbFlags= CVertexBuffer::PositionFlag; +01741 +01742 +01743 <span class="comment">// reset the baseMesh.</span> +01744 baseMesh= CMRMMesh(); +01745 <span class="comment">// reset Tmp.</span> +01746 <span class="keywordflow">for</span>(attId=0; attId<<a class="code" href="a04639.html#a0">NL3D_MRM_MAX_ATTRIB</a>;attId++) +01747 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">_AttributeMap</a>[attId].clear(); +01748 +01749 +01750 <span class="comment">// Compute number of attributes used by the MeshBuild.</span> +01751 <span class="comment">// ========================</span> +01752 <span class="comment">// Compute too </span> +01753 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::NormalFlag) +01754 { +01755 baseMesh.NumAttributes++; +01756 retVbFlags|= CVertexBuffer::NormalFlag; +01757 } +01758 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::PrimaryColorFlag) +01759 { +01760 baseMesh.NumAttributes++; +01761 retVbFlags|= CVertexBuffer::PrimaryColorFlag; +01762 } +01763 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::SecondaryColorFlag) +01764 { +01765 baseMesh.NumAttributes++; +01766 retVbFlags|= CVertexBuffer::SecondaryColorFlag; +01767 } +01768 <span class="keywordflow">for</span>(k=0; k<CVertexBuffer::MaxStage;k++) +01769 { +01770 <a class="code" href="a04558.html#a15">uint</a> flag=CVertexBuffer::TexCoord0Flag<<k; +01771 <span class="keywordflow">if</span>(mbuild.VertexFlags & flag) +01772 { +01773 baseMesh.NumAttributes++; +01774 retVbFlags|=flag; +01775 } +01776 } +01777 <a class="code" href="a04199.html#a6">nlassert</a>(baseMesh.NumAttributes<=NL3D_MRM_MAX_ATTRIB); +01778 +01779 +01780 <span class="comment">// Fill basics: Vertices and Faces materials / index to vertices.</span> +01781 <span class="comment">// ========================</span> +01782 <span class="comment">// Just copy vertices.</span> +01783 baseMesh.Vertices= mbuild.Vertices; +01784 <span class="comment">// Just copy SkinWeights.</span> +01785 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +01786 baseMesh.SkinWeights= mbuild.SkinWeights; +01787 <span class="comment">// Just copy InterfaceLinks</span> +01788 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>) +01789 baseMesh.InterfaceLinks= mbuild.InterfaceLinks; +01790 <span class="comment">// Resize faces.</span> +01791 nFaces= mbuild.Faces.size(); +01792 baseMesh.Faces.resize(nFaces); +01793 <span class="keywordflow">for</span>(i=0; i<nFaces; i++) +01794 { +01795 <span class="comment">// copy material Id.</span> +01796 baseMesh.Faces[i].MaterialId= mbuild.Faces[i].MaterialId; +01797 <span class="comment">// Copy Vertex index.</span> +01798 <span class="keywordflow">for</span>(j=0; j<3; j++) +01799 { +01800 baseMesh.Faces[i].Corner[j].Vertex= mbuild.Faces[i].Corner[j].Vertex; +01801 } +01802 } +01803 +01804 <span class="comment">// Resolve attributes discontinuities and Fill attributes of the baseMesh.</span> +01805 <span class="comment">// ========================</span> +01806 <span class="comment">// For all corners.</span> +01807 <span class="keywordflow">for</span>(i=0; i<nFaces; i++) +01808 { +01809 <span class="keywordflow">for</span>(j=0; j<3; j++) +01810 { +01811 <span class="keyword">const</span> CMesh::CCorner &srcCorner= mbuild.Faces[i].Corner[j]; +01812 CMRMCorner &destCorner= baseMesh.Faces[i].Corner[j]; +01813 attId= 0; +01814 +01815 <span class="comment">// For all activated attributes in mbuild, find/insert the attribute in the baseMesh.</span> +01816 <span class="comment">// NB: 2 attributes are said to be different if they have not the same value OR if they don't lie </span> +01817 <span class="comment">// on the same vertex. This is very important for MRM computing.</span> +01818 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::NormalFlag) +01819 { +01820 destCorner.Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_8">findInsertNormalInBaseMesh</a>(baseMesh, attId, destCorner.Vertex, srcCorner.Normal); +01821 attId++; +01822 } +01823 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::PrimaryColorFlag) +01824 { +01825 destCorner.Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_7">findInsertColorInBaseMesh</a>(baseMesh, attId, destCorner.Vertex, srcCorner.Color); +01826 attId++; +01827 } +01828 <span class="keywordflow">if</span>(mbuild.VertexFlags & CVertexBuffer::SecondaryColorFlag) +01829 { +01830 destCorner.Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_7">findInsertColorInBaseMesh</a>(baseMesh, attId, destCorner.Vertex, srcCorner.Specular); +01831 attId++; +01832 } +01833 <span class="keywordflow">for</span>(k=0; k<CVertexBuffer::MaxStage;k++) +01834 { +01835 <span class="keywordflow">if</span>(mbuild.VertexFlags & (CVertexBuffer::TexCoord0Flag<<k)) +01836 { +01837 destCorner.Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_9">findInsertUvwInBaseMesh</a>(baseMesh, attId, destCorner.Vertex, srcCorner.Uvws[k]); +01838 attId++; +01839 } +01840 } +01841 } +01842 } +01843 +01844 +01845 +01846 <span class="comment">// End. clear Tmp infos.</span> +01847 <span class="comment">// ========================</span> +01848 <span class="comment">// reset Tmp.</span> +01849 <span class="keywordflow">for</span>(attId=0; attId<<a class="code" href="a04639.html#a0">NL3D_MRM_MAX_ATTRIB</a>;attId++) +01850 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">_AttributeMap</a>[attId].clear(); +01851 +01852 <span class="keywordflow">return</span> retVbFlags; +01853 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz561_0" doxytag="NL3D::CMRMBuilder::buildMRMSewingMeshes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::buildMRMSewingMeshes </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td> + <td class="mdname" nowrap> <em>mbuild</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>nWantedLods</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>divisor</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l03115">3115</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00152">_SewingMeshes</a>, <a class="el" href="a05990.html#l00207">NL3D::CMesh::CMeshBuild::InterfaceLinks</a>, <a class="el" href="a05990.html#l00205">NL3D::CMesh::CMeshBuild::Interfaces</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05990.html#l00184">NL3D::CMesh::CMeshBuild::Vertices</a>. +<p> +Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>. +<p> +<div class="fragment"><pre>03116 { +03117 <a class="code" href="a04199.html#a6">nlassert</a>(nWantedLods>=1); +03118 <a class="code" href="a04199.html#a6">nlassert</a>(divisor>=1); +03119 <span class="keywordflow">if</span>(mbuild.Interfaces.size()==0) +03120 <span class="keywordflow">return</span> <span class="keyword">false</span>; +03121 <span class="comment">// must have same size</span> +03122 <span class="keywordflow">if</span>(mbuild.InterfaceLinks.size()!=mbuild.Vertices.size()) +03123 <span class="keywordflow">return</span> <span class="keyword">false</span>; +03124 +03125 <span class="comment">// **** For each interface, MRM-ize it and store.</span> +03126 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a>.resize(mbuild.Interfaces.size()); +03127 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<mbuild.Interfaces.size();i++) +03128 { +03129 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a>[i].build(mbuild.Interfaces[i], nWantedLods, divisor); +03130 } +03131 +03132 +03133 <span class="keywordflow">return</span> <span class="keyword">true</span>; +03134 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz557_0" doxytag="NL3D::CMRMBuilder::collapseEdge" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::collapseEdge </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02955.html">CMRMEdge</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>edge</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00499">499</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00154">_CurrentLodComputed</a>, <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06056.html#l00152">_SewingMeshes</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06058.html#l00124">NL3D::CMRMAttribute::BSCurrent</a>, <a class="el" href="a06058.html#l00097">NL3D::CMRMVertex::BSCurrent</a>, <a class="el" href="a06058.html#l00223">NL3D::CMRMFaceBuild::BSInterpolated</a>, <a class="el" href="a06058.html#l00125">NL3D::CMRMAttribute::CollapsedTo</a>, <a class="el" href="a06058.html#l00101">NL3D::CMRMVertex::CollapsedTo</a>, <a class="el" href="a06055.html#l00399">collapseSkinWeight()</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06058.html#l00123">NL3D::CMRMAttribute::Current</a>, <a class="el" href="a06058.html#l00096">NL3D::CMRMVertex::Current</a>, <a class="el" href="a06058.html#l00099">NL3D::CMRMVertex::CurrentSW</a>, <a class="el" href="a06055.html#l00051">NL3D::deleteElement()</a>, <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06055.html#l00333">faceShareWedges()</a>, <a class="el" href="a06055.html#l00046">NL3D::findElement()</a>, <a class="el" href="a06058.html#l00313">NL3D::CMRMFaceBuild::getAssociatedWedge()</a>, <a class="el" href="a05990.html#l00162">NL3D::CMesh::CInterfaceLink::InterfaceId</a>, <a class="el" href="a06058.html#l00106">NL3D::CMRMVertex::InterfaceLink</a>, <a class="el" href="a05990.html#l00164">NL3D::CMesh::CInterfaceLink::InterfaceVertexId</a>, <a class="el" href="a06058.html#l00222">NL3D::CMRMFaceBuild::InterpolatedAttribute</a>, <a class="el" href="a06058.html#l00131">NL3D::CMRMAttribute::InterpolatedFace</a>, <a class="el" href="a06057.html#l00041">NL3D::CMRMSewingMesh::mustCollapseEdge()</a>, <a class="el" href="a06058.html#l00132">NL3D::CMRMAttribute::NbSharedFaces</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06055.html#l00367">removeFaceFromEdgeList()</a>, <a class="el" href="a06058.html#l00133">NL3D::CMRMAttribute::Shared</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, <a class="el" href="a06055.html#l00108">vertexClosed()</a>, <a class="el" href="a06055.html#l00103">vertexContinue()</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00945">collapseEdges()</a>. +<p> +<div class="fragment"><pre>00500 { +00501 <a class="code" href="a04558.html#a14">sint</a> i,j; +00502 <span class="keywordtype">float</span> InterValue; +00503 <a class="code" href="a04558.html#a14">sint</a> edgeV1=edge.v0; +00504 <a class="code" href="a04558.html#a14">sint</a> edgeV2=edge.v1; +00505 +00506 +00507 <span class="comment">// 0. collapse the vertices.</span> +00508 <span class="comment">//==========================</span> +00509 +00510 <span class="comment">// edge.Vertex1 kept, but morphed.</span> +00511 <span class="comment">// edge.Vertex2 deleted, and must know on which vertex it collapse.</span> +00512 CMRMVertex &Vertex1=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[edgeV1], &Vertex2=TmpVertices[edgeV2]; +00513 +00514 <span class="comment">// Interpolation choice.</span> +00515 <span class="comment">// Default is to interpolate vertex 0 to the middle of the edge.</span> +00516 InterValue=0.5; +00517 <span class="comment">//InterValue=1;</span> +00518 <span class="comment">// **** If at least one vertex of the edge is on a mesh sewing interface, must change InterValue</span> +00519 <span class="keywordflow">if</span>( <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a> && (Vertex1.InterfaceLink.InterfaceId>=0 || Vertex2.InterfaceLink.InterfaceId>=0) ) +00520 { +00521 <span class="comment">// If this is an edge of a mesh sewing interface</span> +00522 <span class="keywordflow">if</span>(Vertex1.InterfaceLink.InterfaceId==Vertex2.InterfaceLink.InterfaceId) +00523 { +00524 <span class="comment">// Then the edge is one of the sewing interface mesh. must do special things for it</span> +00525 CMRMSewingMesh &sewingMesh= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a>[Vertex1.InterfaceLink.InterfaceId]; +00526 +00527 <span class="comment">// get the sewing edge id</span> +00528 CMRMEdge sewingEdge; +00529 sewingEdge.v0= Vertex1.InterfaceLink.InterfaceVertexId; +00530 sewingEdge.v1= Vertex2.InterfaceLink.InterfaceVertexId; +00531 +00532 <span class="comment">// Get the edge in the sewing mesh which is said to be collapsed</span> +00533 <a class="code" href="a04558.html#a15">uint</a> vertToCollapse; +00534 <a class="code" href="a04558.html#a14">sint</a> collapseId= sewingMesh.mustCollapseEdge(_CurrentLodComputed, sewingEdge, vertToCollapse); +00535 <span class="comment">// if exist</span> +00536 <span class="keywordflow">if</span>(collapseId>=0) +00537 { +00538 <span class="comment">// if it is v0 which must collapse, then InterValue=1</span> +00539 <span class="keywordflow">if</span>(vertToCollapse==(<a class="code" href="a04558.html#a15">uint</a>)sewingEdge.v0) +00540 InterValue= 1; +00541 <span class="keywordflow">else</span> +00542 InterValue= 0; +00543 +00544 } +00545 <span class="keywordflow">else</span> +00546 { +00547 <span class="comment">// This should not happens. But it is still possible if this edge don't want to collapse but if their</span> +00548 <span class="comment">// is no more choice. Take a default value</span> +00549 InterValue= 0; +00550 } +00551 } +00552 <span class="keywordflow">else</span> +00553 { +00554 <span class="comment">// must collapse to the vertex on the sewing interface (as if it was open)</span> +00555 <span class="keywordflow">if</span>(Vertex1.InterfaceLink.InterfaceId>=0) +00556 { +00557 <span class="comment">// NB: it is possible that both vertices are on a different sewing interface... still collapse (must have to)</span> +00558 InterValue= 0; +00559 } +00560 <span class="keywordflow">else</span> +00561 { +00562 <span class="comment">// Then Vertex2 is on a sewing interface, collapse to it</span> +00563 InterValue= 1; +00564 } +00565 } +00566 } +00567 <span class="comment">// **** Else, on special cases, it is much more efficient to interpolate at start or at end of edge.</span> +00568 <span class="keywordflow">else</span> +00569 { +00570 <span class="comment">// If one vertex is "open", ie his shared faces do not represent a closed Fan, then interpolate to this one, </span> +00571 <span class="comment">// so the mesh has the same silhouette.</span> +00572 <span class="keywordtype">bool</span> vc1= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_4">vertexClosed</a>(edgeV1); +00573 <span class="keywordtype">bool</span> vc2= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_4">vertexClosed</a>(edgeV2); +00574 <span class="keywordflow">if</span>(!vc1 && vc2) InterValue=0; +00575 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(vc1 && !vc2) InterValue=1; +00576 <span class="keywordflow">else</span> +00577 { +00578 <span class="comment">// Do the same test but with vertex continue: it is preferable to not move the boundaries </span> +00579 <span class="comment">// of a material, or a mapping.</span> +00580 <span class="keywordtype">bool</span> vc1= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a>(edgeV1); +00581 <span class="keywordtype">bool</span> vc2= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a>(edgeV2); +00582 <span class="keywordflow">if</span>(!vc1 && vc2) InterValue=0; +00583 <span class="keywordflow">if</span>(vc1 && !vc2) InterValue=1; +00584 } +00585 } +00586 <span class="comment">/*BENCH_TotalCollapses++;</span> +00587 <span class="comment"> if(InterValue==0.5)</span> +00588 <span class="comment"> BENCH_MiddleCollapses++;*/</span> +00589 +00590 <span class="comment">// Collapse the Vertex.</span> +00591 <span class="comment">//========================</span> +00592 Vertex1.Current= Vertex1.Current*(1-InterValue) + Vertex2.Current*InterValue; +00593 <span class="keywordflow">for</span> (i = 0; i < (<a class="code" href="a04558.html#a14">sint</a>)Vertex1.BSCurrent.size(); ++i) +00594 Vertex1.BSCurrent[i] = Vertex1.BSCurrent[i]*(1-InterValue) + Vertex2.BSCurrent[i]*InterValue; +00595 Vertex2.CollapsedTo= edgeV1; +00596 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +00597 Vertex1.CurrentSW= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_1">collapseSkinWeight</a>(Vertex1.CurrentSW, Vertex2.CurrentSW, InterValue); +00598 <span class="keywordflow">if</span>( <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a> ) +00599 Vertex1.InterfaceLink= InterValue<0.5f? Vertex1.InterfaceLink : Vertex2.InterfaceLink; +00600 +00601 <span class="comment">// \todo yoyo: TODO_BUG: Don't know why, but vertices may point on deleted faces.</span> +00602 <span class="comment">// Temp: we destroy here thoses face from SharedFaces...</span> +00603 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++) +00604 { +00605 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i]; +00606 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].Deleted) +00607 <a class="code" href="a05363.html#a438">deleteElement</a>(Vertex1.SharedFaces, numFace), i--; +00608 } +00609 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex2.SharedFaces.size();i++) +00610 { +00611 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex2.SharedFaces[i]; +00612 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].Deleted) +00613 <a class="code" href="a05363.html#a438">deleteElement</a>(Vertex2.SharedFaces, numFace), i--; +00614 } +00615 +00616 +00617 <span class="comment">// Build Neighbor faces.</span> +00618 vector<sint> neighboorFaces; +00619 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++) +00620 { +00621 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i]; +00622 <span class="keywordflow">if</span>(!<a class="code" href="a05363.html#a437">findElement</a>(neighboorFaces, numFace)) +00623 neighboorFaces.push_back(numFace); +00624 } +00625 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex2.SharedFaces.size();i++) +00626 { +00627 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex2.SharedFaces[i]; +00628 <span class="keywordflow">if</span>(!<a class="code" href="a05363.html#a437">findElement</a>(neighboorFaces, numFace)) +00629 neighboorFaces.push_back(numFace); +00630 } +00631 +00632 <span class="comment">// Build faces which will be destroyed (may 1 or 2, maybe more for non conventionnal meshes).</span> +00633 vector<sint> deletedFaces; +00634 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++) +00635 { +00636 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i]; +00637 <a class="code" href="a04199.html#a6">nlassert</a>(!TmpFaces[numFace].Deleted); +00638 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].hasVertex(edgeV2)) +00639 deletedFaces.push_back(numFace); +00640 } +00641 +00642 +00643 <span class="comment">// 1. Collapse the wedges.</span> +00644 <span class="comment">//========================</span> +00645 +00646 <span class="comment">// For ALL Attributes.</span> +00647 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++) +00648 { +00649 <span class="comment">// a/ Stock the wedge interpolation in each destroyed face.</span> +00650 <span class="comment">//------------------------------------------------------</span> +00651 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++) +00652 { +00653 CMRMFaceBuild &face= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[i]]; +00654 +00655 <a class="code" href="a03668.html">CVectorH</a> &w0= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][ face.getAssociatedWedge(attId, edgeV1) ].Current; +00656 <a class="code" href="a03668.html">CVectorH</a> &w1= TmpAttributes[attId][ face.getAssociatedWedge(attId, edgeV2) ].Current; +00657 +00658 <a class="code" href="a03668.html">CVectorH</a> &itp= face.InterpolatedAttribute; +00659 itp.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>= w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>*InterValue; +00660 itp.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>= w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>*InterValue; +00661 itp.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>= w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>*InterValue; +00662 itp.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>= w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>*InterValue; +00663 +00664 <span class="keywordflow">for</span> (j = 0; j < (<a class="code" href="a04558.html#a14">sint</a>)face.BSInterpolated.size(); ++j) +00665 { +00666 <a class="code" href="a03668.html">CVectorH</a> &w0 = TmpAttributes[attId][face.getAssociatedWedge(attId, edgeV1)].BSCurrent[j]; +00667 <a class="code" href="a03668.html">CVectorH</a> &w1 = TmpAttributes[attId][face.getAssociatedWedge(attId, edgeV2)].BSCurrent[j]; +00668 <a class="code" href="a03668.html">CVectorH</a> &itb = face.BSInterpolated[j]; +00669 itb.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a> = w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>*InterValue; +00670 itb.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a> = w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>*InterValue; +00671 itb.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a> = w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>*InterValue; +00672 itb.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a> = w0.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>*(1-InterValue) + w1.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>*InterValue; +00673 } +00674 } +00675 +00676 +00677 <span class="comment">// b/ Build wedge list to be modify.</span> +00678 <span class="comment">//----------------------------------</span> +00679 vector<sint> wedges; +00680 +00681 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)neighboorFaces.size();i++) +00682 { +00683 CMRMFaceBuild &face= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[neighboorFaces[i]]; +00684 <a class="code" href="a04558.html#a14">sint</a> numWedge; +00685 +00686 numWedge= face.getAssociatedWedge(attId, edgeV1); +00687 <span class="keywordflow">if</span>(numWedge>=0 && !<a class="code" href="a05363.html#a437">findElement</a>(wedges, numWedge)) +00688 wedges.push_back(numWedge); +00689 +00690 numWedge= face.getAssociatedWedge(attId, edgeV2); +00691 <span class="keywordflow">if</span>(numWedge>=0 && !<a class="code" href="a05363.html#a437">findElement</a>(wedges, numWedge)) +00692 wedges.push_back(numWedge); +00693 } +00694 +00695 +00696 <span class="comment">// c/ Count numFaces which point on those wedges. (- deleted faces).</span> +00697 <span class="comment">//------------------------------------------------------------------</span> +00698 +00699 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)wedges.size();i++) +00700 { +00701 <a class="code" href="a04558.html#a14">sint</a> numWedge= wedges[i]; +00702 CMRMAttribute &wedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][numWedge]; +00703 +00704 wedge.NbSharedFaces=0; +00705 wedge.Shared=<span class="keyword">false</span>; +00706 +00707 <span class="comment">// Count total ref count.</span> +00708 <span class="keywordflow">for</span>(j=0;j<(<a class="code" href="a04558.html#a14">sint</a>)neighboorFaces.size();j++) +00709 { +00710 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[neighboorFaces[j]].hasWedge(attId, numWedge)) +00711 wedge.NbSharedFaces++; +00712 } +00713 +00714 <span class="comment">// Minus deleted faces.</span> +00715 <span class="keywordflow">for</span>(j=0;j<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();j++) +00716 { +00717 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[j]].hasWedge(attId, numWedge)) +00718 { +00719 wedge.NbSharedFaces--; +00720 wedge.Shared=<span class="keyword">true</span>; +00721 wedge.InterpolatedFace=deletedFaces[j]; +00722 } +00723 } +00724 } +00725 +00726 +00727 <span class="comment">// d/ Collapse wedge following 3 possibles cases.</span> +00728 <span class="comment">//-----------------------------------------------</span> +00729 +00730 +00731 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)wedges.size();i++) +00732 { +00733 <a class="code" href="a04558.html#a14">sint</a> numWedge= wedges[i]; +00734 CMRMAttribute &wedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][numWedge]; +00735 +00736 <span class="comment">// if wedge not shared...</span> +00737 <span class="keywordflow">if</span>(!wedge.Shared) +00738 { +00739 <span class="comment">// We've got an "exterior wedge" which lost no corner => do not merge it nor delete it. </span> +00740 <span class="comment">// Leave it as the same value (extrapolate it may not be a good solution).</span> +00741 } +00742 <span class="keywordflow">else</span> +00743 { +00744 <span class="comment">// if wedge dissapears, notify.</span> +00745 <span class="keywordflow">if</span>(wedge.NbSharedFaces==0) +00746 { +00747 wedge.CollapsedTo=-2; +00748 <span class="comment">// Do not change his value. (as specified in Hope article).</span> +00749 } +00750 <span class="keywordflow">else</span> +00751 { +00752 CMRMFaceBuild &face= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[wedge.InterpolatedFace]; +00753 +00754 <span class="comment">// Must interpolate it.</span> +00755 wedge.Current= face.InterpolatedAttribute; +00756 wedge.BSCurrent = face.BSInterpolated; +00757 +00758 <span class="comment">// Must merge the wedge of the second vertex on first</span> +00759 <span class="comment">// ONLY IF 2 interpolated wedges are shared and NbSharedFaces!=0.</span> +00760 <span class="keywordflow">if</span>( numWedge==face.getAssociatedWedge(attId, edgeV2) && +00761 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_2">faceShareWedges</a>(&face, attId, edgeV1, edgeV2) ) +00762 { +00763 wedge.CollapsedTo= face.getAssociatedWedge(attId, edgeV1); +00764 } +00765 } +00766 } +00767 } +00768 +00769 } +00770 +00771 <span class="comment">// 3. collapse faces.</span> +00772 <span class="comment">//===================</span> +00773 +00774 <span class="comment">// delete face shared by edge.</span> +00775 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++) +00776 { +00777 <a class="code" href="a04558.html#a14">sint</a> numFace= deletedFaces[i]; +00778 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].Deleted=<span class="keyword">true</span>; +00779 +00780 <span class="comment">// release edges from list.</span> +00781 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_6">removeFaceFromEdgeList</a>(TmpFaces[numFace]); +00782 <span class="comment">// ivalid all it!!</span> +00783 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].invalidAllIts(EdgeCollapses); +00784 +00785 +00786 <span class="comment">// delete from vertex1 and 2 the deleted faces.</span> +00787 <a class="code" href="a05363.html#a438">deleteElement</a>( Vertex1.SharedFaces, numFace); +00788 <a class="code" href="a05363.html#a438">deleteElement</a>( Vertex2.SharedFaces, numFace); +00789 } +00790 +00791 +00792 <span class="comment">// must ref correctly the faces.</span> +00793 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)neighboorFaces.size();i++) +00794 { +00795 CMRMFaceBuild &face=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[neighboorFaces[i]]; +00796 +00797 <span class="comment">// good vertices</span> +00798 <span class="keywordflow">if</span>(face.Corner[0].Vertex ==edgeV2) face.Corner[0].Vertex=edgeV1; +00799 <span class="keywordflow">if</span>(face.Corner[1].Vertex ==edgeV2) face.Corner[1].Vertex=edgeV1; +00800 <span class="keywordflow">if</span>(face.Corner[2].Vertex ==edgeV2) face.Corner[2].Vertex=edgeV1; +00801 <span class="comment">// nb: doesn't matter if deletedFaces are modified...</span> +00802 +00803 <span class="comment">// good wedges</span> +00804 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> attId=0;attId<NumAttributes;attId++) +00805 { +00806 <a class="code" href="a04558.html#a14">sint</a> newWedge; +00807 newWedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][ face.Corner[0].Attributes[attId] ].CollapsedTo; +00808 <span class="keywordflow">if</span>(newWedge>=0) face.Corner[0].Attributes[attId]= newWedge; +00809 newWedge= TmpAttributes[attId][ face.Corner[1].Attributes[attId] ].CollapsedTo; +00810 <span class="keywordflow">if</span>(newWedge>=0) face.Corner[1].Attributes[attId]= newWedge; +00811 newWedge= TmpAttributes[attId][ face.Corner[2].Attributes[attId] ].CollapsedTo; +00812 <span class="keywordflow">if</span>(newWedge>=0) face.Corner[2].Attributes[attId]= newWedge; +00813 } +00814 +00815 <span class="comment">// good edges.</span> +00816 <span class="comment">/* Those ones are updated in collapseEdges(): they are removed from the edgeCollapseList, </span> +00817 <span class="comment"> then they are re-inserted with good Vertex indices.</span> +00818 <span class="comment"> */</span> +00819 } +00820 +00821 +00822 <span class="comment">// The vertex1 has now the shared env of vertex2.</span> +00823 Vertex1.SharedFaces.insert(Vertex1.SharedFaces.end(), Vertex2.SharedFaces.begin(), +00824 Vertex2.SharedFaces.end()); +00825 +00826 +00827 <span class="keywordflow">return</span> deletedFaces.size(); +00828 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz559_0" doxytag="NL3D::CMRMBuilder::collapseEdges" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::collapseEdges </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>nWantedFaces</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00945">945</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06055.html#l00347">insertFaceIntoEdgeList()</a>, <a class="el" href="a06058.html#l00278">NL3D::CMRMFaceBuild::invalidEdgeIt()</a>, <a class="el" href="a06058.html#l00207">NL3D::ItEdgeMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06055.html#l00367">removeFaceFromEdgeList()</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>, and <a class="el" href="a06058.html#l00288">NL3D::CMRMFaceBuild::validEdgeIt()</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01256">makeFromMesh()</a>. +<p> +<div class="fragment"><pre>00946 { +00947 <a class="code" href="a05363.html#a153">ItEdgeMap</a> EdgeIt; +00948 +00949 <a class="code" href="a04558.html#a14">sint</a> nCurrentFaces=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.size(); +00950 <a class="code" href="a04558.html#a14">sint</a> bug0=0,bug2=0,bug3=0; +00951 +00952 <span class="keywordflow">while</span>(nCurrentFaces>nWantedFaces) +00953 { +00954 bug0++; +00955 EdgeIt= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.begin(); +00956 +00957 <span class="keywordflow">if</span>(EdgeIt== <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.end()) +00958 <span class="keywordflow">break</span>; +00959 +00960 <span class="comment">// 0. Look if edge already deleted</span> +00961 <span class="comment">//================================</span> +00962 CMRMEdge edge=(*EdgeIt).second; +00963 +00964 <span class="comment">// Is it valid?? (ie his vertices exist yet??).</span> +00965 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[ edge.v0 ].CollapsedTo>=0 +00966 || <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[ edge.v1 ].CollapsedTo>=0) +00967 { +00968 <span class="comment">// \todo yoyo: TODO_BUG: potential bug here...</span> +00969 CMRMFaceBuild &f= *(EdgeIt->second.Face); +00970 <a class="code" href="a04199.html#a6">nlassert</a>(f.validEdgeIt(EdgeIt->second)); +00971 f.invalidEdgeIt(EdgeIt->second, EdgeCollapses); +00972 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(EdgeIt); +00973 bug2++; +00974 <span class="keywordflow">continue</span>; +00975 } +00976 <span class="comment">// \todo yoyo: TODO_BUG: potential bug here...</span> +00977 <span class="comment">// If a mesh is "open" it will crash if a "hole collapse"...</span> +00978 <span class="keywordflow">if</span>(edge.v0==edge.v1) +00979 { +00980 CMRMFaceBuild &f= *(EdgeIt->second.Face); +00981 <a class="code" href="a04199.html#a6">nlassert</a>(f.validEdgeIt(EdgeIt->second)); +00982 f.invalidEdgeIt(EdgeIt->second, EdgeCollapses); +00983 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(EdgeIt); +00984 bug3++; +00985 <span class="keywordflow">continue</span>; +00986 } +00987 +00988 +00989 <span class="comment">// 1. else, OK, collapse it!!</span> +00990 <span class="comment">//===========================</span> +00991 <a class="code" href="a04558.html#a14">sint</a> vertexCollapsed= edge.v0; +00992 nCurrentFaces-= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_0">collapseEdge</a>(edge); +00993 +00994 +00995 <span class="comment">// 2. Must reorder all his neighborhood.</span> +00996 <span class="comment">//======================================</span> +00997 CMRMVertex &vert=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[vertexCollapsed]; +00998 <a class="code" href="a04558.html#a14">sint</a> i; +00999 <span class="comment">// we delete from list modified edges, and we re-add them with their new value.</span> +01000 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++) +01001 { +01002 CMRMFaceBuild &f= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]]; +01003 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_6">removeFaceFromEdgeList</a>(f); +01004 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_5">insertFaceIntoEdgeList</a>(f); +01005 } +01006 +01007 } +01008 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz557_1" doxytag="NL3D::CMRMBuilder::collapseSkinWeight" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02865.html">CMesh::CSkinWeight</a> NL3D::CMRMBuilder::collapseSkinWeight </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> & </td> + <td class="mdname" nowrap> <em>sw1</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> & </td> + <td class="mdname" nowrap> <em>sw2</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>InterValue</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00399">399</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00103">_SkinReduction</a>, <a class="el" href="a05990.html#l00116">NL3D::CMesh::CSkinWeight::MatrixId</a>, <a class="el" href="a06055.html#l00382">NL3D::CTmpVertexWeight::MatrixId</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00416">nlstop</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06055.html#l00383">NL3D::CTmpVertexWeight::Weight</a>, and <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>. +<p> +<div class="fragment"><pre>00400 { +00401 <span class="comment">// If fast interpolation.</span> +00402 <span class="keywordflow">if</span>(interValue==0) +00403 <span class="keywordflow">return</span> sw1; +00404 <span class="keywordflow">if</span>(interValue==1) +00405 <span class="keywordflow">return</span> sw2; +00406 +00407 <span class="comment">// else, must blend a skinWeight: must identify matrix which exist in the 2 sws, and add new ones.</span> +00408 <a class="code" href="a04558.html#a15">uint</a> nbMats1=0; +00409 <a class="code" href="a04558.html#a15">uint</a> nbMats2=0; +00410 <span class="keyword">static</span> vector<CTmpVertexWeight> sws; +00411 sws.reserve(NL3D_MESH_SKINNING_MAX_MATRIX * 2); +00412 sws.clear(); +00413 +00414 <span class="comment">// For all weights of sw1.</span> +00415 <a class="code" href="a04558.html#a15">uint</a> i; +00416 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; i++) +00417 { +00418 CTmpVertexWeight vw; +00419 vw.MatrixId= sw1.MatrixId[i]; +00420 vw.Weight= sw1.Weights[i]*(1-interValue); +00421 <span class="comment">// if this weight is not null.</span> +00422 <span class="keywordflow">if</span>(vw.Weight>0) +00423 { +00424 <span class="comment">// add it to the list.</span> +00425 sws.push_back(vw); +00426 } +00427 <span class="comment">// For skinning reduction.</span> +00428 <span class="keywordflow">if</span>(sw1.Weights[i]>0) +00429 nbMats1++; +00430 } +00431 +00432 +00433 <span class="comment">// For all weights of sw1.</span> +00434 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; i++) +00435 { +00436 CTmpVertexWeight vw; +00437 vw.MatrixId= sw2.MatrixId[i]; +00438 vw.Weight= sw2.Weights[i]*(interValue); +00439 <span class="comment">// if this weight is not null.</span> +00440 <span class="keywordflow">if</span>(vw.Weight>0) +00441 { +00442 <span class="comment">// add it or add influence to the matrix.</span> +00443 vector<CTmpVertexWeight>::iterator it= find(sws.begin(), sws.end(), vw); +00444 <span class="keywordflow">if</span>(it== sws.end()) +00445 sws.push_back(vw); +00446 <span class="keywordflow">else</span> +00447 it->Weight+= vw.Weight; +00448 } +00449 <span class="comment">// For skinning reduction.</span> +00450 <span class="keywordflow">if</span>(sw2.Weights[i]>0) +00451 nbMats2++; +00452 } +00453 +00454 +00455 <span class="comment">// Then keep just the best.</span> +00456 <span class="comment">// sort by Weight decreasing order.</span> +00457 sort(sws.begin(), sws.end()); +00458 +00459 <span class="comment">// clamp the result to the wanted max matrix.</span> +00460 <a class="code" href="a04558.html#a15">uint</a> nbMatsOut; +00461 <span class="keywordflow">switch</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">_SkinReduction</a>) +00462 { +00463 <span class="keywordflow">case</span> CMRMParameters::SkinReductionMin: +00464 nbMatsOut= <a class="code" href="a04061.html#a0">min</a>(nbMats1, nbMats2); +00465 <span class="keywordflow">break</span>; +00466 <span class="keywordflow">case</span> CMRMParameters::SkinReductionMax: +00467 nbMatsOut= max(nbMats1, nbMats2); +00468 <span class="keywordflow">break</span>; +00469 <span class="keywordflow">case</span> CMRMParameters::SkinReductionBest: +00470 nbMatsOut= <a class="code" href="a04061.html#a0">min</a>( (<a class="code" href="a04558.html#a15">uint</a>)sws.size(), (<a class="code" href="a04558.html#a15">uint</a>)<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a> ); +00471 <span class="keywordflow">break</span>; +00472 <span class="keywordflow">default</span>: +00473 <a class="code" href="a04199.html#a12">nlstop</a>; +00474 }; +00475 <span class="comment">// For security.</span> +00476 nbMatsOut= <a class="code" href="a04061.html#a0">min</a>(nbMatsOut, (<a class="code" href="a04558.html#a15">uint</a>)sws.size()); +00477 <a class="code" href="a04199.html#a6">nlassert</a>(nbMatsOut<=NL3D_MESH_SKINNING_MAX_MATRIX); +00478 +00479 +00480 <span class="comment">// Then output the result to the skinWeight, normalizing.</span> +00481 <span class="keywordtype">float</span> sumWeight=0; +00482 <span class="keywordflow">for</span>(i= 0; i<nbMatsOut; i++) +00483 { +00484 sumWeight+= sws[i].Weight; +00485 } +00486 +00487 CMesh::CSkinWeight ret; +00488 <span class="comment">// Fill only needed matrix (other are rested in CMesh::CSkinWeight ctor).</span> +00489 <span class="keywordflow">for</span>(i= 0; i<nbMatsOut; i++) +00490 { +00491 ret.MatrixId[i]= sws[i].MatrixId; +00492 ret.Weights[i]= sws[i].Weight / sumWeight; +00493 } +00494 +00495 <span class="keywordflow">return</span> ret; +00496 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuildera1" doxytag="NL3D::CMRMBuilder::compileMRM" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::compileMRM </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td> + <td class="mdname" nowrap> <em>mbuild</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > & </td> + <td class="mdname" nowrap> <em>bsList</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02967.html">CMRMParameters</a> & </td> + <td class="mdname" nowrap> <em>params</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02903.html">CMeshMRMSkinnedGeom::CMeshBuildMRM</a> & </td> + <td class="mdname" nowrap> <em>mrmMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>numMaxMaterial</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Compile a MRM skinned mesh info. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>mbuild</em> </td><td>the input mesh </td></tr> + <tr><td valign=top><em>params</em> </td><td>the parameters of MRM process. </td></tr> + <tr><td valign=top><em>mrmMesh</em> </td><td>the result MRM mesh.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06055.html#l03050">3050</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06056.html#l00103">_SkinReduction</a>, <a class="el" href="a06055.html#l01287">buildAllLods()</a>, <a class="el" href="a06055.html#l02912">buildBlendShapes()</a>, <a class="el" href="a06055.html#l01336">buildFinalMRM()</a>, <a class="el" href="a06055.html#l01918">buildMeshBuildMrm()</a>, <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>, <a class="el" href="a06055.html#l03115">buildMRMSewingMeshes()</a>, <a class="el" href="a06012.html#l00412">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::DistanceCoarsest</a>, <a class="el" href="a06012.html#l00408">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::DistanceFinest</a>, <a class="el" href="a06012.html#l00410">NL3D::CMeshMRMSkinnedGeom::CMeshBuildMRM::DistanceMiddle</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06055.html#l01905">normalizeBaseMeshSkin()</a>, <a class="el" href="a05646.html#l00223">params</a>, <a class="el" href="a05990.html#l00187">NL3D::CMesh::CMeshBuild::SkinWeights</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00179">NL3D::CMesh::CMeshBuild::VertexFlags</a>, and <a class="el" href="a05990.html#l00184">NL3D::CMesh::CMeshBuild::Vertices</a>. +<p> +<div class="fragment"><pre>03053 { +03054 <span class="comment">// Temp data.</span> +03055 CMRMMesh baseMesh; +03056 vector<CMRMMeshGeom> lodMeshs; +03057 CMRMMeshFinal finalMRM; +03058 vector<CMRMMeshFinal> finalBsMRM; +03059 <a class="code" href="a04558.html#a11">uint32</a> vbFlags; +03060 +03061 +03062 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceFinest>=0); +03063 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceMiddle > <a class="code" href="a04223.html#a565">params</a>.DistanceFinest); +03064 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceCoarsest > <a class="code" href="a04223.html#a565">params</a>.DistanceMiddle); +03065 +03066 +03067 <span class="comment">// Copy some parameters.</span> +03068 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">_SkinReduction</a>= <a class="code" href="a04223.html#a565">params</a>.SkinReduction; +03069 +03070 <span class="comment">// Skinning??</span> +03071 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= ((mbuild.VertexFlags & CVertexBuffer::PaletteSkinFlag)==CVertexBuffer::PaletteSkinFlag); +03072 <span class="comment">// Skinning is OK only if SkinWeights are of same size as vertices.</span> +03073 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a> && ( mbuild.Vertices.size()==mbuild.SkinWeights.size() ); +03074 +03075 <span class="comment">// MeshInterface setuped ?</span> +03076 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_0">buildMRMSewingMeshes</a>(mbuild, <a class="code" href="a04223.html#a565">params</a>.NLods, <a class="code" href="a04223.html#a565">params</a>.Divisor); +03077 +03078 <span class="comment">// from mbuild, build an internal MRM mesh representation.</span> +03079 <span class="comment">// vbFlags returned is the VBuffer format supported by CMRMBuilder.</span> +03080 <span class="comment">// NB: skinning is removed because skinning is made in software in CMeshMRMGeom.</span> +03081 vbFlags= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh</a>(mbuild, baseMesh); +03082 +03083 <span class="comment">// Construct all blend shapes in the same way we have constructed the basemesh mrm</span> +03084 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_1">buildBlendShapes</a> (baseMesh, bsList, vbFlags); +03085 +03086 <span class="comment">// If skinned, must ensure that skin weights have weights in ascending order.</span> +03087 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +03088 { +03089 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_10">normalizeBaseMeshSkin</a>(baseMesh); +03090 } +03091 +03092 <span class="comment">// from this baseMesh, builds all LODs of the MRM, with geomorph info. NB: vertices/wedges are duplicated.</span> +03093 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_0">buildAllLods</a> ( baseMesh, lodMeshs, <a class="code" href="a04223.html#a565">params</a>.NLods, <a class="code" href="a04223.html#a565">params</a>.Divisor ); +03094 +03095 <span class="comment">// From this array of LOD, build a finalMRM, by regrouping identical vertices/wedges, and compute index geomorphs.</span> +03096 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_2">buildFinalMRM</a>(lodMeshs, finalMRM); +03097 +03098 <span class="comment">// From this finalMRM, build output: a CMeshBuildMRM.</span> +03099 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_4">buildMeshBuildMrm</a>(finalMRM, mrmMesh, vbFlags, numMaxMaterial, mbuild); +03100 +03101 <span class="comment">// Copy degradation control params.</span> +03102 mrmMesh.DistanceFinest= <a class="code" href="a04223.html#a565">params</a>.DistanceFinest; +03103 mrmMesh.DistanceMiddle= <a class="code" href="a04223.html#a565">params</a>.DistanceMiddle; +03104 mrmMesh.DistanceCoarsest= <a class="code" href="a04223.html#a565">params</a>.DistanceCoarsest; +03105 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuildera2" doxytag="NL3D::CMRMBuilder::compileMRM" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::compileMRM </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02864.html">CMesh::CMeshBuild</a> & </td> + <td class="mdname" nowrap> <em>mbuild</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a02864.html">CMesh::CMeshBuild</a> * > & </td> + <td class="mdname" nowrap> <em>bsList</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02967.html">CMRMParameters</a> & </td> + <td class="mdname" nowrap> <em>params</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02895.html">CMeshMRMGeom::CMeshBuildMRM</a> & </td> + <td class="mdname" nowrap> <em>mrmMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>numMaxMaterial</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Compile a MRM mesh info. <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>mbuild</em> </td><td>the input mesh </td></tr> + <tr><td valign=top><em>params</em> </td><td>the parameters of MRM process. </td></tr> + <tr><td valign=top><em>mrmMesh</em> </td><td>the result MRM mesh.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06055.html#l02991">2991</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06056.html#l00103">_SkinReduction</a>, <a class="el" href="a06055.html#l01287">buildAllLods()</a>, <a class="el" href="a06055.html#l02912">buildBlendShapes()</a>, <a class="el" href="a06055.html#l01336">buildFinalMRM()</a>, <a class="el" href="a06055.html#l01918">buildMeshBuildMrm()</a>, <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>, <a class="el" href="a06055.html#l03115">buildMRMSewingMeshes()</a>, <a class="el" href="a06006.html#l00445">NL3D::CMeshMRMGeom::CMeshBuildMRM::DistanceCoarsest</a>, <a class="el" href="a06006.html#l00441">NL3D::CMeshMRMGeom::CMeshBuildMRM::DistanceFinest</a>, <a class="el" href="a06006.html#l00443">NL3D::CMeshMRMGeom::CMeshBuildMRM::DistanceMiddle</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06055.html#l01905">normalizeBaseMeshSkin()</a>, <a class="el" href="a05646.html#l00223">params</a>, <a class="el" href="a05990.html#l00187">NL3D::CMesh::CMeshBuild::SkinWeights</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05990.html#l00179">NL3D::CMesh::CMeshBuild::VertexFlags</a>, and <a class="el" href="a05990.html#l00184">NL3D::CMesh::CMeshBuild::Vertices</a>. +<p> +Referenced by <a class="el" href="a06011.html#l00206">NL3D::CMeshMRMSkinnedGeom::build()</a>, and <a class="el" href="a06005.html#l00246">NL3D::CMeshMRMGeom::build()</a>. +<p> +<div class="fragment"><pre>02994 { +02995 <span class="comment">// Temp data.</span> +02996 CMRMMesh baseMesh; +02997 vector<CMRMMeshGeom> lodMeshs; +02998 CMRMMeshFinal finalMRM; +02999 vector<CMRMMeshFinal> finalBsMRM; +03000 <a class="code" href="a04558.html#a11">uint32</a> vbFlags; +03001 +03002 +03003 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceFinest>=0); +03004 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceMiddle > <a class="code" href="a04223.html#a565">params</a>.DistanceFinest); +03005 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a565">params</a>.DistanceCoarsest > <a class="code" href="a04223.html#a565">params</a>.DistanceMiddle); +03006 +03007 +03008 <span class="comment">// Copy some parameters.</span> +03009 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">_SkinReduction</a>= <a class="code" href="a04223.html#a565">params</a>.SkinReduction; +03010 +03011 <span class="comment">// Skinning??</span> +03012 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= ((mbuild.VertexFlags & CVertexBuffer::PaletteSkinFlag)==CVertexBuffer::PaletteSkinFlag); +03013 <span class="comment">// Skinning is OK only if SkinWeights are of same size as vertices.</span> +03014 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a> && ( mbuild.Vertices.size()==mbuild.SkinWeights.size() ); +03015 +03016 <span class="comment">// MeshInterface setuped ?</span> +03017 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_0">buildMRMSewingMeshes</a>(mbuild, <a class="code" href="a04223.html#a565">params</a>.NLods, <a class="code" href="a04223.html#a565">params</a>.Divisor); +03018 +03019 <span class="comment">// from mbuild, build an internal MRM mesh representation.</span> +03020 <span class="comment">// vbFlags returned is the VBuffer format supported by CMRMBuilder.</span> +03021 <span class="comment">// NB: skinning is removed because skinning is made in software in CMeshMRMGeom.</span> +03022 vbFlags= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_5">buildMrmBaseMesh</a>(mbuild, baseMesh); +03023 +03024 <span class="comment">// Construct all blend shapes in the same way we have constructed the basemesh mrm</span> +03025 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_1">buildBlendShapes</a> (baseMesh, bsList, vbFlags); +03026 +03027 <span class="comment">// If skinned, must ensure that skin weights have weights in ascending order.</span> +03028 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +03029 { +03030 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_10">normalizeBaseMeshSkin</a>(baseMesh); +03031 } +03032 +03033 <span class="comment">// from this baseMesh, builds all LODs of the MRM, with geomorph info. NB: vertices/wedges are duplicated.</span> +03034 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_0">buildAllLods</a> ( baseMesh, lodMeshs, <a class="code" href="a04223.html#a565">params</a>.NLods, <a class="code" href="a04223.html#a565">params</a>.Divisor ); +03035 +03036 <span class="comment">// From this array of LOD, build a finalMRM, by regrouping identical vertices/wedges, and compute index geomorphs.</span> +03037 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz565_2">buildFinalMRM</a>(lodMeshs, finalMRM); +03038 +03039 <span class="comment">// From this finalMRM, build output: a CMeshBuildMRM.</span> +03040 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_4">buildMeshBuildMrm</a>(finalMRM, mrmMesh, vbFlags, numMaxMaterial, mbuild); +03041 +03042 <span class="comment">// Copy degradation control params.</span> +03043 mrmMesh.DistanceFinest= <a class="code" href="a04223.html#a565">params</a>.DistanceFinest; +03044 mrmMesh.DistanceMiddle= <a class="code" href="a04223.html#a565">params</a>.DistanceMiddle; +03045 mrmMesh.DistanceCoarsest= <a class="code" href="a04223.html#a565">params</a>.DistanceCoarsest; +03046 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderd0" doxytag="NL3D::CMRMBuilder::computeBsVerticesAttributes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::computeBsVerticesAttributes </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::vector< <a class="el" href="a02960.html">CMRMMesh</a> > & </td> + <td class="mdname" nowrap> <em>srcBsMeshs</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a02960.html">CMRMMesh</a> > & </td> + <td class="mdname" nowrap> <em>srcBsMeshsMod</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz555_0" doxytag="NL3D::CMRMBuilder::computeEdgeCost" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float NL3D::CMRMBuilder::computeEdgeCost </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02955.html">CMRMEdge</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>edge</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00244">244</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00154">_CurrentLodComputed</a>, <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06056.html#l00152">_SewingMeshes</a>, <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06055.html#l00214">edgeNearUniqueMatFace()</a>, <a class="el" href="a06055.html#l00143">getDeltaFaceNormals()</a>, <a class="el" href="a06057.html#l00059">NL3D::CMRMSewingMesh::getNumCollapseEdge()</a>, <a class="el" href="a06057.html#l00041">NL3D::CMRMSewingMesh::mustCollapseEdge()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>, and <a class="el" href="a06055.html#l00103">vertexContinue()</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00347">insertFaceIntoEdgeList()</a>. +<p> +<div class="fragment"><pre>00245 { +00246 <a class="code" href="a04558.html#a14">sint</a> v1= edge.v0; +00247 <a class="code" href="a04558.html#a14">sint</a> v2= edge.v1; +00248 <span class="comment">// more expensive is the edge, later it will collapse.</span> +00249 +00250 +00251 <span class="comment">// **** standard cost</span> +00252 +00253 <span class="comment">// compute size of the edge.</span> +00254 <span class="keywordtype">float</span> cost=(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[v1].Current-TmpVertices[v2].Current).norm(); +00255 +00256 <span class="comment">// compute "curvature" of the edge.</span> +00257 <span class="keywordtype">float</span> faceCost= (<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_3">getDeltaFaceNormals</a>(v1)+<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_3">getDeltaFaceNormals</a>(v2)); +00258 <span class="comment">// totally plane faces (faceCost==0) must be collapsed with respect to size (and not random if cost==0).</span> +00259 <span class="comment">// else we may have Plane Mesh (like flags) that will collapse in a very ugly way.</span> +00260 faceCost= max(faceCost, 0.01f); +00261 +00262 <span class="comment">// modulate size with curvature.</span> +00263 cost*= faceCost; +00264 +00265 <span class="comment">// Like H.Hope, add a weight on discontinuities..</span> +00266 <span class="keywordflow">if</span>( !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a>(v1) && !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_5">vertexContinue</a>(v2) ) +00267 { +00268 <span class="comment">// Nb: don't do this on discontinuities edges, unless the unique material face will collapse (pffiou!!).</span> +00269 <span class="keywordflow">if</span>( <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a>(edge) || <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_2">edgeNearUniqueMatFace</a>(edge) ) +00270 cost*=4; +00271 } +00272 +00273 <span class="comment">// **** Interface Sewing cost</span> +00274 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>) +00275 { +00276 <span class="comment">// if the 2 vertices comes from a Sewing Interface mesh (must be a real interface id)</span> +00277 <a class="code" href="a04558.html#a14">sint</a> meshSewingId= TmpVertices[v1].InterfaceLink.InterfaceId; +00278 <span class="keywordflow">if</span>( meshSewingId>=0 && TmpVertices[v2].InterfaceLink.InterfaceId>=0 ) +00279 { +00280 <span class="comment">// if the 2 vertices comes from the same Sewing Interface mesh</span> +00281 <span class="keywordflow">if</span>( meshSewingId == TmpVertices[v2].InterfaceLink.InterfaceId ) +00282 { +00283 <span class="comment">// Then the edge is one of the sewing interface mesh. must do special things for it</span> +00284 CMRMSewingMesh &sewingMesh= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">_SewingMeshes</a>[meshSewingId]; +00285 <a class="code" href="a04558.html#a15">uint</a> dummy; +00286 +00287 <span class="comment">// get the sewing edge id</span> +00288 CMRMEdge sewingEdge; +00289 sewingEdge.v0= TmpVertices[v1].InterfaceLink.InterfaceVertexId; +00290 sewingEdge.v1= TmpVertices[v2].InterfaceLink.InterfaceVertexId; +00291 <span class="comment">// if the current sewing lod want to collapse this edge</span> +00292 <a class="code" href="a04558.html#a14">sint</a> collapseId= sewingMesh.mustCollapseEdge(_CurrentLodComputed, sewingEdge, dummy); +00293 <span class="keywordflow">if</span>(collapseId>=0) +00294 { +00295 <span class="comment">// Then set a negative priority (ie will collapse as soon as possible). from -N to -1.</span> +00296 <span class="comment">// NB: sort them according to collapseId</span> +00297 cost= (<span class="keywordtype">float</span>)(-sewingMesh.getNumCollapseEdge(_CurrentLodComputed) + collapseId); +00298 } +00299 <span class="keywordflow">else</span> +00300 { +00301 <span class="comment">// This edge must not collapse at this Lod, set an infinite priority (hope will never collapse).</span> +00302 cost= FLT_MAX; +00303 } +00304 } +00305 <span class="keywordflow">else</span> +00306 { +00307 <span class="comment">/* The edge is between 2 interfaces but not the same. If we collide it we'll have holes!</span> +00308 <span class="comment"> This problem arise if space beetween interfaces is small. eg: if we setup an interface beetween </span> +00309 <span class="comment"> hair and head, and an other one beetween head and torso, then we'll have this problem in the</span> +00310 <span class="comment"> back of the neck.</span> +00311 <span class="comment"> The solution is to make a big big cost to hope we'll never collide them (else Holes...)!!</span> +00312 <span class="comment"> Don't use FLT_MAX to still have a correct order if we don't have choice...</span> +00313 <span class="comment"> */</span> +00314 cost*= 10000; +00315 } +00316 } +00317 } +00318 +00319 <span class="keywordflow">return</span> cost; +00320 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz555_1" doxytag="NL3D::CMRMBuilder::edgeContinue" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::edgeContinue </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02955.html">CMRMEdge</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>edge</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00169">169</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>, and <a class="el" href="a05646.html#l00236">w</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>, and <a class="el" href="a06055.html#l00214">edgeNearUniqueMatFace()</a>. +<p> +<div class="fragment"><pre>00170 { +00171 <a class="code" href="a04558.html#a14">sint</a> v0= edge.v0; +00172 <a class="code" href="a04558.html#a14">sint</a> v1= edge.v1; +00173 CMRMVertex &Vertex1=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[v0]; +00174 +00175 <span class="comment">// build list sharing edge.</span> +00176 vector<sint> deletedFaces; +00177 <a class="code" href="a04558.html#a14">sint</a> i; +00178 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++) +00179 { +00180 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i]; +00181 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].hasVertex(v1)) +00182 deletedFaces.push_back(numFace); +00183 } +00184 +00185 <a class="code" href="a04558.html#a14">sint</a> matId=-1; +00186 <span class="comment">// test if faces have same material.</span> +00187 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++) +00188 { +00189 <a class="code" href="a04558.html#a14">sint</a> m; +00190 m= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[i]].MaterialId; +00191 <span class="keywordflow">if</span>(matId>=0 && matId!=m) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00192 <span class="keywordflow">else</span> matId=m; +00193 } +00194 +00195 <span class="comment">// test if faces have same wedge (for all att).</span> +00196 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++) +00197 { +00198 <a class="code" href="a04558.html#a14">sint</a> numwedge1=-1,numwedge2=-1; +00199 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++) +00200 { +00201 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a575">w</a>; +00202 <a class="code" href="a04223.html#a575">w</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[i]].getAssociatedWedge(attId, v0); +00203 <span class="keywordflow">if</span>(numwedge1>=0 && numwedge1!=<a class="code" href="a04223.html#a575">w</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00204 <span class="keywordflow">else</span> numwedge1=<a class="code" href="a04223.html#a575">w</a>; +00205 <a class="code" href="a04223.html#a575">w</a>= TmpFaces[deletedFaces[i]].getAssociatedWedge(attId, v1); +00206 <span class="keywordflow">if</span>(numwedge2>=0 && numwedge2!=<a class="code" href="a04223.html#a575">w</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00207 <span class="keywordflow">else</span> numwedge2=<a class="code" href="a04223.html#a575">w</a>; +00208 } +00209 } +00210 +00211 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00212 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz555_2" doxytag="NL3D::CMRMBuilder::edgeNearUniqueMatFace" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::edgeNearUniqueMatFace </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02955.html">CMRMEdge</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>edge</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00214">214</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06058.html#l00263">NL3D::CMRMFaceBuild::getEdge()</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v0</a>, and <a class="el" href="a06058.html#l00151">NL3D::CMRMEdge::v1</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>. +<p> +<div class="fragment"><pre>00215 { +00216 <a class="code" href="a04558.html#a14">sint</a> v0= edge.v0; +00217 <a class="code" href="a04558.html#a14">sint</a> v1= edge.v1; +00218 CMRMVertex &Vertex1=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[v0]; +00219 +00220 <span class="comment">// build list sharing edge.</span> +00221 vector<sint> deletedFaces; +00222 <a class="code" href="a04558.html#a14">sint</a> i; +00223 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)Vertex1.SharedFaces.size();i++) +00224 { +00225 <a class="code" href="a04558.html#a14">sint</a> numFace= Vertex1.SharedFaces[i]; +00226 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[numFace].hasVertex(v1)) +00227 deletedFaces.push_back(numFace); +00228 } +00229 +00230 <span class="comment">// test if faces are not isolated OneMaterial faces.</span> +00231 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)deletedFaces.size();i++) +00232 { +00233 CMRMFaceBuild &f=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[deletedFaces[i]]; +00234 <span class="keywordflow">if</span>( !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a>(f.getEdge(0)) && +00235 !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a>(f.getEdge(1)) && +00236 !<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_1">edgeContinue</a>(f.getEdge(2))) +00237 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00238 } +00239 +00240 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00241 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz557_2" doxytag="NL3D::CMRMBuilder::faceShareWedges" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::faceShareWedges </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02958.html">CMRMFaceBuild</a> * </td> + <td class="mdname" nowrap> <em>face</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>attribId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>numVertex1</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>numVertex2</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00333">333</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06058.html#l00313">NL3D::CMRMFaceBuild::getAssociatedWedge()</a>, <a class="el" href="a06058.html#l00132">NL3D::CMRMAttribute::NbSharedFaces</a>, <a class="el" href="a06058.html#l00133">NL3D::CMRMAttribute::Shared</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06056.html#l00092">TmpAttributes</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>. +<p> +<div class="fragment"><pre>00334 { +00335 <a class="code" href="a04558.html#a14">sint</a> numWedge1= face->getAssociatedWedge(attribId, numVertex1); +00336 <a class="code" href="a04558.html#a14">sint</a> numWedge2= face->getAssociatedWedge(attribId, numVertex2); +00337 <span class="keywordflow">if</span>(numWedge1<0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00338 <span class="keywordflow">if</span>(numWedge2<0) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00339 +00340 CMRMAttribute &w1= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attribId][numWedge1]; +00341 CMRMAttribute &w2= TmpAttributes[attribId][numWedge2]; +00342 <span class="keywordflow">return</span> w1.Shared && w2.Shared && w1.NbSharedFaces>0 && w2.NbSharedFaces>0; +00343 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_6" doxytag="NL3D::CMRMBuilder::findInsertAttributeInBaseMesh" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::findInsertAttributeInBaseMesh </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname" nowrap> <em>baseMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>attId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>vertexId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03668.html">CVectorH</a> & </td> + <td class="mdname" nowrap> <em>att</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01648">1648</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00229">_AttributeMap</a>, <a class="el" href="a06056.html#l00219">NL3D::CMRMBuilder::CAttributeKey::Attribute</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06056.html#l00218">NL3D::CMRMBuilder::CAttributeKey::VertexId</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01685">findInsertColorInBaseMesh()</a>, <a class="el" href="a06055.html#l01675">findInsertNormalInBaseMesh()</a>, and <a class="el" href="a06055.html#l01697">findInsertUvwInBaseMesh()</a>. +<p> +<div class="fragment"><pre>01649 { +01650 <span class="comment">// find this attribute in the map.</span> +01651 CAttributeKey key; +01652 key.VertexId= vertexId; +01653 key.Attribute= att; +01654 TAttributeMap::iterator it= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">_AttributeMap</a>[attId].find(key); +01655 +01656 <span class="comment">// if attribute not found in the map, then insert a new one.</span> +01657 <span class="keywordflow">if</span>(it==_AttributeMap[attId].end()) +01658 { +01659 <a class="code" href="a04558.html#a14">sint</a> idx= baseMesh.Attributes[attId].size(); +01660 <span class="comment">// insert into the array.</span> +01661 baseMesh.Attributes[attId].push_back(att); +01662 <span class="comment">// insert into the map.</span> +01663 _AttributeMap[attId].insert(make_pair(key, idx)); +01664 <span class="keywordflow">return</span> idx; +01665 } +01666 <span class="keywordflow">else</span> +01667 { +01668 <span class="comment">// return the one found.</span> +01669 <span class="keywordflow">return</span> it->second; +01670 } +01671 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_7" doxytag="NL3D::CMRMBuilder::findInsertColorInBaseMesh" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::findInsertColorInBaseMesh </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname" nowrap> <em>baseMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>attId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>vertexId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03337.html">CRGBA</a> </td> + <td class="mdname" nowrap> <em>col</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01685">1685</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06340.html#l00340">NLMISC::CRGBA::A</a>, <a class="el" href="a06340.html#l00338">NLMISC::CRGBA::B</a>, <a class="el" href="a06055.html#l01648">findInsertAttributeInBaseMesh()</a>, <a class="el" href="a06340.html#l00336">NLMISC::CRGBA::G</a>, <a class="el" href="a06340.html#l00334">NLMISC::CRGBA::R</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>. +<p> +<div class="fragment"><pre>01686 { +01687 <a class="code" href="a03668.html">CVectorH</a> att; +01688 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>= col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo3">R</a>; +01689 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>= col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo2">G</a>; +01690 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>= col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo1">B</a>; +01691 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>= col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAo0">A</a>; +01692 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_6">findInsertAttributeInBaseMesh</a>(baseMesh, attId, vertexId, att); +01693 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_8" doxytag="NL3D::CMRMBuilder::findInsertNormalInBaseMesh" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::findInsertNormalInBaseMesh </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname" nowrap> <em>baseMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>attId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>vertexId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>normal</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01675">1675</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06055.html#l01648">findInsertAttributeInBaseMesh()</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>. +<p> +<div class="fragment"><pre>01676 { +01677 <a class="code" href="a03668.html">CVectorH</a> att; +01678 att= normal; +01679 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>= 0; +01680 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_6">findInsertAttributeInBaseMesh</a>(baseMesh, attId, vertexId, att); +01681 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_9" doxytag="NL3D::CMRMBuilder::findInsertUvwInBaseMesh" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::findInsertUvwInBaseMesh </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname" nowrap> <em>baseMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>attId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>vertexId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03641.html">NLMISC::CUVW</a> & </td> + <td class="mdname" nowrap> <em>uvw</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01697">1697</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06055.html#l01648">findInsertAttributeInBaseMesh()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::U</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::V</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::w</a>, <a class="el" href="a06655.html#l00109">NLMISC::CUVW::W</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::x</a>, <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::y</a>, and <a class="el" href="a06681.html#l00048">NLMISC::CVectorH::z</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>. +<p> +<div class="fragment"><pre>01698 { +01699 <a class="code" href="a03668.html">CVectorH</a> att; +01700 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo1">x</a>= uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo0">U</a>; +01701 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo2">y</a>= uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo1">V</a>; +01702 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo3">z</a>= uvw.<a class="code" href="a03641.html#NLMISC_1_1CUVWo2">W</a>; +01703 att.<a class="code" href="a03668.html#NLMISC_1_1CVectorHo0">w</a>= 0; +01704 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_6">findInsertAttributeInBaseMesh</a>(baseMesh, attId, vertexId, att); +01705 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz557_3" doxytag="NL3D::CMRMBuilder::followVertex" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::followVertex </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>i</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00832">832</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06058.html#l00101">NL3D::CMRMVertex::CollapsedTo</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06056.html#l00090">TmpVertices</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01108">makeLODMesh()</a>. +<p> +<div class="fragment"><pre>00833 { +00834 CMRMVertex &vert=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i]; +00835 <span class="keywordflow">if</span>(vert.CollapsedTo>=0) +00836 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_3">followVertex</a>(vert.CollapsedTo); +00837 <span class="keywordflow">else</span> +00838 <span class="keywordflow">return</span> i; +00839 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz557_4" doxytag="NL3D::CMRMBuilder::followWedge" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> NL3D::CMRMBuilder::followWedge </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>attribId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>i</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00841">841</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06058.html#l00125">NL3D::CMRMAttribute::CollapsedTo</a>, <a class="el" href="a05981.html#l00104">sint</a>, and <a class="el" href="a06056.html#l00092">TmpAttributes</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01108">makeLODMesh()</a>. +<p> +<div class="fragment"><pre>00842 { +00843 CMRMAttribute &wedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attribId][i]; +00844 <span class="keywordflow">if</span>(wedge.CollapsedTo>=0) +00845 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_4">followWedge</a>(attribId, wedge.CollapsedTo); +00846 <span class="keywordflow">else</span> +00847 <span class="keywordflow">return</span> i; +00848 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz555_3" doxytag="NL3D::CMRMBuilder::getDeltaFaceNormals" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float NL3D::CMRMBuilder::getDeltaFaceNormals </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00143">143</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06058.html#l00096">NL3D::CMRMVertex::Current</a>, <a class="el" href="a06682.html#l00119">NLMISC::CVector::normalize()</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, and <a class="el" href="a06056.html#l00090">TmpVertices</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>. +<p> +<div class="fragment"><pre>00144 { +00145 <span class="comment">// return a positive value of Somme(|DeltaNormals|) / NNormals.</span> +00146 CMRMVertex &vert= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[numvertex]; +00147 <span class="keywordtype">float</span> delta=0; +00148 CVector refNormal; +00149 <a class="code" href="a04558.html#a14">sint</a> nfaces=vert.SharedFaces.size(); +00150 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<nfaces;i++) +00151 { +00152 CVector normal; +00153 CVector &v0= TmpVertices[<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i].Corner[0].Vertex].Current; +00154 CVector &v1= TmpVertices[TmpFaces[i].Corner[1].Vertex].Current; +00155 CVector &v2= TmpVertices[TmpFaces[i].Corner[2].Vertex].Current; +00156 normal= (v1-v0)^(v2-v0); +00157 normal.normalize(); +00158 <span class="keywordflow">if</span>(i==0) +00159 refNormal=normal; +00160 <span class="keywordflow">else</span> +00161 delta+=(1-refNormal*normal); +00162 } +00163 <span class="keywordflow">if</span>(nfaces<2) +00164 <span class="keywordflow">return</span> 0; +00165 <span class="keywordflow">else</span> +00166 <span class="keywordflow">return</span> delta/(nfaces-1); +00167 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz559_1" doxytag="NL3D::CMRMBuilder::init" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::init </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>baseMesh</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00867">867</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a06062.html#l00133">NL3D::CMRMMesh::BlendShapes</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a06055.html#l00347">insertFaceIntoEdgeList()</a>, <a class="el" href="a06062.html#l00123">NL3D::CMRMMesh::InterfaceLinks</a>, <a class="el" href="a06062.html#l00046">NL3D_MRM_MAX_ATTRIB</a>, <a class="el" href="a06062.html#l00127">NL3D::CMRMMesh::NumAttributes</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, and <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01287">buildAllLods()</a>, and <a class="el" href="a06055.html#l01256">makeFromMesh()</a>. +<p> +<div class="fragment"><pre>00868 { +00869 <a class="code" href="a04558.html#a14">sint</a> i, attId; +00870 +00871 +00872 <span class="comment">// First clear ALL.</span> +00873 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>.clear(); +00874 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a04639.html#a0">NL3D_MRM_MAX_ATTRIB</a>;attId++) +00875 { +00876 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId].clear(); +00877 } +00878 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.clear(); +00879 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.clear(); +00880 +00881 +00882 <span class="comment">// resize.</span> +00883 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>= baseMesh.NumAttributes; +00884 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>.resize(baseMesh.Vertices.size()); +00885 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++) +00886 { +00887 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId].resize(baseMesh.Attributes[attId].size()); +00888 } +00889 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.resize(baseMesh.Faces.size()); +00890 +00891 +00892 <span class="comment">// Then copy.</span> +00893 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)baseMesh.Vertices.size();i++) +00894 { +00895 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].Current= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].Original= baseMesh.Vertices[i]; +00896 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].BSCurrent.resize(baseMesh.BlendShapes.size()); +00897 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a11">uint32</a> j = 0; j <baseMesh.BlendShapes.size() ;++j) +00898 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].BSCurrent[j]= baseMesh.BlendShapes[j].Vertices[i]; +00899 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +00900 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].CurrentSW= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].OriginalSW= baseMesh.SkinWeights[i]; +00901 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>) +00902 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].InterfaceLink= baseMesh.InterfaceLinks[i]; +00903 } +00904 <span class="keywordflow">for</span>(attId=0;attId<NumAttributes;attId++) +00905 { +00906 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)baseMesh.Attributes[attId].size();i++) +00907 { +00908 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i].Current= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i].Original= +00909 baseMesh.Attributes[attId][i]; +00910 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i].BSCurrent.resize(baseMesh.BlendShapes.size()); +00911 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a11">uint32</a> j = 0; j <baseMesh.BlendShapes.size() ;++j) +00912 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i].BSCurrent[j]= baseMesh.BlendShapes[j].Attributes[attId][i]; +00913 } +00914 } +00915 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)baseMesh.Faces.size();i++) +00916 { +00917 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i]= baseMesh.Faces[i]; +00918 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i].BSInterpolated.resize(baseMesh.BlendShapes.size()); +00919 } +00920 +00921 +00922 <span class="comment">// Create vertices sharedFaces.</span> +00923 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.size();i++) +00924 { +00925 CMRMFaceBuild &face= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i]; +00926 +00927 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[face.Corner[0].Vertex].SharedFaces.push_back(i); +00928 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[face.Corner[1].Vertex].SharedFaces.push_back(i); +00929 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[face.Corner[2].Vertex].SharedFaces.push_back(i); +00930 } +00931 +00932 +00933 <span class="comment">// Compute EdgeCost.</span> +00934 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.size();i++) +00935 { +00936 CMRMFaceBuild &f= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i]; +00937 <span class="comment">// At start, valid all edges.</span> +00938 f. ValidIt0= <span class="keyword">true</span>; +00939 f. ValidIt1= <span class="keyword">true</span>; +00940 f. ValidIt2= <span class="keyword">true</span>; +00941 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_5">insertFaceIntoEdgeList</a>(f); +00942 } +00943 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz557_5" doxytag="NL3D::CMRMBuilder::insertFaceIntoEdgeList" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::insertFaceIntoEdgeList </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02958.html">CMRMFaceBuild</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>tmpf</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00347">347</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>, <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06058.html#l00263">NL3D::CMRMFaceBuild::getEdge()</a>, <a class="el" href="a05646.html#l00235">len</a>, <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt0</a>, <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt1</a>, and <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt2</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00945">collapseEdges()</a>, and <a class="el" href="a06055.html#l00867">init()</a>. +<p> +<div class="fragment"><pre>00348 { +00349 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a571">len</a>; +00350 <span class="keywordflow">if</span>(f.ValidIt0) +00351 { +00352 <a class="code" href="a04223.html#a571">len</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_0">computeEdgeCost</a>(f.getEdge(0)); +00353 f. It0= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.insert( TEdgeMap::value_type( len, CMRMEdgeFace(f.getEdge(0),&f) ) ); +00354 } +00355 <span class="keywordflow">if</span>(f.ValidIt1) +00356 { +00357 <a class="code" href="a04223.html#a571">len</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_0">computeEdgeCost</a>(f.getEdge(1)); +00358 f. It1= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.insert( TEdgeMap::value_type( len, CMRMEdgeFace(f.getEdge(1),&f) ) ); +00359 } +00360 <span class="keywordflow">if</span>(f.ValidIt2) +00361 { +00362 <a class="code" href="a04223.html#a571">len</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_0">computeEdgeCost</a>(f.getEdge(2)); +00363 f. It2= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.insert( TEdgeMap::value_type( len, CMRMEdgeFace(f.getEdge(2),&f) ) ); +00364 } +00365 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderd1" doxytag="NL3D::CMRMBuilder::makeCoarserBS" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::makeCoarserBS </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::vector< <a class="el" href="a02950.html">CMRMBlendShape</a> > & </td> + <td class="mdname1" valign="top" nowrap> <em>csBsMeshs</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01203">1203</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06062.html#l00101">NL3D::CMRMBlendShape::Attributes</a>, <a class="el" href="a06058.html#l00124">NL3D::CMRMAttribute::BSCurrent</a>, <a class="el" href="a06058.html#l00097">NL3D::CMRMVertex::BSCurrent</a>, <a class="el" href="a06058.html#l00127">NL3D::CMRMAttribute::CoarserIndex</a>, <a class="el" href="a06058.html#l00103">NL3D::CMRMVertex::CoarserIndex</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06062.html#l00103">NL3D::CMRMBlendShape::NumAttributes</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a06062.html#l00099">NL3D::CMRMBlendShape::Vertices</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01256">makeFromMesh()</a>. +<p> +<div class="fragment"><pre>01204 { +01205 <a class="code" href="a04558.html#a11">uint32</a> i, k; +01206 <a class="code" href="a04558.html#a10">sint32</a> nSizeVert, nSizeAttr, attId; +01207 +01208 <span class="comment">// Calculate size of vertices array</span> +01209 nSizeVert = 0; +01210 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>.size(); ++i) +01211 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].CoarserIndex > nSizeVert) +01212 nSizeVert = <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i].CoarserIndex; +01213 ++nSizeVert; +01214 +01215 <span class="keywordflow">for</span> (k = 0; k < csBsMeshs.size(); ++k) +01216 { +01217 CMRMBlendShape &rBsCoarserMesh = csBsMeshs[k]; +01218 +01219 rBsCoarserMesh.Vertices.resize (nSizeVert); +01220 rBsCoarserMesh.NumAttributes = <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>; +01221 +01222 <span class="comment">// Vertices</span> +01223 <span class="keywordflow">for</span>(i = 0; i < TmpVertices.size(); ++i) +01224 { +01225 CMRMVertex &vert = TmpVertices[i]; +01226 <span class="keywordflow">if</span> (vert.CoarserIndex != -1) +01227 { +01228 rBsCoarserMesh.Vertices[vert.CoarserIndex] = vert.BSCurrent[k]; +01229 } +01230 } +01231 +01232 <span class="keywordflow">for</span> (attId = 0; attId < <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>; attId++) +01233 { +01234 <span class="comment">// Calculate size of attribute attId array</span> +01235 nSizeAttr = 0; +01236 <span class="keywordflow">for</span>(i = 0; i < <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId].size(); i++) +01237 <span class="keywordflow">if</span> (TmpAttributes[attId][i].CoarserIndex > nSizeAttr) +01238 nSizeAttr = TmpAttributes[attId][i].CoarserIndex; +01239 ++nSizeAttr; +01240 +01241 rBsCoarserMesh.Attributes[attId].resize (nSizeAttr); +01242 +01243 <span class="keywordflow">for</span> (i = 0; i < TmpAttributes[attId].size(); i++) +01244 { +01245 CMRMAttribute &wedge = TmpAttributes[attId][i]; +01246 <span class="keywordflow">if</span> (wedge.CoarserIndex != -1) +01247 { +01248 rBsCoarserMesh.Attributes[attId][wedge.CoarserIndex] = wedge.BSCurrent[k]; +01249 } +01250 } +01251 } +01252 } +01253 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz559_2" doxytag="NL3D::CMRMBuilder::makeFromMesh" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::makeFromMesh </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname" nowrap> <em>baseMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02966.html">CMRMMeshGeom</a> & </td> + <td class="mdname" nowrap> <em>lodMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname" nowrap> <em>coarserMesh</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>nWantedFaces</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +this is the root call to compute a single lodMesh and the coarserMesh from a baseMesh. +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01256">1256</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06062.html#l00133">NL3D::CMRMMesh::BlendShapes</a>, <a class="el" href="a06055.html#l00945">collapseEdges()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01203">makeCoarserBS()</a>, <a class="el" href="a06055.html#l01108">makeLODMesh()</a>, <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>, and <a class="el" href="a05981.html#l00104">sint</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01287">buildAllLods()</a>. +<p> +<div class="fragment"><pre>01257 { +01258 <span class="comment">// Init Tmp values in MRM builder.</span> +01259 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_1">init</a>(baseMesh); +01260 +01261 <span class="comment">// compute MRM too next tgt face.</span> +01262 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_0">collapseEdges</a>(nWantedFaces); +01263 +01264 <span class="comment">// save the coarser mesh.</span> +01265 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_4">saveCoarserMesh</a>(coarserMesh); +01266 <span class="comment">// Build coarser BlendShapes.</span> +01267 coarserMesh.BlendShapes.resize(baseMesh.BlendShapes.size()); +01268 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderd1">makeCoarserBS</a>(coarserMesh.BlendShapes); +01269 +01270 <span class="comment">// build the lodMesh (baseMesh, with vertex/Attributes collapse infos).</span> +01271 lodMesh= baseMesh; +01272 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz559_3">makeLODMesh</a>(lodMesh); +01273 +01274 <span class="comment">// end for this level.</span> +01275 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz559_3" doxytag="NL3D::CMRMBuilder::makeLODMesh" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::makeLODMesh </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02966.html">CMRMMeshGeom</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>lodMesh</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01108">1108</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06062.html#l00155">NL3D::CMRMMeshGeom::CoarserFaces</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06055.html#l00832">followVertex()</a>, <a class="el" href="a06055.html#l00841">followWedge()</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, and <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01256">makeFromMesh()</a>. +<p> +<div class="fragment"><pre>01109 { +01110 <a class="code" href="a04558.html#a14">sint</a> i,j,attId,<a class="code" href="a04223.html#a566">index</a>,coidx; +01111 +01112 <span class="comment">// for all faces of this mesh, find target in the coarser mesh.</span> +01113 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)lodMesh.CoarserFaces.size();i++) +01114 { +01115 CMRMFace &face= lodMesh.CoarserFaces[i]; +01116 +01117 <span class="comment">// For 3 corners.</span> +01118 <span class="keywordflow">for</span>(j=0;j<3;j++) +01119 { +01120 <span class="comment">// Vertex.</span> +01121 <span class="comment">// The index is yet the index in the finer mesh.</span> +01122 <a class="code" href="a04223.html#a566">index</a>= face.Corner[j].Vertex; +01123 <span class="comment">// the index in the coarser mesh is vert.CoarserIndex.</span> +01124 coidx= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[<a class="code" href="a04223.html#a566">index</a>].CoarserIndex; +01125 <span class="comment">// but if this vertex is collapsed, must find the good index (yet in the finer mesh)</span> +01126 <span class="keywordflow">if</span>(coidx==-1) +01127 { +01128 <span class="comment">// find to which we must collapse.</span> +01129 <a class="code" href="a04223.html#a566">index</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_3">followVertex</a>(index); +01130 <span class="comment">// and so we have the coarser index. this one must be valid.</span> +01131 coidx= TmpVertices[<a class="code" href="a04223.html#a566">index</a>].CoarserIndex; +01132 <a class="code" href="a04199.html#a6">nlassert</a>(coidx>=0); +01133 } +01134 <span class="comment">// update corner of CoarserFace.</span> +01135 face.Corner[j].Vertex= coidx; +01136 +01137 +01138 <span class="comment">// Do exactly same thing for all attributes.</span> +01139 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++) +01140 { +01141 <a class="code" href="a04223.html#a566">index</a>= face.Corner[j].Attributes[attId]; +01142 coidx= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][<a class="code" href="a04223.html#a566">index</a>].CoarserIndex; +01143 <span class="keywordflow">if</span>(coidx==-1) +01144 { +01145 <a class="code" href="a04223.html#a566">index</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz557_4">followWedge</a>(attId, index); +01146 coidx= TmpAttributes[attId][<a class="code" href="a04223.html#a566">index</a>].CoarserIndex; +01147 <a class="code" href="a04199.html#a6">nlassert</a>(coidx>=0); +01148 } +01149 face.Corner[j].Attributes[attId]= coidx; +01150 } +01151 } +01152 } +01153 +01154 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_10" doxytag="NL3D::CMRMBuilder::normalizeBaseMeshSkin" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::normalizeBaseMeshSkin </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>baseMesh</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01905">1905</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06055.html#l01858">normalizeSkinWeight()</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06055.html#l02991">compileMRM()</a>. +<p> +<div class="fragment"><pre>01906 { +01907 <a class="code" href="a04199.html#a6">nlassert</a>(_Skinned); +01908 +01909 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0; i<baseMesh.SkinWeights.size(); i++) +01910 { +01911 baseMesh.SkinWeights[i]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz567_11">normalizeSkinWeight</a>(baseMesh.SkinWeights[i]); +01912 } +01913 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_11" doxytag="NL3D::CMRMBuilder::normalizeSkinWeight" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02865.html">CMesh::CSkinWeight</a> NL3D::CMRMBuilder::normalizeSkinWeight </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02865.html">CMesh::CSkinWeight</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>sw</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01858">1858</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a05990.html#l00116">NL3D::CMesh::CSkinWeight::MatrixId</a>, <a class="el" href="a06055.html#l00382">NL3D::CTmpVertexWeight::MatrixId</a>, <a class="el" href="a05990.html#l00063">NL3D_MESH_SKINNING_MAX_MATRIX</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06055.html#l00383">NL3D::CTmpVertexWeight::Weight</a>, and <a class="el" href="a05990.html#l00118">NL3D::CMesh::CSkinWeight::Weights</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01905">normalizeBaseMeshSkin()</a>. +<p> +<div class="fragment"><pre>01859 { +01860 <a class="code" href="a04558.html#a15">uint</a> nbMats= 0; +01861 <span class="keyword">static</span> vector<CTmpVertexWeight> sws; +01862 sws.reserve(NL3D_MESH_SKINNING_MAX_MATRIX); +01863 sws.clear(); +01864 +01865 <span class="comment">// For all weights of sw1.</span> +01866 <a class="code" href="a04558.html#a15">uint</a> i; +01867 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04567.html#a0">NL3D_MESH_SKINNING_MAX_MATRIX</a>; i++) +01868 { +01869 CTmpVertexWeight vw; +01870 vw.MatrixId= sw.MatrixId[i]; +01871 vw.Weight= sw.Weights[i]; +01872 <span class="comment">// if this weight is not null.</span> +01873 <span class="keywordflow">if</span>(vw.Weight>0) +01874 { +01875 <span class="comment">// add it to the list.</span> +01876 sws.push_back(vw); +01877 nbMats++; +01878 } +01879 } +01880 +01881 <span class="comment">// sort by Weight decreasing order.</span> +01882 sort(sws.begin(), sws.end()); +01883 +01884 +01885 <span class="comment">// Then output the result to the skinWeight, normalizing.</span> +01886 <span class="keywordtype">float</span> sumWeight=0; +01887 <span class="keywordflow">for</span>(i= 0; i<nbMats; i++) +01888 { +01889 sumWeight+= sws[i].Weight; +01890 } +01891 +01892 CMesh::CSkinWeight ret; +01893 <span class="comment">// Fill only needed matrix (other are rested in CMesh::CSkinWeight ctor).</span> +01894 <span class="keywordflow">for</span>(i= 0; i<nbMats; i++) +01895 { +01896 ret.MatrixId[i]= sws[i].MatrixId; +01897 ret.Weights[i]= sws[i].Weight / sumWeight; +01898 } +01899 +01900 <span class="keywordflow">return</span> ret; +01901 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz557_6" doxytag="NL3D::CMRMBuilder::removeFaceFromEdgeList" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::removeFaceFromEdgeList </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02958.html">CMRMFaceBuild</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>f</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00367">367</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00098">EdgeCollapses</a>, <a class="el" href="a06058.html#l00228">NL3D::CMRMFaceBuild::It0</a>, <a class="el" href="a06058.html#l00228">NL3D::CMRMFaceBuild::It1</a>, <a class="el" href="a06058.html#l00228">NL3D::CMRMFaceBuild::It2</a>, <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt0</a>, <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt1</a>, and <a class="el" href="a06058.html#l00230">NL3D::CMRMFaceBuild::ValidIt2</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, and <a class="el" href="a06055.html#l00945">collapseEdges()</a>. +<p> +<div class="fragment"><pre>00368 { +00369 <span class="keywordflow">if</span>(f.ValidIt0) +00370 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(f.It0); +00371 <span class="keywordflow">if</span>(f.ValidIt1) +00372 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(f.It1); +00373 <span class="keywordflow">if</span>(f.ValidIt2) +00374 <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">EdgeCollapses</a>.erase(f.It2); +00375 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz559_4" doxytag="NL3D::CMRMBuilder::saveCoarserMesh" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CMRMBuilder::saveCoarserMesh </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02960.html">CMRMMesh</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>coarserMesh</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l01010">1010</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00150">_HasMeshInterfaces</a>, <a class="el" href="a06062.html#l00061">NL3D::CMRMCorner::Attributes</a>, <a class="el" href="a06062.html#l00125">NL3D::CMRMMesh::Attributes</a>, <a class="el" href="a06058.html#l00127">NL3D::CMRMAttribute::CoarserIndex</a>, <a class="el" href="a06058.html#l00103">NL3D::CMRMVertex::CoarserIndex</a>, <a class="el" href="a06058.html#l00125">NL3D::CMRMAttribute::CollapsedTo</a>, <a class="el" href="a06058.html#l00101">NL3D::CMRMVertex::CollapsedTo</a>, <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06058.html#l00123">NL3D::CMRMAttribute::Current</a>, <a class="el" href="a06058.html#l00096">NL3D::CMRMVertex::Current</a>, <a class="el" href="a06058.html#l00099">NL3D::CMRMVertex::CurrentSW</a>, <a class="el" href="a06058.html#l00226">NL3D::CMRMFaceBuild::Deleted</a>, <a class="el" href="a06062.html#l00129">NL3D::CMRMMesh::Faces</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a06058.html#l00106">NL3D::CMRMVertex::InterfaceLink</a>, <a class="el" href="a06062.html#l00123">NL3D::CMRMMesh::InterfaceLinks</a>, <a class="el" href="a06062.html#l00083">NL3D::CMRMFace::MaterialId</a>, <a class="el" href="a06062.html#l00046">NL3D_MRM_MAX_ATTRIB</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06062.html#l00127">NL3D::CMRMMesh::NumAttributes</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06062.html#l00121">NL3D::CMRMMesh::SkinWeights</a>, <a class="el" href="a06056.html#l00092">TmpAttributes</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>, and <a class="el" href="a06062.html#l00119">NL3D::CMRMMesh::Vertices</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01256">makeFromMesh()</a>. +<p> +<div class="fragment"><pre>01011 { +01012 <a class="code" href="a04558.html#a14">sint</a> i,attId,<a class="code" href="a04223.html#a566">index</a>; +01013 <span class="comment">// First clear ALL.</span> +01014 coarserMesh.Vertices.clear(); +01015 coarserMesh.SkinWeights.clear(); +01016 coarserMesh.InterfaceLinks.clear(); +01017 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a04639.html#a0">NL3D_MRM_MAX_ATTRIB</a>;attId++) +01018 { +01019 coarserMesh.Attributes[attId].clear(); +01020 } +01021 coarserMesh.Faces.clear(); +01022 coarserMesh.NumAttributes= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>; +01023 +01024 <span class="comment">// Vertices.</span> +01025 <span class="comment">//==========</span> +01026 <a class="code" href="a04223.html#a566">index</a>=0; +01027 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>.size();i++) +01028 { +01029 CMRMVertex &vert=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[i]; +01030 <span class="keywordflow">if</span>(vert.CollapsedTo==-1) <span class="comment">// if exist yet.</span> +01031 { +01032 vert.CoarserIndex=<a class="code" href="a04223.html#a566">index</a>; +01033 coarserMesh.Vertices.push_back(vert.Current); +01034 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">_Skinned</a>) +01035 coarserMesh.SkinWeights.push_back(vert.CurrentSW); +01036 <span class="keywordflow">if</span>(<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">_HasMeshInterfaces</a>) +01037 coarserMesh.InterfaceLinks.push_back(vert.InterfaceLink); +01038 +01039 <a class="code" href="a04223.html#a566">index</a>++; +01040 } +01041 <span class="keywordflow">else</span> +01042 vert.CoarserIndex=-1; <span class="comment">// indicate that this vertex no more exist and is to be geomorphed to an other.</span> +01043 } +01044 +01045 +01046 <span class="comment">// Attributes.</span> +01047 <span class="comment">//============</span> +01048 <span class="keywordflow">for</span>(attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++) +01049 { +01050 <a class="code" href="a04223.html#a566">index</a>=0; +01051 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId].size();i++) +01052 { +01053 CMRMAttribute &wedge= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][i]; +01054 <span class="keywordflow">if</span>(wedge.CollapsedTo==-1) <span class="comment">// if exist yet.</span> +01055 { +01056 wedge.CoarserIndex=<a class="code" href="a04223.html#a566">index</a>; +01057 coarserMesh.Attributes[attId].push_back(wedge.Current); +01058 <a class="code" href="a04223.html#a566">index</a>++; +01059 } +01060 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(wedge.CollapsedTo==-2) <span class="comment">// else if totaly destroyed.</span> +01061 { +01062 <span class="comment">// Insert this wedge in the coarser mesh.</span> +01063 <span class="comment">// NB: the coarser mesh faces do not use it anymore, but FinerMesh use it</span> +01064 <span class="comment">// for geomorph (LODMesh.CoarserFaces may point to it).</span> +01065 <span class="comment">// NB: look at buildFinalMRM(), it works fine for all cases.</span> +01066 wedge.CoarserIndex=<a class="code" href="a04223.html#a566">index</a>; +01067 coarserMesh.Attributes[attId].push_back(wedge.Current); +01068 <a class="code" href="a04223.html#a566">index</a>++; +01069 } +01070 <span class="keywordflow">else</span> +01071 wedge.CoarserIndex=-1; <span class="comment">// indicate that this wedge no more exist and is to be geomorphed to an other.</span> +01072 } +01073 } +01074 +01075 <span class="comment">// Faces.</span> +01076 <span class="comment">//=======</span> +01077 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>.size();i++) +01078 { +01079 CMRMFaceBuild &face=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[i]; +01080 <span class="keywordflow">if</span>(!face.Deleted) +01081 { +01082 CMRMFace newFace; +01083 <span class="comment">// Material.</span> +01084 newFace.MaterialId= face.MaterialId; +01085 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> j=0;j<3;j++) +01086 { +01087 <span class="comment">// Vertex.</span> +01088 newFace.Corner[j].Vertex= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[face.Corner[j].Vertex].CoarserIndex; +01089 <a class="code" href="a04199.html#a6">nlassert</a>(newFace.Corner[j].Vertex>=0); +01090 <span class="comment">// Attributes.</span> +01091 <span class="keywordflow">for</span>(attId=0;attId<NumAttributes;attId++) +01092 { +01093 <a class="code" href="a04558.html#a14">sint</a> oldidx= face.Corner[j].Attributes[attId]; +01094 newFace.Corner[j].Attributes[attId]= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">TmpAttributes</a>[attId][oldidx].CoarserIndex; +01095 <a class="code" href="a04199.html#a6">nlassert</a>(newFace.Corner[j].Attributes[attId]>=0); +01096 } +01097 +01098 } +01099 +01100 coarserMesh.Faces.push_back(newFace); +01101 } +01102 } +01103 +01104 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz555_4" doxytag="NL3D::CMRMBuilder::vertexClosed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::vertexClosed </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00108">108</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06062.html#l00081">NL3D::CMRMFace::Corner</a>, <a class="el" href="a06058.html#l00263">NL3D::CMRMFaceBuild::getEdge()</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, and <a class="el" href="a06062.html#l00059">NL3D::CMRMCorner::Vertex</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>. +<p> +<div class="fragment"><pre>00109 { +00110 CMRMVertex &vert= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[numvertex]; +00111 map<CMRMEdge, sint> EdgeShare; +00112 <span class="comment">// Init to 0.</span> +00113 <a class="code" href="a04558.html#a14">sint</a> i; +00114 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++) +00115 { +00116 CMRMFaceBuild &f=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]]; +00117 EdgeShare[f.getEdge(0)]= 0; +00118 EdgeShare[f.getEdge(1)]= 0; +00119 EdgeShare[f.getEdge(2)]= 0; +00120 } +00121 <span class="comment">// Inc count.</span> +00122 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++) +00123 { +00124 CMRMFaceBuild &f=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]]; +00125 EdgeShare[f.getEdge(0)]++; +00126 EdgeShare[f.getEdge(1)]++; +00127 EdgeShare[f.getEdge(2)]++; +00128 } +00129 <span class="comment">// Test open edges.</span> +00130 <span class="keywordflow">for</span>(i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++) +00131 { +00132 CMRMFaceBuild &f=<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]]; +00133 <a class="code" href="a04558.html#a14">sint</a> v0= f.Corner[0].Vertex; +00134 <a class="code" href="a04558.html#a14">sint</a> v1= f.Corner[1].Vertex; +00135 <a class="code" href="a04558.html#a14">sint</a> v2= f.Corner[2].Vertex; +00136 <span class="keywordflow">if</span>(EdgeShare[f.getEdge(0)]<2 && (v0==numvertex || v1==numvertex)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00137 <span class="keywordflow">if</span>(EdgeShare[f.getEdge(1)]<2 && (v1==numvertex || v2==numvertex)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00138 <span class="keywordflow">if</span>(EdgeShare[f.getEdge(2)]<2 && (v0==numvertex || v2==numvertex)) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00139 } +00140 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00141 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz555_5" doxytag="NL3D::CMRMBuilder::vertexContinue" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::vertexContinue </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00103">103</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06055.html#l00090">vertexHasOneMaterial()</a>, and <a class="el" href="a06055.html#l00074">vertexHasOneWedge()</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, and <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>. +<p> +<div class="fragment"><pre>00104 { +00105 <span class="keywordflow">return</span> <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_7">vertexHasOneWedge</a>(numvertex) && <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz555_6">vertexHasOneMaterial</a>(numvertex); +00106 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz555_6" doxytag="NL3D::CMRMBuilder::vertexHasOneMaterial" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::vertexHasOneMaterial </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00090">90</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, and <a class="el" href="a06056.html#l00090">TmpVertices</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00103">vertexContinue()</a>. +<p> +<div class="fragment"><pre>00091 { +00092 <a class="code" href="a04558.html#a14">sint</a> matId=-1; +00093 CMRMVertex &vert= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[numvertex]; +00094 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++) +00095 { +00096 <a class="code" href="a04558.html#a14">sint</a> m= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]].MaterialId; +00097 <span class="keywordflow">if</span>(matId>=0 && matId!=m) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00098 <span class="keywordflow">else</span> matId=m; +00099 } +00100 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00101 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz555_7" doxytag="NL3D::CMRMBuilder::vertexHasOneWedge" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NL3D::CMRMBuilder::vertexHasOneWedge </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>numvertex</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06055.html#l00074">74</a> of file <a class="el" href="a06055.html">mrm_builder.cpp</a>. +<p> +References <a class="el" href="a06056.html#l00094">NumAttributes</a>, <a class="el" href="a06058.html#l00100">NL3D::CMRMVertex::SharedFaces</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06056.html#l00096">TmpFaces</a>, <a class="el" href="a06056.html#l00090">TmpVertices</a>, and <a class="el" href="a05646.html#l00236">w</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00103">vertexContinue()</a>. +<p> +<div class="fragment"><pre>00075 { +00076 CMRMVertex &vert= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">TmpVertices</a>[numvertex]; +00077 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> attId=0;attId<<a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NumAttributes</a>;attId++) +00078 { +00079 <a class="code" href="a04558.html#a14">sint</a> numwedge=-1; +00080 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)vert.SharedFaces.size();i++) +00081 { +00082 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a575">w</a>= <a class="code" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">TmpFaces</a>[vert.SharedFaces[i]].getAssociatedWedge(attId, numvertex); +00083 <span class="keywordflow">if</span>(numwedge>=0 && numwedge!=<a class="code" href="a04223.html#a575">w</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>; +00084 <span class="keywordflow">else</span> numwedge=<a class="code" href="a04223.html#a575">w</a>; +00085 } +00086 } +00087 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00088 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NL3D_1_1CMRMBuilderz567_12" doxytag="NL3D::CMRMBuilder::_AttributeMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_0">TAttributeMap</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz567_12">NL3D::CMRMBuilder::_AttributeMap</a>[NL3D_MRM_MAX_ATTRIB]<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00229">229</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>, and <a class="el" href="a06055.html#l01648">findInsertAttributeInBaseMesh()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz561_1" doxytag="NL3D::CMRMBuilder::_CurrentLodComputed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_1">NL3D::CMRMBuilder::_CurrentLodComputed</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00154">154</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01287">buildAllLods()</a>, <a class="el" href="a06055.html#l00499">collapseEdge()</a>, and <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz563_1" doxytag="NL3D::CMRMBuilder::_GeomMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_0">TGeomMap</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz563_1">NL3D::CMRMBuilder::_GeomMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00180">180</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01336">buildFinalMRM()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz561_2" doxytag="NL3D::CMRMBuilder::_HasMeshInterfaces" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_2">NL3D::CMRMBuilder::_HasMeshInterfaces</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00150">150</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01734">buildMrmBaseMesh()</a>, <a class="el" href="a06055.html#l00859">CMRMBuilder()</a>, <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l02991">compileMRM()</a>, <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>, <a class="el" href="a06055.html#l00867">init()</a>, and <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz561_3" doxytag="NL3D::CMRMBuilder::_SewingMeshes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a02968.html">CMRMSewingMesh</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz561_3">NL3D::CMRMBuilder::_SewingMeshes</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00152">152</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l03115">buildMRMSewingMeshes()</a>, <a class="el" href="a06055.html#l00499">collapseEdge()</a>, and <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz553_0" doxytag="NL3D::CMRMBuilder::_Skinned" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_0">NL3D::CMRMBuilder::_Skinned</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00101">101</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz553_1" doxytag="NL3D::CMRMBuilder::_SkinReduction" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02967.html#NL3D_1_1CMRMParametersw3">CMRMParameters::TSkinReduction</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_1">NL3D::CMRMBuilder::_SkinReduction</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +If the current build is skinned, control the quality of the skinning redcution. +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00103">103</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00399">collapseSkinWeight()</a>, and <a class="el" href="a06055.html#l02991">compileMRM()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz553_2" doxytag="NL3D::CMRMBuilder::EdgeCollapses" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05363.html#a152">TEdgeMap</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_2">NL3D::CMRMBuilder::EdgeCollapses</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00098">98</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00945">collapseEdges()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l00347">insertFaceIntoEdgeList()</a>, and <a class="el" href="a06055.html#l00367">removeFaceFromEdgeList()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz553_3" doxytag="NL3D::CMRMBuilder::NumAttributes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_3">NL3D::CMRMBuilder::NumAttributes</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00094">94</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l01336">buildFinalMRM()</a>, <a class="el" href="a06055.html#l00859">CMRMBuilder()</a>, <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01203">makeCoarserBS()</a>, <a class="el" href="a06055.html#l01108">makeLODMesh()</a>, <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>, and <a class="el" href="a06055.html#l00074">vertexHasOneWedge()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz553_4" doxytag="NL3D::CMRMBuilder::TmpAttributes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a02949.html">CMRMAttribute</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_4">NL3D::CMRMBuilder::TmpAttributes</a>[NL3D_MRM_MAX_ATTRIB]<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00092">92</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00333">faceShareWedges()</a>, <a class="el" href="a06055.html#l00841">followWedge()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01203">makeCoarserBS()</a>, <a class="el" href="a06055.html#l01108">makeLODMesh()</a>, and <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz553_5" doxytag="NL3D::CMRMBuilder::TmpFaces" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a02958.html">CMRMFaceBuild</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_5">NL3D::CMRMBuilder::TmpFaces</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00096">96</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00945">collapseEdges()</a>, <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06055.html#l00214">edgeNearUniqueMatFace()</a>, <a class="el" href="a06055.html#l00143">getDeltaFaceNormals()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>, <a class="el" href="a06055.html#l00108">vertexClosed()</a>, <a class="el" href="a06055.html#l00090">vertexHasOneMaterial()</a>, and <a class="el" href="a06055.html#l00074">vertexHasOneWedge()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMRMBuilderz553_6" doxytag="NL3D::CMRMBuilder::TmpVertices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a02970.html">CMRMVertex</a>> <a class="el" href="a02951.html#NL3D_1_1CMRMBuilderz553_6">NL3D::CMRMBuilder::TmpVertices</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06056.html#l00090">90</a> of file <a class="el" href="a06056.html">mrm_builder.h</a>. +<p> +Referenced by <a class="el" href="a06055.html#l00499">collapseEdge()</a>, <a class="el" href="a06055.html#l00945">collapseEdges()</a>, <a class="el" href="a06055.html#l00244">computeEdgeCost()</a>, <a class="el" href="a06055.html#l00169">edgeContinue()</a>, <a class="el" href="a06055.html#l00214">edgeNearUniqueMatFace()</a>, <a class="el" href="a06055.html#l00832">followVertex()</a>, <a class="el" href="a06055.html#l00143">getDeltaFaceNormals()</a>, <a class="el" href="a06055.html#l00867">init()</a>, <a class="el" href="a06055.html#l01203">makeCoarserBS()</a>, <a class="el" href="a06055.html#l01108">makeLODMesh()</a>, <a class="el" href="a06055.html#l01010">saveCoarserMesh()</a>, <a class="el" href="a06055.html#l00108">vertexClosed()</a>, <a class="el" href="a06055.html#l00090">vertexHasOneMaterial()</a>, and <a class="el" href="a06055.html#l00074">vertexHasOneWedge()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06056.html">mrm_builder.h</a><li><a class="el" href="a06055.html">mrm_builder.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:56:45 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |