aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/coarse__mesh__manager_8cpp-source.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/coarse__mesh__manager_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'docs/doxygen/nel/coarse__mesh__manager_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/coarse__mesh__manager_8cpp-source.html696
1 files changed, 696 insertions, 0 deletions
diff --git a/docs/doxygen/nel/coarse__mesh__manager_8cpp-source.html b/docs/doxygen/nel/coarse__mesh__manager_8cpp-source.html
new file mode 100644
index 00000000..c84c7644
--- /dev/null
+++ b/docs/doxygen/nel/coarse__mesh__manager_8cpp-source.html
@@ -0,0 +1,696 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>coarse_mesh_manager.cpp</h1><a href="coarse__mesh__manager_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
+00008 <font class="comment"> *</font>
+00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00013 <font class="comment"> * any later version.</font>
+00014 <font class="comment"></font>
+00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00018 <font class="comment"> * General Public License for more details.</font>
+00019 <font class="comment"></font>
+00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00023 <font class="comment"> * MA 02111-1307, USA.</font>
+00024 <font class="comment"> */</font>
+00025
+00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
+00027
+00028 <font class="preprocessor">#include "<a class="code" href="coarse__mesh__manager_8h.html">3d/coarse_mesh_manager.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="mesh_8h.html">3d/mesh.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="texture__file_8h.html">3d/texture_file.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="hierarchical__timer_8h.html">nel/misc/hierarchical_timer.h</a>"</font>
+00032 <font class="preprocessor">#include "<a class="code" href="clip__trav_8h.html">3d/clip_trav.h</a>"</font>
+00033
+00034
+00035 <font class="keyword">namespace </font>NL3D
+00036 {
+00037
+00038
+00039 <a class="code" href="hierarchical__timer_8h.html#a6">H_AUTO_DECL</a>( NL3D_StaticLod_AddDelMesh )
+00040 <a class="code" href="hierarchical__timer_8h.html#a6">H_AUTO_DECL</a>( NL3D_StaticLod_UpdateMesh )
+00041
+00042
+00043 <font class="comment">// ***************************************************************************</font>
+00044
+<a name="l00045"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager.html#d0">00045</a> <font class="keywordtype">void</font> CCoarseMeshManager::registerBasic()
+00046 {
+00047 CMOT::registerModel (<a class="code" href="namespaceNL3D.html#a27">CoarseMeshManagerId</a>, <a class="code" href="namespaceNL3D.html#a276">TransformId</a>, CCoarseMeshManager::creator);
+00048 CMOT::registerObs (<a class="code" href="namespaceNL3D.html#a25">ClipTravId</a>, <a class="code" href="namespaceNL3D.html#a27">CoarseMeshManagerId</a>, CCoarseMeshClipObs::creator);
+00049 }
+00050
+00051 <font class="comment">// ***************************************************************************</font>
+00052
+<a name="l00053"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager.html#a0">00053</a> CCoarseMeshManager::CCoarseMeshManager()
+00054 {
+00055 <font class="comment">// Set as opaque</font>
+00056 <a class="code" href="classNL3D_1_1CTransform.html#a0">setTransparency</a> (<font class="keyword">false</font>);
+00057 <a class="code" href="classNL3D_1_1CTransform.html#a1">setOpacity</a> (<font class="keyword">true</font>);
+00058
+00059 <font class="comment">// ** Init texture</font>
+00060
+00061 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o1">_Texture</a>=<font class="keyword">new</font> CTextureFile ();
+00062
+00063 <font class="comment">// ** Init material</font>
+00064
+00065 <font class="comment">// Double sided</font>
+00066 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o2">_Material</a>.initUnlit ();
+00067 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o2">_Material</a>.setDoubleSided (<font class="keyword">true</font>);
+00068 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o2">_Material</a>.setAlphaTest (<font class="keyword">true</font>);
+00069 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o2">_Material</a>.setColor (CRGBA (255, 255, 255));
+00070 <font class="comment">// Init blend Factors, for possible Alpha transition</font>
+00071 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o2">_Material</a>.setSrcBlend(CMaterial::srcalpha);
+00072 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o2">_Material</a>.setDstBlend(CMaterial::invsrcalpha);
+00073
+00074 <font class="comment">// Texture</font>
+00075 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o2">_Material</a>.setTexture (0, <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o1">_Texture</a>);
+00076 }
+00077
+00078 <font class="comment">// ***************************************************************************</font>
+00079
+<a name="l00080"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager.html#a1">00080</a> <font class="keywordtype">void</font> CCoarseMeshManager::setTextureFile (<font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="cf__lexical_8cpp.html#a95">file</a>)
+00081 {
+00082 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o1">_Texture</a>-&gt;setFileName (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>);
+00083 }
+00084
+00085 <font class="comment">// ***************************************************************************</font>
+00086
+<a name="l00087"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager.html#a2">00087</a> uint64 CCoarseMeshManager::addMesh (<font class="keyword">const</font> CMeshGeom&amp; geom)
+00088 {
+00089 <a class="code" href="hierarchical__timer_8h.html#a7">H_AUTO_USE</a>( NL3D_StaticLod_AddDelMesh );
+00090
+00091 <font class="comment">// Get vertex buffer ref</font>
+00092 <font class="keyword">const</font> CVertexBuffer &amp;vertexBuffer=geom.getVertexBuffer();
+00093
+00094 <font class="comment">// *** Find the good render pass</font>
+00095
+00096 <font class="comment">// Normalized number of vertex</font>
+00097 uint32 renderPass = vertexBuffer.getNumVertices () / <a class="code" href="coarse__mesh__manager_8h.html#a2">NL3D_COARSEMESH_VERTEXBUFFER_GRANULARITY</a>;
+00098 <font class="keywordflow">if</font> (<a class="code" href="coarse__mesh__manager_8h.html#a1">NL3D_COARSEMESH_VERTEXBUFFER_GRANULARITY_MASK</a>&amp;vertexBuffer.getNumVertices ())
+00099 renderPass++;
+00100
+00101 <font class="comment">// Look for the good rendering pass</font>
+00102 TRenderingPassMap::iterator ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.find (renderPass);
+00103
+00104 <font class="comment">// Not found ?</font>
+00105 <font class="keywordflow">if</font> ( ite==<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.end() )
+00106 {
+00107 <font class="comment">// Add the rendering pass</font>
+00108 <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.insert (TRenderingPassMap::value_type (renderPass, CRenderPass()));
+00109 ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.find (renderPass);
+00110 ite-&gt;second.init (renderPass*<a class="code" href="coarse__mesh__manager_8h.html#a2">NL3D_COARSEMESH_VERTEXBUFFER_GRANULARITY</a>);
+00111 }
+00112
+00113 <font class="comment">// Ok, add the mesh</font>
+00114 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>=ite-&gt;second.addMesh (geom);
+00115 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>==CRenderPass::CantAddMesh)
+00116 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#s1s0">CantAddCoarseMesh</a>;
+00117 <font class="keywordflow">else</font>
+00118 <font class="comment">// Return an id</font>
+00119 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#f0">buildId</a> (renderPass, <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+00120 }
+00121
+00122 <font class="comment">// ***************************************************************************</font>
+00123
+<a name="l00124"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager.html#a3">00124</a> <font class="keywordtype">void</font> CCoarseMeshManager::removeMesh (uint64 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
+00125 {
+00126 <a class="code" href="hierarchical__timer_8h.html#a7">H_AUTO_USE</a>( NL3D_StaticLod_AddDelMesh );
+00127
+00128 <font class="comment">// Get the render pass id</font>
+00129 uint32 renderPass = <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#f1">getRenderPassId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+00130
+00131 <font class="comment">// Find the render pass</font>
+00132 TRenderingPassMap::iterator ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.find (renderPass);
+00133
+00134 <font class="comment">// Not found ?</font>
+00135 <a class="code" href="debug_8h.html#a6">nlassert</a> ( ite!=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.end() );
+00136
+00137 <font class="comment">// remove it</font>
+00138 ite-&gt;second.removeMesh (<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#f2">getRenderPassMeshId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>));
+00139 }
+00140
+00141 <font class="comment">// ***************************************************************************</font>
+00142
+<a name="l00143"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager.html#a4">00143</a> <font class="keywordtype">void</font> CCoarseMeshManager::setMatrixMesh (uint64 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, <font class="keyword">const</font> CMeshGeom&amp; geom, <font class="keyword">const</font> CMatrix&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a370">matrix</a>)
+00144 {
+00145 <a class="code" href="hierarchical__timer_8h.html#a7">H_AUTO_USE</a>( NL3D_StaticLod_UpdateMesh );
+00146
+00147 <font class="comment">// Get the render pass id</font>
+00148 uint32 renderPass = <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#f1">getRenderPassId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+00149
+00150 <font class="comment">// Find the render pass</font>
+00151 TRenderingPassMap::iterator ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.find (renderPass);
+00152
+00153 <font class="comment">// Not found ?</font>
+00154 <a class="code" href="debug_8h.html#a6">nlassert</a> ( ite!=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.end() );
+00155
+00156 <font class="comment">// remove it</font>
+00157 ite-&gt;second.setMatrixMesh (<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#f2">getRenderPassMeshId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>), geom, <a class="code" href="driver__opengl__extension__def_8h.html#a370">matrix</a>);
+00158 }
+00159
+00160 <font class="comment">// ***************************************************************************</font>
+00161
+<a name="l00162"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager.html#a5">00162</a> <font class="keywordtype">void</font> CCoarseMeshManager::setColorMesh (uint64 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, <font class="keyword">const</font> CMeshGeom&amp; geom, <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> color)
+00163 {
+00164 <a class="code" href="hierarchical__timer_8h.html#a7">H_AUTO_USE</a>( NL3D_StaticLod_UpdateMesh );
+00165
+00166 <font class="comment">// Get the render pass id</font>
+00167 uint32 renderPass = <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#f1">getRenderPassId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+00168
+00169 <font class="comment">// Find the render pass</font>
+00170 TRenderingPassMap::iterator ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.find (renderPass);
+00171
+00172 <font class="comment">// Not found ?</font>
+00173 <a class="code" href="debug_8h.html#a6">nlassert</a> ( ite!=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.end() );
+00174
+00175 <font class="comment">// remove it</font>
+00176 ite-&gt;second.setColorMesh (<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#f2">getRenderPassMeshId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>), geom.getVertexBuffer().getNumVertices(), color);
+00177 }
+00178
+00179 <font class="comment">// ***************************************************************************</font>
+00180
+<a name="l00181"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager.html#a6">00181</a> <font class="keywordtype">void</font> CCoarseMeshManager::render (IDriver *drv)
+00182 {
+00183 <a class="code" href="hierarchical__timer_8h.html#a4">H_AUTO</a>( NL3D_StaticLod_Render );
+00184
+00185 <font class="comment">// Set Ident matrix</font>
+00186 drv-&gt;setupModelMatrix (CMatrix::Identity);
+00187
+00188 <font class="comment">// Render each render pass</font>
+00189 TRenderingPassMap::iterator ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.begin ();
+00190 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o0">_RenderPass</a>.end())
+00191 {
+00192 <font class="comment">// Render the rendering pass</font>
+00193 ite-&gt;second.render (drv, <a class="code" href="classNL3D_1_1CCoarseMeshManager.html#o2">_Material</a>);
+00194
+00195 <font class="comment">// Next render pass</font>
+00196 ite++;
+00197 }
+00198 }
+00199
+00200 <font class="comment">// ***************************************************************************</font>
+00201
+<a name="l00202"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#a0">00202</a> <font class="keywordtype">void</font> CCoarseMeshManager::CRenderPass::init (uint blockSize)
+00203 {
+00204 <font class="comment">// Block size</font>
+00205 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a> = blockSize;
+00206
+00207 <font class="comment">// Set vertex type</font>
+00208 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.setVertexFormat (<a class="code" href="coarse__mesh__manager_8h.html#a4">NL3D_COARSEMESH_VERTEX_FORMAT_MGR</a>);
+00209
+00210 <font class="comment">// Reserve the vertex buffer</font>
+00211 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.reserve (<a class="code" href="coarse__mesh__manager_8h.html#a3">NL3D_COARSEMESH_VERTEXBUFFER_RESERVE</a>*<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a>);
+00212 }
+00213
+00214 <font class="comment">// ***************************************************************************</font>
+00215
+<a name="l00216"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#a1">00216</a> uint32 CCoarseMeshManager::CRenderPass::addMesh (<font class="keyword">const</font> CMeshGeom&amp; geom)
+00217 {
+00218 <font class="comment">// Is there a free vertex buffer ?</font>
+00219 uint16 vertexBufferId;
+00220 <a class="code" href="classstd_1_1list.html">std::list&lt; uint16 &gt;</a>::iterator iteBegin=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o2">FreeVBlock</a>.begin();
+00221 <font class="keywordflow">if</font> (iteBegin != <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o2">FreeVBlock</a>.end())
+00222 {
+00223 <font class="comment">// Get a free id</font>
+00224 vertexBufferId=*iteBegin;
+00225 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o2">FreeVBlock</a>.erase (iteBegin);
+00226 }
+00227 <font class="keywordflow">else</font>
+00228 {
+00229 <font class="comment">// Number of vertex in the vertex buffer</font>
+00230 uint vertexCount=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getNumVertices ();
+00231
+00232 <font class="comment">// Is the vertex buffer filled ?</font>
+00233 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.capacity () == vertexCount)
+00234 {
+00235 <font class="comment">// Double it's capacity</font>
+00236 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.reserve (vertexCount*2);
+00237 }
+00238
+00239 <font class="comment">// *** Make a new block</font>
+00240
+00241 <font class="comment">// Resize the vertex buffer</font>
+00242 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.setNumVertices (vertexCount+<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a>);
+00243
+00244 <font class="comment">// Set mesh id</font>
+00245 vertexBufferId = vertexCount / <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a>;
+00246 }
+00247
+00248 <font class="comment">// *** Copy the vertices</font>
+00249
+00250 <font class="comment">// Src vertex buffer</font>
+00251 <font class="keyword">const</font> CVertexBuffer &amp;vbSrc=geom.getVertexBuffer();
+00252
+00253 <font class="comment">// Check the vertex format</font>
+00254 <a class="code" href="debug_8h.html#a6">nlassert</a> (vbSrc.getVertexFormat() &amp; (CVertexBuffer::PositionFlag|CVertexBuffer::TexCoord0Flag) );
+00255
+00256 <font class="comment">// Number of source vertex</font>
+00257 uint32 nbVSrc = vbSrc.getNumVertices();
+00258 <a class="code" href="debug_8h.html#a6">nlassert</a> (nbVSrc&lt;=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a>);
+00259
+00260 <font class="comment">// First vertex index</font>
+00261 uint firstVertex=vertexBufferId*<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a>;
+00262
+00263 <font class="comment">// Copy vector</font>
+00264 <font class="keyword">const</font> <font class="keywordtype">void</font> *vSrc = vbSrc.getVertexCoordPointer (0);
+00265 <font class="keywordtype">void</font> *vDest = <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getVertexCoordPointer (firstVertex);
+00266
+00267 <font class="comment">// Copy it</font>
+00268 <font class="keywordflow">for</font>(uint i=0; i&lt;nbVSrc;i++)
+00269 {
+00270 CVector &amp;dstPos= *(CVector*)vDest;
+00271 CUV &amp;dstUV= *(CUV*) ((uint8*)vDest + <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getTexCoordOff() );
+00272 CRGBA &amp;dstRGBA= *(CRGBA*) ((uint8*)vDest + <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getColorOff() );
+00273 CVector &amp;srcPos= *(CVector*)vSrc;
+00274 CUV &amp;srcUV= *(CUV*) ((uint8*)vSrc + <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getTexCoordOff() );
+00275
+00276 <font class="comment">// copy color/uv</font>
+00277 dstPos= srcPos;
+00278 dstUV= srcUV;
+00279 <font class="comment">// init color to full white</font>
+00280 dstRGBA= CRGBA::White;
+00281
+00282 <font class="comment">// next</font>
+00283 vSrc= (uint8*)vSrc + vbSrc.getVertexSize();
+00284 vDest= (uint8*)vDest + <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getVertexSize();
+00285 }
+00286
+00287 <font class="comment">// *** Setup primitives indexes</font>
+00288
+00289 <font class="comment">// Get number of tri in this geom</font>
+00290 uint triCount=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#a2">getTriCount</a> (geom);
+00291
+00292 <font class="comment">// Try to add the primitive in a primitive blocks</font>
+00293 <font class="keywordtype">bool</font> added=<font class="keyword">false</font>;
+00294 uint16 primitiveBlockId=0;
+00295 <a class="code" href="classstd_1_1list.html">std::list&lt; CPrimitiveBlockInfo &gt;</a>::iterator ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o3">PrimitiveBlockInfoList</a>.begin();
+00296 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o3">PrimitiveBlockInfoList</a>.end())
+00297 {
+00298 <font class="comment">// Add it</font>
+00299 <font class="keywordflow">if</font> ( (ite-&gt;addMesh (vertexBufferId, geom, firstVertex, triCount)) != CPrimitiveBlockInfo::Failed )
+00300 {
+00301 added=<font class="keyword">true</font>;
+00302 <font class="keywordflow">break</font>;
+00303 }
+00304
+00305 <font class="comment">// Next primitive block</font>
+00306 ite++;
+00307 primitiveBlockId++;
+00308 }
+00309
+00310 <font class="comment">// Can't be added ?</font>
+00311 <font class="keywordflow">if</font> (ite==<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o3">PrimitiveBlockInfoList</a>.end())
+00312 {
+00313 <font class="comment">// Add a primitive block</font>
+00314 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o3">PrimitiveBlockInfoList</a>.push_back (CPrimitiveBlockInfo());
+00315 ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o3">PrimitiveBlockInfoList</a>.end();
+00316 ite--;
+00317
+00318 <font class="comment">// Resize it</font>
+00319 ite-&gt;init (<a class="code" href="coarse__mesh__manager_8h.html#a6">NL3D_COARSEMESH_PRIMITIVE_BLOCK_SIZE</a>);
+00320
+00321 <font class="comment">// Add the mesh</font>
+00322 <font class="keywordflow">if</font> (ite-&gt;addMesh (vertexBufferId, geom, firstVertex, triCount)!=CPrimitiveBlockInfo::Failed)
+00323 added=<font class="keyword">true</font>;
+00324 }
+00325
+00326 <font class="comment">// Can be added ?</font>
+00327 <font class="keywordflow">if</font> (!added)
+00328 <font class="comment">// Return error</font>
+00329 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#s1s0">CantAddMesh</a>;
+00330
+00331 <font class="comment">// Return an id</font>
+00332 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#f0">buildId</a> (primitiveBlockId, vertexBufferId);
+00333 }
+00334
+00335 <font class="comment">// ***************************************************************************</font>
+00336
+<a name="l00337"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#a2">00337</a> uint CCoarseMeshManager::CRenderPass::getTriCount (<font class="keyword">const</font> CMeshGeom&amp; geom)
+00338 {
+00339 <font class="comment">// Check count</font>
+00340 uint count = 0;
+00341
+00342 <font class="comment">// Count number of triangles</font>
+00343 uint numMatrixBlock=geom.getNbMatrixBlock();
+00344 uint matrixBlock;
+00345 <font class="keywordflow">for</font> (matrixBlock=0; matrixBlock&lt;numMatrixBlock; matrixBlock++)
+00346 {
+00347 <font class="comment">// One render pass</font>
+00348 uint numRenderPass=geom.getNbRdrPass (matrixBlock);
+00349 uint renderPass;
+00350 <font class="keywordflow">for</font> (renderPass=0; renderPass&lt;numRenderPass; renderPass++)
+00351 {
+00352 <font class="comment">// Get the render pass</font>
+00353 <font class="keyword">const</font> CPrimitiveBlock &amp;pBlock=geom.getRdrPassPrimitiveBlock (matrixBlock, renderPass);
+00354
+00355 <font class="comment">// Check there is enought room to insert this primitives</font>
+00356 uint renderPassNumTri=pBlock.getNumTri ();
+00357 count+=renderPassNumTri;
+00358 }
+00359 }
+00360
+00361 <font class="comment">// Return count</font>
+00362 <font class="keywordflow">return</font> count;
+00363 }
+00364
+00365 <font class="comment">// ***************************************************************************</font>
+00366
+<a name="l00367"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#a3">00367</a> <font class="keywordtype">void</font> CCoarseMeshManager::CRenderPass::removeMesh (uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
+00368 {
+00369 <font class="comment">// Get ids</font>
+00370 uint16 primitiveBlockId=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#f1">getPrimitiveblockId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+00371 uint16 vertexBufferId=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#f2">getVertexBufferId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+00372
+00373 <font class="comment">// *** Free the vertex buffer</font>
+00374 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o2">FreeVBlock</a>.push_back (vertexBufferId);
+00375
+00376 <font class="comment">// *** Remove the primitive block</font>
+00377
+00378 <font class="comment">// Find the primitive block</font>
+00379 <a class="code" href="classstd_1_1list.html">std::list&lt; CPrimitiveBlockInfo &gt;</a>::iterator ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o3">PrimitiveBlockInfoList</a>.begin();
+00380 <font class="keywordflow">for</font> (uint i=0; i&lt;primitiveBlockId; i++)
+00381 ite++;
+00382
+00383 <font class="comment">// Some checks</font>
+00384 <a class="code" href="debug_8h.html#a6">nlassert</a> (ite!=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o3">PrimitiveBlockInfoList</a>.end());
+00385
+00386 <font class="comment">// Remove from there</font>
+00387 ite-&gt;removeMesh (vertexBufferId);
+00388 }
+00389
+00390 <font class="comment">// ***************************************************************************</font>
+00391
+<a name="l00392"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#a4">00392</a> <font class="keywordtype">void</font> CCoarseMeshManager::CRenderPass::setMatrixMesh (uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, <font class="keyword">const</font> CMeshGeom&amp; geom, <font class="keyword">const</font> CMatrix&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a370">matrix</a>)
+00393 {
+00394 <font class="comment">// Is there a free vertex buffer ?</font>
+00395 uint16 vertexBufferId=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#f2">getVertexBufferId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+00396
+00397 <font class="comment">// *** Transform the vertices</font>
+00398
+00399 <font class="comment">// Src vertex buffer</font>
+00400 <font class="keyword">const</font> CVertexBuffer &amp;vbSrc=geom.getVertexBuffer();
+00401
+00402 <font class="comment">// Check the vertex format</font>
+00403 <a class="code" href="debug_8h.html#a6">nlassert</a> (vbSrc.getVertexFormat() &amp; (CVertexBuffer::PositionFlag|CVertexBuffer::TexCoord0Flag) );
+00404
+00405 <font class="comment">// Number of source vertices</font>
+00406 uint32 nbVSrc = vbSrc.getNumVertices();
+00407 <a class="code" href="debug_8h.html#a6">nlassert</a> (nbVSrc&lt;=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a>);
+00408 <font class="comment">//int normalOffset = vbSrc.getNormalOff();</font>
+00409
+00410 <font class="comment">// Vertex size</font>
+00411 uint vtSrcSize=vbSrc.getVertexSize ();
+00412 uint vtDstSize=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getVertexSize ();
+00413
+00414 <font class="comment">// Copy vector</font>
+00415 <font class="keyword">const</font> uint8 *vSrc = (<font class="keyword">const</font> uint8 *)vbSrc.getVertexCoordPointer (0);
+00416 uint8 *vDest = (uint8 *)<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getVertexCoordPointer (vertexBufferId*<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a>);
+00417
+00418 <font class="comment">// Transform it</font>
+00419 <font class="keywordflow">for</font> (uint i=0; i&lt;nbVSrc; i++)
+00420 {
+00421 <font class="comment">// Transform position</font>
+00422 *(CVector*)vDest = <a class="code" href="driver__opengl__extension__def_8h.html#a370">matrix</a>.mulPoint (*(<font class="keyword">const</font> CVector*)vSrc);
+00423
+00424 <font class="comment">// Transform normal</font>
+00425 <font class="comment">// *(CVector*)(vDest+normalOffset) = matrix.mulVector (*(const CVector*)(vSrc+normalOffset));</font>
+00426
+00427 <font class="comment">// Next point</font>
+00428 vSrc+=vtSrcSize;
+00429 vDest+=vtDstSize;
+00430 }
+00431 }
+00432
+00433 <font class="comment">// ***************************************************************************</font>
+00434
+<a name="l00435"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#a5">00435</a> <font class="keywordtype">void</font> CCoarseMeshManager::CRenderPass::setColorMesh (uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, uint nVertices, CRGBA color)
+00436 {
+00437 <font class="comment">// Is there a free vertex buffer ?</font>
+00438 uint16 vertexBufferId=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#f2">getVertexBufferId</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+00439
+00440 <font class="comment">// *** Copy color to vertices</font>
+00441
+00442 <font class="comment">// Number of source vertices</font>
+00443 uint32 nbVSrc = nVertices;
+00444 <a class="code" href="debug_8h.html#a6">nlassert</a> (nbVSrc&lt;=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a>);
+00445
+00446 <font class="comment">// Vertex size</font>
+00447 uint vtDstSize=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getVertexSize ();
+00448
+00449 <font class="comment">// Copy vector</font>
+00450 uint8 *vDest = (uint8 *)<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getVertexCoordPointer (vertexBufferId*<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o0">VBlockSize</a>);
+00451 vDest+= <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>.getColorOff();
+00452
+00453 <font class="comment">// Transform it</font>
+00454 <font class="keywordflow">for</font> (uint i=0; i&lt;nbVSrc; i++)
+00455 {
+00456 <font class="comment">// Transform position</font>
+00457 *(CRGBA*)vDest = color;
+00458
+00459 <font class="comment">// Next point</font>
+00460 vDest+=vtDstSize;
+00461 }
+00462 }
+00463
+00464 <font class="comment">// ***************************************************************************</font>
+00465
+<a name="l00466"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#a6">00466</a> <font class="keywordtype">void</font> CCoarseMeshManager::CRenderPass::render (IDriver *drv, CMaterial&amp; mat)
+00467 {
+00468 <font class="comment">// Active the vertex buffer</font>
+00469 drv-&gt;activeVertexBuffer (<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o1">VBuffer</a>);
+00470
+00471 <font class="comment">// For each primitive block</font>
+00472 <a class="code" href="classstd_1_1list.html">std::list&lt; CPrimitiveBlockInfo &gt;</a>::iterator ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o3">PrimitiveBlockInfoList</a>.begin();
+00473 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass.html#o3">PrimitiveBlockInfoList</a>.end())
+00474 {
+00475 <font class="comment">// Render it</font>
+00476 drv-&gt;render (ite-&gt;PrimitiveBlock, mat);
+00477
+00478 <font class="comment">// Next primitive block</font>
+00479 ite++;
+00480 }
+00481 }
+00482
+00483 <font class="comment">// ***************************************************************************</font>
+00484
+<a name="l00485"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#a0">00485</a> uint CCoarseMeshManager::CRenderPass::CPrimitiveBlockInfo::addMesh (uint16 vertexBufferId, <font class="keyword">const</font> CMeshGeom&amp; geom, uint32 firstVertexIndex, uint triCount)
+00486 {
+00487 <font class="comment">// Get num tri in the primitive block</font>
+00488 uint oldNumTri=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.getNumTri();
+00489
+00490 <font class="comment">// Check capacity</font>
+00491 <font class="keywordflow">if</font> ( triCount &lt;= (<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.capacityTri()-oldNumTri) )
+00492 {
+00493 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00494 <font class="preprocessor"></font> <font class="comment">// Check count</font>
+00495 uint checkCount = 0;
+00496 <font class="preprocessor">#endif // NL_DEBUG</font>
+00497 <font class="preprocessor"></font>
+00498 <font class="comment">// Resize pblock</font>
+00499 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.setNumTri (oldNumTri+triCount);
+00500
+00501 <font class="comment">// Destination pointer </font>
+00502 uint32 *pTriDest=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.getTriPointer ()+3*oldNumTri;
+00503
+00504 <font class="comment">// First index for the object</font>
+00505 uint firstIndex=firstVertexIndex;
+00506
+00507 <font class="comment">// Count number of triangles</font>
+00508 uint numMatrixBlock=geom.getNbMatrixBlock();
+00509 uint matrixBlock;
+00510 <font class="keywordflow">for</font> (matrixBlock=0; matrixBlock&lt;numMatrixBlock; matrixBlock++)
+00511 {
+00512 <font class="comment">// One render pass</font>
+00513 uint numRenderPass=geom.getNbRdrPass (matrixBlock);
+00514 uint renderPass;
+00515 <font class="keywordflow">for</font> (renderPass=0; renderPass&lt;numRenderPass; renderPass++)
+00516 {
+00517 <font class="comment">// Get the render pass</font>
+00518 <font class="keyword">const</font> CPrimitiveBlock &amp;pBlock=geom.getRdrPassPrimitiveBlock (matrixBlock, renderPass);
+00519
+00520 <font class="comment">// Check there is enought room to insert this primitives</font>
+00521 uint renderPassNumIndex=3*pBlock.getNumTri ();
+00522 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00523 <font class="preprocessor"></font> checkCount+=pBlock.getNumTri ();
+00524 <font class="preprocessor">#endif // NL_DEBUG</font>
+00525 <font class="preprocessor"></font>
+00526 <font class="comment">// Tri pointer</font>
+00527 <font class="keyword">const</font> uint32 *pTriSrc=pBlock.getTriPointer ();
+00528
+00529 <font class="comment">// Insert and remap indexes</font>
+00530 <font class="keywordflow">for</font> (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>&lt;renderPassNumIndex; <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>++)
+00531 {
+00532 <font class="comment">// Copy and remap the vertex indexes</font>
+00533 *pTriDest=pTriSrc[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]+firstIndex;
+00534 pTriDest++;
+00535 }
+00536 }
+00537 }
+00538
+00539 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00540 <font class="preprocessor"></font> <font class="comment">// Checks</font>
+00541 <a class="code" href="debug_8h.html#a6">nlassert</a> (checkCount==triCount);
+00542 <font class="preprocessor">#endif // NL_DEBUG</font>
+00543 <font class="preprocessor"></font>
+00544 <font class="comment">// Add a mesh info in the list</font>
+00545 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m1">MeshIdList</a>.push_back (CMeshInfo (oldNumTri, triCount, vertexBufferId));
+00546
+00547 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#s2s1">Success</a>;
+00548 }
+00549 <font class="keywordflow">else</font>
+00550 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#s2s0">Failed</a>;
+00551 }
+00552
+00553 <font class="comment">// ***************************************************************************</font>
+00554
+<a name="l00555"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#a1">00555</a> <font class="keywordtype">void</font> CCoarseMeshManager::CRenderPass::CPrimitiveBlockInfo::removeMesh (uint16 vertexBufferId)
+00556 {
+00557 <font class="comment">// Get mesh info</font>
+00558 <a class="code" href="classstd_1_1list.html">std::list&lt; CMeshInfo &gt;</a>::iterator ite=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m1">MeshIdList</a>.begin();
+00559 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m1">MeshIdList</a>.end())
+00560 {
+00561 <font class="comment">// Good geom ?</font>
+00562 <font class="keywordflow">if</font> (ite-&gt;VertexBufferId == vertexBufferId)
+00563 {
+00564 <font class="comment">// Remove indexes of this primitive</font>
+00565 uint numIndexLeft=(<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.getNumTri()-(ite-&gt;Offset+ite-&gt;Length))*3;
+00566
+00567 <font class="comment">// Source triangles</font>
+00568 <font class="keyword">const</font> uint32 *pTriSrc=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.getTriPointer ()+3*(ite-&gt;Offset+ite-&gt;Length);
+00569
+00570 <font class="comment">// Destination triangles</font>
+00571 uint32 *pTriDest=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.getTriPointer ()+3*ite-&gt;Offset;
+00572
+00573 <font class="comment">// Copy indexes</font>
+00574 <font class="keywordflow">for</font> (uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=0; <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>&lt;numIndexLeft; <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>++)
+00575 {
+00576 pTriDest[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]=pTriSrc[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>];
+00577 }
+00578
+00579 <font class="comment">// Resize primitive block</font>
+00580 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.setNumTri (<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.getNumTri()-ite-&gt;Length);
+00581
+00582 <font class="comment">// Backup iterator</font>
+00583 <a class="code" href="classstd_1_1list.html">std::list&lt; CMeshInfo &gt;</a>::iterator iteOther=ite;
+00584
+00585 <font class="comment">// Patch offset for each others meshes in the primitive block</font>
+00586 <font class="keywordflow">while</font> (iteOther!=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m1">MeshIdList</a>.end())
+00587 {
+00588 <font class="comment">// Remap offset</font>
+00589 iteOther-&gt;Offset-=ite-&gt;Length;
+00590
+00591 <font class="comment">// Next mesh</font>
+00592 iteOther++;
+00593 }
+00594
+00595 <font class="comment">// Remove info from list</font>
+00596 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m1">MeshIdList</a>.erase (ite);
+00597
+00598 <font class="comment">// Exit</font>
+00599 <font class="keywordflow">return</font>;
+00600 }
+00601
+00602 <font class="comment">// Next </font>
+00603 ite++;
+00604 }
+00605
+00606 <font class="comment">// Check it has been found</font>
+00607 <a class="code" href="debug_8h.html#a6">nlassert</a> (ite!=<a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m1">MeshIdList</a>.end());
+00608 }
+00609
+00610 <font class="comment">// ***************************************************************************</font>
+00611
+<a name="l00612"></a><a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#a2">00612</a> <font class="keywordtype">void</font> CCoarseMeshManager::CRenderPass::CPrimitiveBlockInfo::init (uint size)
+00613 {
+00614 <font class="comment">// Reserve triangles</font>
+00615 <a class="code" href="classNL3D_1_1CCoarseMeshManager_1_1CRenderPass_1_1CPrimitiveBlockInfo.html#m0">PrimitiveBlock</a>.reserveTri (size);
+00616 }
+00617
+00618 <font class="comment">// ***************************************************************************</font>
+00619
+<a name="l00620"></a><a class="code" href="classNL3D_1_1CCoarseMeshClipObs.html#z398_0">00620</a> <font class="keywordtype">bool</font> CCoarseMeshClipObs::clip(IBaseClipObs *caller)
+00621 {
+00622 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00623 }
+00624
+00625 <font class="comment">// ***************************************************************************</font>
+00626
+00627 } <font class="comment">// NL3D</font>
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>