aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/mesh__multi__lod__instance_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/mesh__multi__lod__instance_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/mesh__multi__lod__instance_8cpp-source.html369
1 files changed, 369 insertions, 0 deletions
diff --git a/docs/doxygen/nel/mesh__multi__lod__instance_8cpp-source.html b/docs/doxygen/nel/mesh__multi__lod__instance_8cpp-source.html
new file mode 100644
index 00000000..2f4a564a
--- /dev/null
+++ b/docs/doxygen/nel/mesh__multi__lod__instance_8cpp-source.html
@@ -0,0 +1,369 @@
+<!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>mesh_multi_lod_instance.cpp</h1><a href="mesh__multi__lod__instance_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="mesh__multi__lod__instance_8h.html">3d/mesh_multi_lod_instance.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="mesh__multi__lod_8h.html">3d/mesh_multi_lod.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="coarse__mesh__manager_8h.html">3d/coarse_mesh_manager.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font>
+00032
+00033 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font>
+00034
+00035 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00036
+00037 <font class="keyword">namespace </font>NL3D
+00038 {
+00039
+00040 <font class="comment">// ***************************************************************************</font>
+00041
+<a name="l00042"></a><a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#a0">00042</a> CMeshMultiLodInstance::CMeshMultiLodInstance ()
+00043 {
+00044 <font class="comment">// No flags</font>
+00045 <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o2">Flags</a>=0;
+00046 <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o7">_CoarseMeshDistance</a> = -1.f;
+00047 }
+00048
+00049 <font class="comment">// ***************************************************************************</font>
+00050
+<a name="l00051"></a><a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#a1">00051</a> CMeshMultiLodInstance::~CMeshMultiLodInstance ()
+00052 {
+00053 <font class="comment">// delete instances from manager</font>
+00054 <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#a3">deleteCoarseInstances</a>();
+00055 }
+00056
+00057
+00058 <font class="comment">// ***************************************************************************</font>
+00059
+<a name="l00060"></a><a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#d0">00060</a> <font class="keywordtype">void</font> CMeshMultiLodInstance::registerBasic()
+00061 {
+00062 CMOT::registerModel (<a class="code" href="namespaceNL3D.html#a144">MeshMultiLodInstanceId</a>, <a class="code" href="namespaceNL3D.html#a140">MeshBaseInstanceId</a>, CMeshMultiLodInstance::creator);
+00063 CMOT::registerObs (<a class="code" href="namespaceNL3D.html#a93">LoadBalancingTravId</a>, <a class="code" href="namespaceNL3D.html#a144">MeshMultiLodInstanceId</a>, CMeshMultiLodBalancingObs::creator);
+00064 CMOT::registerObs (<a class="code" href="namespaceNL3D.html#a25">ClipTravId</a>, <a class="code" href="namespaceNL3D.html#a144">MeshMultiLodInstanceId</a>, CMeshMultiLodClipObs::creator);
+00065 }
+00066
+00067
+00068 <font class="comment">// ***************************************************************************</font>
+<a name="l00069"></a><a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#a3">00069</a> <font class="keywordtype">void</font> CMeshMultiLodInstance::deleteCoarseInstances()
+00070 {
+00071 <font class="comment">// If at least one coarse instance is created</font>
+00072 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o2">Flags</a> &amp; (<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#s3s1">Coarse0Loaded</a>|<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#s3s2">Coarse1Loaded</a>) )
+00073 {
+00074 <font class="comment">// Cast shape</font>
+00075 <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#l0">CMeshMultiLod</a> *shape=safe_cast&lt;CMeshMultiLod*&gt; ((IShape*)<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00076
+00077 <font class="comment">// Manager pointer</font>
+00078 CCoarseMeshManager *manager;
+00079
+00080 <font class="comment">// Get the manager</font>
+00081 <font class="keywordflow">if</font> (shape-&gt;isStatic ())
+00082 manager=<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#a1">getScene</a>()-&gt;getStaticCoarseMeshManager ();
+00083 <font class="keywordflow">else</font>
+00084 manager=<a class="code" href="classNL3D_1_1CMeshBaseInstance.html#a1">getScene</a>()-&gt;getDynamicCoarseMeshManager ();
+00085
+00086 <font class="comment">// Manager ok ?</font>
+00087 <font class="keywordflow">if</font> (manager)
+00088 {
+00089 <font class="comment">// Coarse mesh loaded ?</font>
+00090 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o2">Flags</a>&amp;<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#s3s1">Coarse0Loaded</a>)
+00091 {
+00092 manager-&gt;removeMesh (<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o3">CoarseMeshId</a>[0]);
+00093 <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o2">Flags</a>&amp;= ~<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#s3s1">Coarse0Loaded</a>;
+00094 }
+00095 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o2">Flags</a>&amp;<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#s3s2">Coarse1Loaded</a>)
+00096 {
+00097 manager-&gt;removeMesh (<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o3">CoarseMeshId</a>[1]);
+00098 <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o2">Flags</a>&amp;= ~<a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#s3s2">Coarse1Loaded</a>;
+00099 }
+00100 }
+00101 }
+00102 }
+00103
+00104
+00105 <font class="comment">// ***************************************************************************</font>
+<a name="l00106"></a><a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#c0">00106</a> CRGBA CMeshMultiLodInstance::getCoarseMeshLighting()
+00107 {
+00108 CScene *scene= <a class="code" href="classNL3D_1_1CMeshBaseInstance.html#a1">getScene</a>();
+00109 <a class="code" href="debug_8h.html#a6">nlassert</a>(scene);
+00110
+00111 <font class="comment">// compute his sun contribution result, and update</font>
+00112 CRGBA sunContrib= scene-&gt;getSunDiffuse();
+00113 <font class="comment">// simulate/average diffuse lighting over the mesh by dividing diffuse by 2.</font>
+00114 sunContrib.modulateFromuiRGBOnly(sunContrib, <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#a4">getLightContribution</a>().SunContribution/2 );
+00115 <font class="comment">// Add Ambient</font>
+00116 sunContrib.addRGBOnly(sunContrib, scene-&gt;getSunAmbient());
+00117 sunContrib.A= 255;
+00118
+00119 <font class="keywordflow">return</font> sunContrib;
+00120 }
+00121
+00122
+00123 <font class="comment">// ***************************************************************************</font>
+<a name="l00124"></a><a class="code" href="classNL3D_1_1CMeshMultiLodClipObs.html#a0">00124</a> <font class="keywordtype">bool</font> CMeshMultiLodClipObs::clip(IBaseClipObs *caller)
+00125 {
+00126 <font class="comment">// Call Base method. If clipped</font>
+00127 <font class="keywordflow">if</font>( !CTransformShapeClipObs::clip(caller) )
+00128 {
+00129 <font class="comment">// If the clip is due to a DistMax reason, must delete Coarses instances.</font>
+00130 <font class="keywordflow">if</font>(CTransformShapeClipObs::isLastClipDueToDistMax())
+00131 {
+00132 CMeshMultiLodInstance *inst= (CMeshMultiLodInstance*)<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>;
+00133 inst-&gt;deleteCoarseInstances();
+00134 }
+00135
+00136 <font class="comment">// return result of clip</font>
+00137 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00138 }
+00139 <font class="keywordflow">else</font>
+00140 <font class="comment">// return result of clip</font>
+00141 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00142 }
+00143
+00144
+00145 <font class="comment">// ***************************************************************************</font>
+<a name="l00146"></a><a class="code" href="classNL3D_1_1CMeshMultiLodClipObs.html#a1">00146</a> <font class="keywordtype">void</font> CMeshMultiLodClipObs::forceClip(TClipReason clipReason)
+00147 {
+00148 <font class="comment">// If the clip is due to a DistMax reason, must delete Coarses instances.</font>
+00149 <font class="keywordflow">if</font>(clipReason == IBaseClipObs::DistMaxClip)
+00150 {
+00151 CMeshMultiLodInstance *inst= (CMeshMultiLodInstance*)<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>;
+00152 inst-&gt;deleteCoarseInstances();
+00153 }
+00154
+00155 <font class="comment">// Call Base method (traverse Sons)</font>
+00156 CTransformShapeClipObs::forceClip(clipReason);
+00157 }
+00158
+00159
+00160 <font class="comment">// ***************************************************************************</font>
+00161
+<a name="l00162"></a><a class="code" href="classNL3D_1_1CMeshMultiLodBalancingObs.html#a0">00162</a> <font class="keywordtype">void</font> CMeshMultiLodBalancingObs::traverse(IObs *caller)
+00163 {
+00164 <font class="comment">// Call previous</font>
+00165 CTransformShapeLoadBalancingObs::traverse (caller);
+00166
+00167 <font class="comment">// If this is the second pass of LoadBalancing, choose the Lods, according to getNumTrianglesAfterLoadBalancing()</font>
+00168 CLoadBalancingTrav *loadTrav= (CLoadBalancingTrav*)<a class="code" href="classNL3D_1_1IObs.html#m1">Trav</a>;
+00169 <font class="keywordflow">if</font>(loadTrav-&gt;getLoadPass()==1)
+00170 {
+00171 <font class="comment">// Get a pointer on the model</font>
+00172 CMeshMultiLodInstance *model=safe_cast&lt;CMeshMultiLodInstance*&gt; (Model);
+00173
+00174 <font class="comment">// Get a pointer on the shape</font>
+00175 CMeshMultiLod *shape=safe_cast&lt;CMeshMultiLod*&gt; ((IShape*)model-&gt;Shape);
+00176
+00177 <font class="comment">// Reset render pass</font>
+00178 model-&gt;setTransparency(<font class="keyword">false</font>);
+00179 model-&gt;setOpacity(<font class="keyword">false</font>);
+00180
+00181 <font class="comment">// Get the wanted number of polygons</font>
+00182 <font class="keywordtype">float</font> polygonCount=model-&gt;getNumTrianglesAfterLoadBalancing ();
+00183
+00184 <font class="comment">// Look for the good slot</font>
+00185 uint meshCount=shape-&gt;_MeshVector.size();
+00186 model-&gt;Lod0=0;
+00187 <font class="keywordflow">if</font> (meshCount&gt;1)
+00188 {
+00189 <font class="comment">// Look for good i</font>
+00190 <font class="keywordflow">while</font> ( polygonCount &lt; shape-&gt;_MeshVector[model-&gt;Lod0].EndPolygonCount )
+00191 {
+00192 model-&gt;Lod0++;
+00193 <font class="keywordflow">if</font> (model-&gt;Lod0==meshCount-1)
+00194 <font class="keywordflow">break</font>;
+00195 }
+00196 }
+00197
+00198 <font class="comment">// The slot</font>
+00199 CMeshMultiLod::CMeshSlot &amp;slot=shape-&gt;_MeshVector[model-&gt;Lod0];
+00200
+00201 <font class="comment">// Get the distance with polygon count</font>
+00202 <font class="keywordtype">float</font> distance=(polygonCount-slot.B)/slot.A;
+00203
+00204 <font class="comment">// Get the final polygon count</font>
+00205 <font class="keywordflow">if</font> (slot.MeshGeom)
+00206 model-&gt;PolygonCountLod0=slot.MeshGeom-&gt;getNumTriangles (distance);
+00207
+00208 <font class="comment">// Second slot in use ?</font>
+00209 model-&gt;Lod1=0xffffffff;
+00210
+00211 <font class="comment">// The next slot</font>
+00212 CMeshMultiLod::CMeshSlot *nextSlot=NULL;
+00213
+00214 <font class="comment">// Next slot exist ?</font>
+00215 <font class="keywordflow">if</font> (model-&gt;Lod0!=meshCount-1)
+00216 {
+00217 nextSlot=&amp;(shape-&gt;_MeshVector[model-&gt;Lod0+1]);
+00218 }
+00219
+00220 <font class="comment">// Max dist before blend</font>
+00221 <font class="keywordtype">float</font> startBlend;
+00222 <font class="keywordflow">if</font> (nextSlot)
+00223 startBlend=slot.DistMax-nextSlot-&gt;BlendLength;
+00224 <font class="keywordflow">else</font>
+00225 startBlend=slot.DistMax-slot.BlendLength;
+00226
+00227 <font class="comment">// In blend zone ?</font>
+00228 <font class="keywordflow">if</font> ( startBlend &lt; distance )
+00229 {
+00230 <font class="comment">// Alpha factor for main Lod</font>
+00231 model-&gt;BlendFactor = (slot.DistMax-distance)/(slot.DistMax-startBlend);
+00232 <font class="keywordflow">if</font> (model-&gt;BlendFactor&lt;0)
+00233 model-&gt;BlendFactor=0;
+00234 <a class="code" href="debug_8h.html#a6">nlassert</a> (model-&gt;BlendFactor&lt;=1);
+00235
+00236 <font class="comment">// Render this mesh</font>
+00237 <font class="keywordflow">if</font> (slot.MeshGeom)
+00238 {
+00239 <font class="keywordflow">if</font> (slot.Flags&amp;CMeshMultiLod::CMeshSlot::BlendOut)
+00240 {
+00241 <font class="comment">// Render the geom mesh with alpha blending with goodPolyCount</font>
+00242 model-&gt;setTransparency(<font class="keyword">true</font>);
+00243 model-&gt;Flags|=CMeshMultiLodInstance::Lod0Blend;
+00244 }
+00245 <font class="keywordflow">else</font>
+00246 {
+00247 <font class="comment">// Render the geom mesh without alpha blending with goodPolyCount</font>
+00248 model-&gt;setTransparency (slot.isTransparent());
+00249 model-&gt;setOpacity (slot.isOpaque());
+00250 model-&gt;Flags&amp;=~CMeshMultiLodInstance::Lod0Blend;
+00251 }
+00252 }
+00253 <font class="keywordflow">else</font>
+00254 model-&gt;Lod0=0xffffffff;
+00255
+00256 <font class="comment">// Next mesh, BlendIn actived ?</font>
+00257 <font class="keywordflow">if</font> (nextSlot &amp;&amp; shape-&gt;_MeshVector[model-&gt;Lod0+1].MeshGeom &amp;&amp; (nextSlot-&gt;Flags&amp;CMeshMultiLod::CMeshSlot::BlendIn))
+00258 {
+00259 <font class="comment">// Render the geom mesh with alpha blending with nextSlot-&gt;BeginPolygonCount</font>
+00260 model-&gt;PolygonCountLod1=nextSlot-&gt;MeshGeom-&gt;getNumTriangles (distance);
+00261 model-&gt;Lod1=model-&gt;Lod0+1;
+00262 model-&gt;setTransparency(<font class="keyword">true</font>);
+00263 }
+00264 }
+00265 <font class="keywordflow">else</font>
+00266 {
+00267 <font class="keywordflow">if</font> (slot.MeshGeom)
+00268 {
+00269 <font class="comment">// Render without blend with goodPolyCount</font>
+00270 model-&gt;setTransparency (slot.isTransparent());
+00271 model-&gt;setOpacity (slot.isOpaque());
+00272 model-&gt;Flags&amp;=~CMeshMultiLodInstance::Lod0Blend;
+00273 }
+00274 <font class="keywordflow">else</font>
+00275 model-&gt;Lod0=0xffffffff;
+00276 }
+00277 }
+00278 }
+00279
+00280 <font class="comment">// ***************************************************************************</font>
+<a name="l00281"></a><a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#a2">00281</a> <font class="keywordtype">void</font> CMeshMultiLodInstance::changeMRMDistanceSetup(<font class="keywordtype">float</font> distanceFinest, <font class="keywordtype">float</font> distanceMiddle, <font class="keywordtype">float</font> distanceCoarsest)
+00282 {
+00283 <font class="keywordflow">if</font>(Shape)
+00284 {
+00285 <font class="comment">// Get a pointer on the shape.</font>
+00286 <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#l0">CMeshMultiLod</a> *pMesh =safe_cast&lt;CMeshMultiLod*&gt; ((IShape*)<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00287 <font class="comment">// Affect the mesh directly.</font>
+00288 pMesh-&gt;changeMRMDistanceSetup(distanceFinest, distanceMiddle, distanceCoarsest);
+00289 }
+00290 }
+00291
+00292
+00293 <font class="comment">// ***************************************************************************</font>
+<a name="l00294"></a><a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#a7">00294</a> <font class="keywordtype">float</font> CMeshMultiLodInstance::getNumTriangles (<font class="keywordtype">float</font> distance)
+00295 {
+00296 <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#l0">CMeshMultiLod</a> *shape = safe_cast&lt;CMeshMultiLod*&gt; ((IShape*)<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00297 <font class="keywordflow">return</font> shape-&gt;getNumTrianglesWithCoarsestDist(distance, <a class="code" href="classNL3D_1_1CMeshMultiLodInstance.html#o7">_CoarseMeshDistance</a>);
+00298 }
+00299
+00300 } <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>