aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a02367.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02367.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'docs/doxygen/nel/a02367.html')
-rw-r--r--docs/doxygen/nel/a02367.html760
1 files changed, 760 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02367.html b/docs/doxygen/nel/a02367.html
new file mode 100644
index 00000000..d08e6fa5
--- /dev/null
+++ b/docs/doxygen/nel/a02367.html
@@ -0,0 +1,760 @@
+<!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::CCoarseMeshBuild 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&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a> | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
+<h1>NL3D::CCoarseMeshBuild Class Reference</h1><code>#include &lt;<a class="el" href="a05568.html">coarse_mesh_build.h</a>&gt;</code>
+<p>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Class used to build the coarse meshes<p>
+The build method take an array of <a class="el" href="a02878.html">CMeshGeom</a> an a bitmap. This class will compute a single texture used to map every coarse mesh passed in the array.<p>
+Each mesh geom should be a coarse mesh.<p>
+The uv texture coodinates of those coarse meshes will be adjusted to fit in a single texture.<p>
+<dl compact><dt><b>Author:</b></dt><dd>Cyril 'Hulud' Corvazier <p>
+Nevrax France </dd></dl>
+<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a05568.html#l00062">62</a> of file <a class="el" href="a05568.html">coarse_mesh_build.h</a>.<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuilda0">build</a> (const std::vector&lt; <a class="el" href="a02369.html">CCoarseMeshDesc</a> &gt; &amp;coarseMeshes, std::vector&lt; <a class="el" href="a02268.html">NLMISC::CBitmap</a> &gt; &amp;bitmaps, <a class="el" href="a02370.html">CStats</a> &amp;stats, float mulArea)</td></tr>
+
+<tr><td colspan=2><br><h2>Private Types</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map&lt; std::string,<br>
+ <a class="el" href="a02368.html">CBitmapDesc</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuildy0">MapBitmapDesc</a></td></tr>
+
+<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuildd0">buildBitmap</a> (const std::vector&lt; <a class="el" href="a02369.html">CCoarseMeshDesc</a> &gt; &amp;coarseMeshes, std::vector&lt; <a class="el" href="a02268.html">NLMISC::CBitmap</a> &gt; &amp;bitmaps, <a class="el" href="a02370.html">CStats</a> &amp;stats, <a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuildy0">MapBitmapDesc</a> &amp;desc, float mulArea)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuildd1">expand</a> (<a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;bitmap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuildd2">remapCoordinates</a> (const std::vector&lt; <a class="el" href="a02369.html">CCoarseMeshDesc</a> &gt; &amp;coarseMeshes, const <a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuildy0">MapBitmapDesc</a> &amp;desc, <a class="el" href="a04558.html#a15">uint</a> outputBitmapCount)</td></tr>
+
+</table>
+<hr><h2>Member Typedef Documentation</h2>
+<a class="anchor" name="NL3D_1_1CCoarseMeshBuildy0" doxytag="NL3D::CCoarseMeshBuild::MapBitmapDesc" ></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&lt;std::string, <a class="el" href="a02368.html">CBitmapDesc</a>&gt; <a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuildy0">NL3D::CCoarseMeshBuild::MapBitmapDesc</a><code> [private]</code>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a05568.html#l00132">132</a> of file <a class="el" href="a05568.html">coarse_mesh_build.h</a>.
+<p>
+Referenced by <a class="el" href="a05567.html#l00039">build()</a>, <a class="el" href="a05567.html#l00070">buildBitmap()</a>, and <a class="el" href="a05567.html#l00430">remapCoordinates()</a>. </td>
+ </tr>
+</table>
+<hr><h2>Member Function Documentation</h2>
+<a class="anchor" name="NL3D_1_1CCoarseMeshBuilda0" doxytag="NL3D::CCoarseMeshBuild::build" ></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::CCoarseMeshBuild::build </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::vector&lt; <a class="el" href="a02369.html">CCoarseMeshDesc</a> &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>coarseMeshes</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>std::vector&lt; <a class="el" href="a02268.html">NLMISC::CBitmap</a> &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>bitmaps</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a02370.html">CStats</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>stats</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float&nbsp;</td>
+ <td class="mdname" nowrap> <em>mulArea</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The build method. This method will build a single texture and adjuste the UV texture coordinates of each mesh geom.<p>
+<dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign=top><em>coarseMeshes</em>&nbsp;</td><td>is a vector of coarse mesh to compute. </td></tr>
+ <tr><td valign=top><em>bitmap</em>&nbsp;</td><td>will receive the final bitmap. </td></tr>
+ <tr><td valign=top><em>start</em>&nbsp;</td><td>will receive various statistics about the build process. </td></tr>
+ <tr><td valign=top><em>mulArea</em>&nbsp;</td><td>is the mul factor used to increase to theorical global texture size.</td></tr>
+ </table>
+</dl>
+
+<p>
+Definition at line <a class="el" href="a05567.html#l00039">39</a> of file <a class="el" href="a05567.html">coarse_mesh_build.cpp</a>.
+<p>
+References <a class="el" href="a05567.html#l00070">buildBitmap()</a>, <a class="el" href="a05568.html#l00132">MapBitmapDesc</a>, and <a class="el" href="a05567.html#l00430">remapCoordinates()</a>.
+<p>
+<div class="fragment"><pre>00040 {
+00041 <span class="comment">// 1. build the bitmap</span>
+00042 <a class="code" href="a02367.html#NL3D_1_1CCoarseMeshBuildy0">MapBitmapDesc</a> desc;
+00043 <span class="keywordflow">if</span> (<a class="code" href="a02367.html#NL3D_1_1CCoarseMeshBuildd0">buildBitmap</a> (coarseMeshes, bitmaps, stats, desc, mulArea)==<span class="keyword">false</span>)
+00044 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00045
+00046 <span class="comment">// 2. remap coordinates</span>
+00047 <a class="code" href="a02367.html#NL3D_1_1CCoarseMeshBuildd2">remapCoordinates</a> (coarseMeshes, desc, bitmaps.size ());
+00048
+00049 <span class="comment">// 3. ok</span>
+00050 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00051 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NL3D_1_1CCoarseMeshBuildd0" doxytag="NL3D::CCoarseMeshBuild::buildBitmap" ></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::CCoarseMeshBuild::buildBitmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::vector&lt; <a class="el" href="a02369.html">CCoarseMeshDesc</a> &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>coarseMeshes</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>std::vector&lt; <a class="el" href="a02268.html">NLMISC::CBitmap</a> &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>bitmaps</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a02370.html">CStats</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>stats</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuildy0">MapBitmapDesc</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>desc</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>float&nbsp;</td>
+ <td class="mdname" nowrap> <em>mulArea</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a05567.html#l00070">70</a> of file <a class="el" href="a05567.html">coarse_mesh_build.cpp</a>.
+<p>
+References <a class="el" href="a05568.html#l00126">NL3D::CCoarseMeshBuild::CBitmapDesc::Bitmaps</a>, <a class="el" href="a05486.html#l00926">NLMISC::CBitmap::convertToType()</a>, <a class="el" href="a05567.html#l00367">expand()</a>, <a class="el" href="a05568.html#l00122">NL3D::CCoarseMeshBuild::CBitmapDesc::FactorU</a>, <a class="el" href="a05568.html#l00123">NL3D::CCoarseMeshBuild::CBitmapDesc::FactorV</a>, <a class="el" href="a06506.html#l00309">NL3D::ITexture::generate()</a>, <a class="el" href="a05486.html#l01388">NLMISC::CBitmap::getHeight()</a>, <a class="el" href="a05992.html#l00179">NL3D::CMeshBase::getMaterial()</a>, <a class="el" href="a05990.html#l00393">NL3D::CMeshGeom::getNbMatrixBlock()</a>, <a class="el" href="a05990.html#l00398">NL3D::CMeshGeom::getNbRdrPass()</a>, <a class="el" href="a05586.html#l00358">NLMISC::getPowerOf2()</a>, <a class="el" href="a05990.html#l00413">NL3D::CMeshGeom::getRdrPassMaterial()</a>, <a class="el" href="a06506.html#l00338">NL3D::ITexture::getShareName()</a>, <a class="el" href="a05641.html#l00046">NL3D::CMaterial::getTexture()</a>, <a class="el" href="a05486.html#l01363">NLMISC::CBitmap::getWidth()</a>, <a class="el" href="a05567.html#l00061">NL3D::CInsertedBitmap::Height</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05568.html#l00132">MapBitmapDesc</a>, <a class="el" href="a05568.html#l00129">NL3D::CCoarseMeshBuild::CBitmapDesc::Name</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05586.html#l00349">NLMISC::raiseToNextPowerOf2()</a>, <a class="el" href="a05486.html#l01508">NLMISC::CBitmap::resample()</a>, <a class="el" href="a06506.html#l00360">NL3D::ITexture::selectTexture()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>, <a class="el" href="a06506.html#l00332">NL3D::ITexture::supportSharing()</a>, <a class="el" href="a05568.html#l00098">NL3D::CCoarseMeshBuild::CStats::TextureUsed</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, <a class="el" href="a05567.html#l00064">NL3D::CInsertedBitmap::U</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05567.html#l00065">NL3D::CInsertedBitmap::V</a>, <a class="el" href="a05646.html#l00237">v</a>, <a class="el" href="a05567.html#l00060">NL3D::CInsertedBitmap::Width</a>, and <a class="el" href="a05646.html#l01013">width</a>.
+<p>
+Referenced by <a class="el" href="a05567.html#l00039">build()</a>.
+<p>
+<div class="fragment"><pre>00071 {
+00072 <span class="comment">// Total area used by texture</span>
+00073 <a class="code" href="a04558.html#a15">uint</a> totalArea=0;
+00074
+00075 <span class="comment">// ***************************************************************************</span>
+00076
+00077 <span class="comment">// 1. scan each bitmap: calc the area of the bitmap and it its name in the maps sorted by area</span>
+00078 <span class="keyword">typedef</span> std::multimap&lt;uint, CBitmapDesc*&gt; MapAreaBitmap;
+00079 MapAreaBitmap mapArea;
+00080 <a class="code" href="a04558.html#a15">uint</a> mesh;
+00081 <span class="keywordflow">for</span> (mesh=0; mesh&lt;coarseMeshes.size(); mesh++)
+00082 {
+00083 <span class="comment">// Geom mesh pointer</span>
+00084 CMeshGeom *meshGeom=coarseMeshes[mesh].MeshGeom;
+00085
+00086 <span class="comment">// Base mesh pointer</span>
+00087 <span class="keyword">const</span> CMeshBase *meshBase=coarseMeshes[mesh].MeshBase;
+00088
+00089 <span class="comment">// For each matrix block</span>
+00090 <a class="code" href="a04558.html#a15">uint</a> matrixBlock;
+00091 <a class="code" href="a04558.html#a15">uint</a> nbMatrixBlock=meshGeom-&gt;getNbMatrixBlock();
+00092 <span class="keywordflow">for</span> (matrixBlock=0; matrixBlock&lt;nbMatrixBlock; matrixBlock++)
+00093 {
+00094 <span class="comment">// For each render pass</span>
+00095 <a class="code" href="a04558.html#a15">uint</a> renderPass;
+00096 <a class="code" href="a04558.html#a15">uint</a> numRenderPass=meshGeom-&gt;getNbRdrPass(matrixBlock);
+00097 <span class="keywordflow">for</span> (renderPass=0; renderPass&lt;numRenderPass; renderPass++)
+00098 {
+00099 <span class="comment">// Render pass material</span>
+00100 <a class="code" href="a04558.html#a11">uint32</a> matId=meshGeom-&gt;getRdrPassMaterial(matrixBlock, renderPass);
+00101
+00102 <span class="comment">// Checks</span>
+00103 <a class="code" href="a04199.html#a6">nlassert</a> (matId&lt;meshBase-&gt;getNbMaterial());
+00104
+00105 <span class="comment">// Get the material</span>
+00106 <span class="keyword">const</span> CMaterial &amp;material=meshBase-&gt;getMaterial(matId);
+00107
+00108 <span class="comment">// Get the texture</span>
+00109 ITexture *texture=material.getTexture(0);
+00110 <span class="keywordflow">if</span> (texture)
+00111 {
+00112 <span class="comment">// For each bitmaps</span>
+00113 <a class="code" href="a04558.html#a15">uint</a> i;
+00114 std::string name;
+00115 <span class="keywordflow">for</span> (i=0; i&lt;bitmaps.size (); i++)
+00116 {
+00117 <span class="comment">// Select the good slot</span>
+00118 texture-&gt;selectTexture (i);
+00119
+00120 <span class="comment">// Get its name</span>
+00121 <span class="keywordflow">if</span> (texture-&gt;supportSharing())
+00122 {
+00123 <span class="comment">// Get sharing name</span>
+00124 name+=<a class="code" href="a05378.html#a273">strlwr</a>(texture-&gt;getShareName());
+00125 }
+00126 <span class="keywordflow">else</span>
+00127 {
+00128 <span class="comment">// Build a name</span>
+00129 name+=<a class="code" href="a05378.html#a244">toString</a> ((<a class="code" href="a04558.html#a15">uint</a>)texture);
+00130 }
+00131 }
+00132
+00133 <span class="comment">// Already added ?</span>
+00134 <span class="keywordflow">if</span> (desc.find (name)==desc.end())
+00135 {
+00136 <span class="comment">// Add it..</span>
+00137
+00138 <span class="comment">// Insert it in the maps</span>
+00139 MapBitmapDesc::iterator ite = desc.insert (MapBitmapDesc::value_type (name, CBitmapDesc ())).first;
+00140
+00141 <span class="comment">// Descriptor for this texture</span>
+00142 CBitmapDesc &amp;descBitmap = ite-&gt;second;
+00143
+00144 <span class="comment">// Backup original size</span>
+00145 <a class="code" href="a04558.html#a15">uint</a> originalWidth;
+00146 <a class="code" href="a04558.html#a15">uint</a> originalHeight;
+00147
+00148 <span class="comment">// For each bitmaps</span>
+00149 <a class="code" href="a04558.html#a15">uint</a> i;
+00150 descBitmap.Bitmaps.resize (bitmaps.size ());
+00151 <span class="keywordflow">for</span> (i=0; i&lt;bitmaps.size (); i++)
+00152 {
+00153 <span class="comment">// Select the good slot</span>
+00154 texture-&gt;selectTexture (i);
+00155
+00156 <span class="comment">// Generate the texture</span>
+00157 texture-&gt;generate();
+00158
+00159 <span class="comment">// Convert to RGBA</span>
+00160 texture-&gt;convertToType (CBitmap::RGBA);
+00161
+00162 <span class="comment">// First texture ?</span>
+00163 <span class="keywordflow">if</span> (i == 0)
+00164 {
+00165 <span class="comment">// Backup original size</span>
+00166 originalWidth = texture-&gt;getWidth();
+00167 originalHeight = texture-&gt;getHeight();
+00168 }
+00169
+00170 <span class="comment">// Resample, if needed</span>
+00171 <span class="keywordflow">if</span> (i != 0)
+00172 {
+00173 <span class="comment">// New size</span>
+00174 <span class="keywordflow">if</span> ( ( originalWidth != texture-&gt;getWidth () ) || originalHeight != texture-&gt;getHeight () )
+00175 {
+00176 texture-&gt;resample (originalWidth, originalHeight);
+00177 }
+00178 }
+00179
+00180 <span class="comment">// Copy the texture</span>
+00181 descBitmap.Bitmaps[i] = *texture;
+00182
+00183 <span class="comment">// Expand the texture</span>
+00184 <a class="code" href="a02367.html#NL3D_1_1CCoarseMeshBuildd1">expand</a> (descBitmap.Bitmaps[i]);
+00185 }
+00186
+00187 <span class="comment">// Texture area</span>
+00188 <a class="code" href="a04558.html#a15">uint</a> area = descBitmap.Bitmaps[0].getWidth() * descBitmap.Bitmaps[0].getHeight();
+00189 descBitmap.Name = name;
+00190 descBitmap.FactorU = (<span class="keywordtype">float</span>)originalWidth;
+00191 descBitmap.FactorV = (<span class="keywordtype">float</span>)originalHeight;
+00192
+00193 <span class="comment">// Insert in the map area</span>
+00194 mapArea.insert (MapAreaBitmap::value_type(area, &amp;(ite-&gt;second)));
+00195
+00196 <span class="comment">// Sum area if added</span>
+00197 totalArea+=area;
+00198 }
+00199 }
+00200 }
+00201 }
+00202 }
+00203
+00204 <span class="comment">// ***************************************************************************</span>
+00205
+00206 <span class="comment">// 2. Calc the best area for the dest texture and resize the bitmap</span>
+00207
+00208 <span class="comment">// Total area used by the textures + a little more</span>
+00209 <a class="code" href="a04558.html#a15">uint</a> newArea=<a class="code" href="a05378.html#a263">getPowerOf2</a> (raiseToNextPowerOf2 (totalArea));
+00210 <span class="keywordflow">while</span> ((1&lt;&lt;newArea)&lt;(<a class="code" href="a04558.html#a14">sint</a>)(mulArea*(<span class="keywordtype">float</span>)totalArea))
+00211 {
+00212 newArea++;
+00213 }
+00214
+00215 <span class="comment">// Calc width and height with HEIGHT==WIDTH or HEIGHT=2*WIDTH</span>
+00216 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a632">width</a>=1&lt;&lt;(newArea/2);
+00217 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a633">height</a>=1&lt;&lt;(newArea/2 + (newArea&amp;1));
+00218
+00219 <span class="comment">// Resize the bitmap and set the pixel format</span>
+00220 <a class="code" href="a04558.html#a15">uint</a> i;
+00221 <span class="keywordflow">for</span> (i=0; i&lt;bitmaps.size (); i++)
+00222 bitmaps[i].resize (width, height, CBitmap::RGBA);
+00223
+00224 <span class="comment">// Checks</span>
+00225 <span class="keywordflow">if</span> (totalArea==0)
+00226 {
+00227 <span class="comment">// No texture, ok computed.</span>
+00228 stats.TextureUsed=1;
+00229
+00230 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00231 }
+00232
+00233 <span class="comment">// ***************************************************************************</span>
+00234
+00235 <span class="comment">// 3. Place each texture in the bitmap in uncreasing order</span>
+00236 <span class="keyword">typedef</span> std::multimap&lt;sint, CInsertedBitmap&gt; mapInsertedBitmap;
+00237
+00238 <span class="comment">// For each texture</span>
+00239 MapAreaBitmap::iterator ite=mapArea.end();
+00240
+00241 <span class="comment">// Inserted bitmap desc</span>
+00242 mapInsertedBitmap inserted;
+00243
+00244 <span class="comment">// Max texture height</span>
+00245 <a class="code" href="a04558.html#a15">uint</a> maxTexHeight=0;
+00246
+00247 <span class="keywordflow">do</span>
+00248 {
+00249 ite--;
+00250 <a class="code" href="a04199.html#a6">nlassert</a> (ite!=mapArea.end());
+00251
+00252 <span class="comment">// Size of the texture</span>
+00253 <a class="code" href="a04558.html#a15">uint</a> widthTex=ite-&gt;second-&gt;Bitmaps[0].getWidth();
+00254 <a class="code" href="a04558.html#a15">uint</a> heightTex=ite-&gt;second-&gt;Bitmaps[0].getHeight();
+00255
+00256 <span class="comment">// Some checks</span>
+00257 <a class="code" href="a04199.html#a6">nlassert</a> (bitmaps.size () == ite-&gt;second-&gt;Bitmaps.size ());
+00258
+00259 <span class="comment">// Width and height max</span>
+00260 <a class="code" href="a04558.html#a15">uint</a> widthMax=<a class="code" href="a04223.html#a632">width</a>-widthTex;
+00261 <a class="code" href="a04558.html#a15">uint</a> heightMax=<a class="code" href="a04223.html#a633">height</a>-heightTex;
+00262
+00263 <span class="comment">// Test against others..</span>
+00264 <span class="keywordtype">bool</span> enter=<span class="keyword">false</span>;
+00265
+00266 <span class="comment">// For each row and each column</span>
+00267 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a576">v</a>=0; <a class="code" href="a04223.html#a576">v</a>&lt;heightMax; <a class="code" href="a04223.html#a576">v</a>++)
+00268 {
+00269 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> u=0; u&lt;widthMax; u++)
+00270 {
+00271 <span class="comment">// Test against others..</span>
+00272 enter=<span class="keyword">true</span>;
+00273
+00274 <span class="comment">// Get the first to test</span>
+00275 mapInsertedBitmap::iterator toTest=inserted.lower_bound ((<a class="code" href="a04558.html#a14">sint</a>)v-(<a class="code" href="a04558.html#a14">sint</a>)maxTexHeight);
+00276 <span class="keywordflow">while</span> (toTest!=inserted.end())
+00277 {
+00278 <span class="comment">// Make a test ?</span>
+00279 <span class="keywordflow">if</span> ((<a class="code" href="a04558.html#a14">sint</a>)(<a class="code" href="a04223.html#a576">v</a>+heightTex)&lt;=(toTest-&gt;first))
+00280 {
+00281 <span class="comment">// Ok, end test</span>
+00282 <span class="keywordflow">break</span>;
+00283 }
+00284
+00285 <span class="comment">// Test it</span>
+00286 <a class="code" href="a04558.html#a15">uint</a> otherU=toTest-&gt;second.U;
+00287 <a class="code" href="a04558.html#a15">uint</a> otherV=toTest-&gt;second.V;
+00288 <a class="code" href="a04558.html#a15">uint</a> otherWidth=toTest-&gt;second.Width;
+00289 <a class="code" href="a04558.html#a15">uint</a> otherHeight=toTest-&gt;second.Height;
+00290 <span class="keywordflow">if</span> ((<a class="code" href="a04223.html#a576">v&lt;otherV+otherHeight) &amp;&amp; (v+heightTex&gt;</a>otherV) &amp;&amp;
+00291 (u&lt;otherU+otherWidth) &amp;&amp; (u+widthTex&gt;otherU))
+00292 {
+00293 <span class="comment">// Collision</span>
+00294 enter=<span class="keyword">false</span>;
+00295 u=toTest-&gt;second.U+otherWidth-1;
+00296 <span class="keywordflow">break</span>;
+00297 }
+00298
+00299 <span class="comment">// Next to test</span>
+00300 toTest++;
+00301 }
+00302
+00303 <span class="comment">// Enter ?</span>
+00304 <span class="keywordflow">if</span> (enter)
+00305 {
+00306 <span class="comment">// Ok, enter</span>
+00307
+00308 <span class="comment">// Insert an inserted descriptor</span>
+00309 CInsertedBitmap descInserted;
+00310 descInserted.Width=widthTex;
+00311 descInserted.Height=heightTex;
+00312 descInserted.U=u;
+00313 descInserted.V=<a class="code" href="a04223.html#a576">v</a>;
+00314 inserted.insert (mapInsertedBitmap::value_type (v, descInserted));
+00315
+00316 <span class="comment">// Max height</span>
+00317 <span class="keywordflow">if</span> (heightTex&gt;maxTexHeight)
+00318 maxTexHeight=heightTex;
+00319
+00320 <span class="comment">// Blit in the texture</span>
+00321 <a class="code" href="a04558.html#a15">uint</a> i;
+00322 <span class="keywordflow">for</span> (i=0; i&lt;bitmaps.size (); i++)
+00323 {
+00324 <span class="comment">// Check..</span>
+00325 <a class="code" href="a04199.html#a6">nlassert</a> ( (ite-&gt;second-&gt;Bitmaps[0].getWidth () == ite-&gt;second-&gt;Bitmaps[i].getWidth ()) &amp;&amp;
+00326 (ite-&gt;second-&gt;Bitmaps[0].getHeight () == ite-&gt;second-&gt;Bitmaps[i].getHeight ()) );
+00327
+00328 <span class="comment">// Blit it</span>
+00329 bitmaps[i].blit (&amp;(ite-&gt;second-&gt;Bitmaps[i]), u, v);
+00330 }
+00331
+00332 <span class="comment">// Set the U and V texture coordinates</span>
+00333 ite-&gt;second-&gt;U=(<span class="keywordtype">float</span>)(u+1)/(<span class="keywordtype">float</span>)<a class="code" href="a04223.html#a632">width</a>;
+00334 ite-&gt;second-&gt;V=(<span class="keywordtype">float</span>)(<a class="code" href="a04223.html#a576">v</a>+1)/(<span class="keywordtype">float</span>)<a class="code" href="a04223.html#a633">height</a>;
+00335
+00336 <span class="comment">// Set ratio</span>
+00337 ite-&gt;second-&gt;FactorU /= (<span class="keywordtype">float</span>)<a class="code" href="a04223.html#a632">width</a>;
+00338 ite-&gt;second-&gt;FactorV /= (<span class="keywordtype">float</span>)<a class="code" href="a04223.html#a633">height</a>;
+00339
+00340 <span class="comment">// End</span>
+00341 <span class="keywordflow">break</span>;
+00342 }
+00343
+00344 <span class="comment">// next..</span>
+00345 }
+00346
+00347 <span class="comment">// Enter ?</span>
+00348 <span class="keywordflow">if</span> (enter)
+00349 <span class="keywordflow">break</span>;
+00350 }
+00351
+00352 <span class="comment">// Not enter ?</span>
+00353 <span class="keywordflow">if</span> (!enter)
+00354 <span class="comment">// Texture too small..</span>
+00355 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00356 }
+00357 <span class="keywordflow">while</span> (ite!=mapArea.begin());
+00358
+00359 <span class="comment">// Some stats</span>
+00360 stats.TextureUsed=(<span class="keywordtype">float</span>)totalArea/(<span class="keywordtype">float</span>)(<a class="code" href="a04223.html#a632">width</a>*<a class="code" href="a04223.html#a633">height</a>);
+00361
+00362 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00363 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NL3D_1_1CCoarseMeshBuildd1" doxytag="NL3D::CCoarseMeshBuild::expand" ></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::CCoarseMeshBuild::expand </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a02268.html">NLMISC::CBitmap</a> &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>bitmap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a05567.html#l00367">367</a> of file <a class="el" href="a05567.html">coarse_mesh_build.cpp</a>.
+<p>
+References <a class="el" href="a05486.html#l02332">NLMISC::CBitmap::blit()</a>, <a class="el" href="a05486.html#l01388">NLMISC::CBitmap::getHeight()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a05486.html#l01363">NLMISC::CBitmap::getWidth()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05486.html#l01545">NLMISC::CBitmap::resize()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05646.html#l01013">width</a>.
+<p>
+Referenced by <a class="el" href="a05567.html#l00070">buildBitmap()</a>.
+<p>
+<div class="fragment"><pre>00368 {
+00369 <span class="comment">// Get size</span>
+00370 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a632">width</a>=bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturea20">getWidth</a>();
+00371 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a633">height</a>=bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturea12">getHeight</a>();
+00372
+00373 <span class="comment">// Valid size ?</span>
+00374 <span class="keywordflow">if</span> ((<a class="code" href="a04223.html#a632">width</a>!=0) &amp;&amp; (<a class="code" href="a04223.html#a633">height</a>!=0))
+00375 {
+00376 <span class="comment">// Copy the bitmap</span>
+00377 <a class="code" href="a02268.html">CBitmap</a> copy=bitmap;
+00378
+00379 <span class="comment">// Resize the bitmap</span>
+00380 bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturea33">resize</a> (width+2, height+2);
+00381
+00382 <span class="comment">// Copy old bitmap</span>
+00383 bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturea2">blit</a> (&amp;copy, 1, 1);
+00384
+00385 <span class="comment">// Make a top and bottom border</span>
+00386 <a class="code" href="a04558.html#a11">uint32</a> *topSrc=(<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(copy.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]);
+00387 <a class="code" href="a04558.html#a11">uint32</a> *topDest=((<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]))+1;
+00388 memcpy (topDest, topSrc, 4*width);
+00389 <a class="code" href="a04558.html#a11">uint32</a> *bottomSrc=topSrc+<a class="code" href="a04223.html#a632">width</a>*(<a class="code" href="a04223.html#a633">height</a>-1);
+00390 <a class="code" href="a04558.html#a11">uint32</a> *bottomDest=((<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]))+(<a class="code" href="a04223.html#a632">width</a>+2)*(<a class="code" href="a04223.html#a633">height</a>+1)+1;
+00391 memcpy (bottomDest, bottomSrc, 4*width);
+00392
+00393 <span class="comment">// Make a left and right border</span>
+00394 <a class="code" href="a04558.html#a11">uint32</a> *leftSrc=(<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(copy.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]);
+00395 <a class="code" href="a04558.html#a11">uint32</a> *leftDest=((<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]))+<a class="code" href="a04223.html#a632">width</a>+2;
+00396 <a class="code" href="a04558.html#a11">uint32</a> *rightSrc=leftSrc+<a class="code" href="a04223.html#a632">width</a>-1;
+00397 <a class="code" href="a04558.html#a11">uint32</a> *rightDest=leftDest+<a class="code" href="a04223.html#a632">width</a>+1;
+00398 <a class="code" href="a04558.html#a15">uint</a> i;
+00399 <span class="keywordflow">for</span> (i=0; i&lt;<a class="code" href="a04223.html#a633">height</a>; i++)
+00400 {
+00401 <span class="comment">// Copy the borders</span>
+00402 *leftDest=*leftSrc;
+00403 *rightDest=*rightSrc;
+00404
+00405 <span class="comment">// Move pointers</span>
+00406 leftDest+=<a class="code" href="a04223.html#a632">width</a>+2;
+00407 rightDest+=<a class="code" href="a04223.html#a632">width</a>+2;
+00408 leftSrc+=<a class="code" href="a04223.html#a632">width</a>;
+00409 rightSrc+=<a class="code" href="a04223.html#a632">width</a>;
+00410 }
+00411
+00412 <span class="comment">// Make corners</span>
+00413
+00414 <span class="comment">// Left top</span>
+00415 *(<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0])=*(<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(copy.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]);
+00416
+00417 <span class="comment">// Rigth top</span>
+00418 *(((<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]))+<a class="code" href="a04223.html#a632">width</a>+1)=*(((<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(copy.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]))+<a class="code" href="a04223.html#a632">width</a>-1);
+00419
+00420 <span class="comment">// Rigth bottom</span>
+00421 *(((<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]))+(<a class="code" href="a04223.html#a632">width</a>+2)*(<a class="code" href="a04223.html#a633">height</a>+2)-1)=*(((<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(copy.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]))+<a class="code" href="a04223.html#a632">width</a>*<a class="code" href="a04223.html#a633">height</a>-1);
+00422
+00423 <span class="comment">// Left bottom</span>
+00424 *(((<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(bitmap.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]))+(<a class="code" href="a04223.html#a632">width</a>+2)*(<a class="code" href="a04223.html#a633">height</a>+1))=*(((<a class="code" href="a04558.html#a11">uint32</a>*)&amp;(copy.<a class="code" href="a02268.html#NL3D_1_1ITexturez1927_1">getPixels</a>()[0]))+<a class="code" href="a04223.html#a632">width</a>*(<a class="code" href="a04223.html#a633">height</a>-1));
+00425 }
+00426 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NL3D_1_1CCoarseMeshBuildd2" doxytag="NL3D::CCoarseMeshBuild::remapCoordinates" ></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::CCoarseMeshBuild::remapCoordinates </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::vector&lt; <a class="el" href="a02369.html">CCoarseMeshDesc</a> &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>coarseMeshes</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const <a class="el" href="a02367.html#NL3D_1_1CCoarseMeshBuildy0">MapBitmapDesc</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>desc</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>&nbsp;</td>
+ <td class="mdname" nowrap> <em>outputBitmapCount</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [private]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a05567.html#l00430">430</a> of file <a class="el" href="a05567.html">coarse_mesh_build.cpp</a>.
+<p>
+References <a class="el" href="a05568.html#l00122">NL3D::CCoarseMeshBuild::CBitmapDesc::FactorU</a>, <a class="el" href="a05568.html#l00123">NL3D::CCoarseMeshBuild::CBitmapDesc::FactorV</a>, <a class="el" href="a05992.html#l00179">NL3D::CMeshBase::getMaterial()</a>, <a class="el" href="a05990.html#l00393">NL3D::CMeshGeom::getNbMatrixBlock()</a>, <a class="el" href="a05990.html#l00398">NL3D::CMeshGeom::getNbRdrPass()</a>, <a class="el" href="a06198.html#l00141">NL3D::CPrimitiveBlock::getNumQuad()</a>, <a class="el" href="a06198.html#l00108">NL3D::CPrimitiveBlock::getNumTri()</a>, <a class="el" href="a06197.html#l00149">NL3D::CPrimitiveBlock::getQuadPointer()</a>, <a class="el" href="a05990.html#l00413">NL3D::CMeshGeom::getRdrPassMaterial()</a>, <a class="el" href="a05990.html#l00404">NL3D::CMeshGeom::getRdrPassPrimitiveBlock()</a>, <a class="el" href="a06506.html#l00338">NL3D::ITexture::getShareName()</a>, <a class="el" href="a06710.html#l00497">NL3D::CVertexBuffer::getTexCoordPointer()</a>, <a class="el" href="a05641.html#l00046">NL3D::CMaterial::getTexture()</a>, <a class="el" href="a06197.html#l00091">NL3D::CPrimitiveBlock::getTriPointer()</a>, <a class="el" href="a05990.html#l00390">NL3D::CMeshGeom::getVertexBuffer()</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05568.html#l00132">MapBitmapDesc</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06506.html#l00360">NL3D::ITexture::selectTexture()</a>, <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>, <a class="el" href="a06506.html#l00332">NL3D::ITexture::supportSharing()</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, <a class="el" href="a05568.html#l00118">NL3D::CCoarseMeshBuild::CBitmapDesc::U</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05568.html#l00119">NL3D::CCoarseMeshBuild::CBitmapDesc::V</a>.
+<p>
+Referenced by <a class="el" href="a05567.html#l00039">build()</a>.
+<p>
+<div class="fragment"><pre>00431 {
+00432 <span class="comment">// 1. scan each bitmap: calc the area of the bitmap and it its name in the maps sorted by area</span>
+00433 <span class="keyword">typedef</span> std::multimap&lt;float, CBitmapDesc&gt; MapAreaBitmap;
+00434 MapAreaBitmap mapArea;
+00435 <a class="code" href="a04558.html#a15">uint</a> mesh;
+00436 <span class="keywordflow">for</span> (mesh=0; mesh&lt;coarseMeshes.size(); mesh++)
+00437 {
+00438 <span class="comment">// Geom mesh pointer</span>
+00439 CMeshGeom *meshGeom=coarseMeshes[mesh].MeshGeom;
+00440
+00441 <span class="comment">// Base mesh pointer</span>
+00442 <span class="keyword">const</span> CMeshBase *meshBase=coarseMeshes[mesh].MeshBase;
+00443
+00444 <span class="comment">// The vertex buffer</span>
+00445 CVertexBuffer &amp;vertexBuffer=const_cast&lt;CVertexBuffer&amp;&gt; (meshGeom-&gt;getVertexBuffer());
+00446
+00447 <span class="comment">// For each matrix block</span>
+00448 <a class="code" href="a04558.html#a15">uint</a> matrixBlock;
+00449 <a class="code" href="a04558.html#a15">uint</a> nbMatrixBlock=meshGeom-&gt;getNbMatrixBlock();
+00450 <span class="keywordflow">for</span> (matrixBlock=0; matrixBlock&lt;nbMatrixBlock; matrixBlock++)
+00451 {
+00452 <span class="comment">// For each render pass</span>
+00453 <a class="code" href="a04558.html#a15">uint</a> renderPass;
+00454 <a class="code" href="a04558.html#a15">uint</a> numRenderPass=meshGeom-&gt;getNbRdrPass(matrixBlock);
+00455 <span class="keywordflow">for</span> (renderPass=0; renderPass&lt;numRenderPass; renderPass++)
+00456 {
+00457 <span class="comment">// Render pass material</span>
+00458 <a class="code" href="a04558.html#a11">uint32</a> matId=meshGeom-&gt;getRdrPassMaterial(matrixBlock, renderPass);
+00459
+00460 <span class="comment">// Checks</span>
+00461 <a class="code" href="a04199.html#a6">nlassert</a> (matId&lt;meshBase-&gt;getNbMaterial());
+00462
+00463 <span class="comment">// Get the material</span>
+00464 <span class="keyword">const</span> CMaterial &amp;material=meshBase-&gt;getMaterial(matId);
+00465
+00466 <span class="comment">// Get the texture</span>
+00467 ITexture *texture=material.getTexture(0);
+00468 <span class="keywordflow">if</span> (texture)
+00469 {
+00470 <span class="comment">// Get its name</span>
+00471 std::string name;
+00472 <a class="code" href="a04558.html#a15">uint</a> i;
+00473 <span class="keywordflow">for</span> (i=0; i&lt;outputBitmapCount; i++)
+00474 {
+00475 <span class="comment">// Select the good slot</span>
+00476 texture-&gt;selectTexture (i);
+00477
+00478 <span class="comment">// Get its name</span>
+00479 <span class="keywordflow">if</span> (texture-&gt;supportSharing())
+00480 {
+00481 <span class="comment">// Get sharing name</span>
+00482 name+=<a class="code" href="a05378.html#a273">strlwr</a>(texture-&gt;getShareName());
+00483 }
+00484 <span class="keywordflow">else</span>
+00485 {
+00486 <span class="comment">// Build a name</span>
+00487 name+=<a class="code" href="a05378.html#a244">toString</a> ((<a class="code" href="a04558.html#a15">uint</a>)texture);
+00488 }
+00489 }
+00490
+00491 <span class="comment">// Find the texture</span>
+00492 MapBitmapDesc::const_iterator ite=desc.find (name);
+00493 <a class="code" href="a04199.html#a6">nlassert</a> (ite!=desc.end());
+00494
+00495 <span class="comment">// Descriptor ref</span>
+00496 <span class="keyword">const</span> CBitmapDesc&amp; descBitmap=ite-&gt;second;
+00497
+00498 <span class="comment">// Get primitives</span>
+00499 <span class="keyword">const</span> CPrimitiveBlock &amp;primitiveBlock=meshGeom-&gt;getRdrPassPrimitiveBlock(matrixBlock,renderPass);
+00500
+00501 <span class="comment">// Set of vertex to remap</span>
+00502 std::set&lt;uint&gt; vertexToRemap;
+00503
+00504 <span class="comment">// Remap triangles</span>
+00505 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a566">index</a>;
+00506 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> *indexPtr=primitiveBlock.getTriPointer();
+00507 <a class="code" href="a04558.html#a11">uint32</a> numIndex=3*primitiveBlock.getNumTri();
+00508 <span class="keywordflow">for</span> (<a class="code" href="a04223.html#a566">index</a>=0; <a class="code" href="a04223.html#a566">index</a>&lt;numIndex; <a class="code" href="a04223.html#a566">index</a>++)
+00509 vertexToRemap.insert (indexPtr[index]);
+00510
+00511 <span class="comment">// Remap quad</span>
+00512 indexPtr=primitiveBlock.getQuadPointer();
+00513 numIndex=4*primitiveBlock.getNumQuad();
+00514 <span class="keywordflow">for</span> (<a class="code" href="a04223.html#a566">index</a>=0; <a class="code" href="a04223.html#a566">index</a>&lt;numIndex; <a class="code" href="a04223.html#a566">index</a>++)
+00515 vertexToRemap.insert (indexPtr[index]);
+00516
+00517 <span class="comment">// Remap the vertex</span>
+00518 std::set&lt;uint&gt;::iterator iteRemap=vertexToRemap.begin();
+00519 <span class="keywordflow">while</span> (iteRemap!=vertexToRemap.end())
+00520 {
+00521 <span class="comment">// Remap the vertex</span>
+00522 <span class="keywordtype">float</span> *UVCoordinate=(<span class="keywordtype">float</span>*)vertexBuffer.getTexCoordPointer(*iteRemap);
+00523 UVCoordinate[0]=UVCoordinate[0]*descBitmap.FactorU+descBitmap.U;
+00524 UVCoordinate[1]=UVCoordinate[1]*descBitmap.FactorV+descBitmap.V;
+00525
+00526 <span class="comment">// Next vertex</span>
+00527 iteRemap++;
+00528 }
+00529 }
+00530 }
+00531 }
+00532 }
+00533 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr>The documentation for this class was generated from the following files:<ul>
+<li><a class="el" href="a05568.html">coarse_mesh_build.h</a><li><a class="el" href="a05567.html">coarse_mesh_build.cpp</a></ul>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:45:23 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>