diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/scene__group_8cpp-source.html | 1271 |
1 files changed, 1271 insertions, 0 deletions
diff --git a/docs/doxygen/nel/scene__group_8cpp-source.html b/docs/doxygen/nel/scene__group_8cpp-source.html new file mode 100644 index 00000000..71306eaa --- /dev/null +++ b/docs/doxygen/nel/scene__group_8cpp-source.html @@ -0,0 +1,1271 @@ +<!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> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </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> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </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> + + +<!-- 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> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <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> </center> +<hr><h1>scene_group.cpp</h1><a href="scene__group_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="scene__group_8h.html">3d/scene_group.h</a>"</font> +00029 <font class="preprocessor">#include "<a class="code" href="stream_8h.html">nel/misc/stream.h</a>"</font> +00030 <font class="preprocessor">#include "<a class="code" href="matrix_8h.html">nel/misc/matrix.h</a>"</font> +00031 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font> +00032 <font class="preprocessor">#include "<a class="code" href="transform__shape_8h.html">3d/transform_shape.h</a>"</font> +00033 <font class="preprocessor">#include "<a class="code" href="mesh__instance_8h.html">3d/mesh_instance.h</a>"</font> +00034 <font class="preprocessor">#include "<a class="code" href="shape__bank_8h.html">3d/shape_bank.h</a>"</font> +00035 <font class="preprocessor">#include "<a class="code" href="u__instance__group_8h.html">nel/3d/u_instance_group.h</a>"</font> +00036 +00037 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC; +00038 <font class="keyword">using</font> <font class="keyword">namespace </font>std; +00039 +00040 <font class="keyword">namespace </font>NL3D +00041 { +00042 +00043 <font class="comment">// ---------------------------------------------------------------------------</font> +00044 <font class="comment">// CInstance</font> +00045 <font class="comment">// ---------------------------------------------------------------------------</font> +00046 +00047 <font class="comment">// ***************************************************************************</font> +<a name="l00048"></a><a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#a0">00048</a> CInstanceGroup::CInstance::CInstance () +00049 { +00050 <a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m7">DontAddToScene</a> = <font class="keyword">false</font>; +00051 <a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m9">AvoidStaticLightPreCompute</a>= <font class="keyword">false</font>; +00052 <a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m10">StaticLightEnabled</a>= <font class="keyword">false</font>; +00053 <a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m8">DontCastShadow</a>= <font class="keyword">false</font>; +00054 <a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m13">LocalAmbientId</a>= 0xFF; +00055 } +00056 +00057 <font class="comment">// ***************************************************************************</font> +<a name="l00058"></a><a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#a1">00058</a> <font class="keywordtype">void</font> CInstanceGroup::CInstance::serial (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>& f) +00059 { +00060 <font class="comment">/*</font> +00061 <font class="comment"> Version 4:</font> +00062 <font class="comment"> - LocalAmbientId.</font> +00063 <font class="comment"> Version 3:</font> +00064 <font class="comment"> - StaticLight.</font> +00065 <font class="comment"> Version 2:</font> +00066 <font class="comment"> - gameDev data.</font> +00067 <font class="comment"> Version 1:</font> +00068 <font class="comment"> - Clusters</font> +00069 <font class="comment"> */</font> +00070 <font class="comment">// Serial a version number</font> +00071 sint version=f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a> (4); +00072 +00073 +00074 <font class="comment">// Serial the LocalAmbientId.</font> +00075 <font class="keywordflow">if</font> (version >= 4) +00076 { +00077 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m13">LocalAmbientId</a>); +00078 } +00079 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00080 { +00081 <a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m13">LocalAmbientId</a>= 0xFF; +00082 } +00083 +00084 <font class="comment">// Serial the StaticLight</font> +00085 <font class="keywordflow">if</font> (version >= 3) +00086 { +00087 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m9">AvoidStaticLightPreCompute</a>); +00088 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m8">DontCastShadow</a>); +00089 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m10">StaticLightEnabled</a>); +00090 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m11">SunContribution</a>); +00091 <a class="code" href="debug_8h.html#a6">nlassert</a>(CInstanceGroup::NumStaticLightPerInstance==2); +00092 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m12">Light</a>[0]); +00093 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m12">Light</a>[1]); +00094 } +00095 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00096 { +00097 <a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m9">AvoidStaticLightPreCompute</a>= <font class="keyword">false</font>; +00098 <a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m10">StaticLightEnabled</a>= <font class="keyword">false</font>; +00099 <a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m8">DontCastShadow</a>= <font class="keyword">false</font>; +00100 } +00101 +00102 <font class="comment">// Serial the gamedev data</font> +00103 <font class="keywordflow">if</font> (version >= 2) +00104 { +00105 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m6">InstanceName</a>); +00106 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m7">DontAddToScene</a>); +00107 } +00108 +00109 <font class="comment">// Serial the clusters</font> +00110 <font class="keywordflow">if</font> (version >= 1) +00111 f.<a class="code" href="classNLMISC_1_1IStream.html#a7">serialCont</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m2">Clusters</a>); +00112 +00113 <font class="comment">// Serial the name</font> +00114 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m0">Name</a>); +00115 +00116 <font class="comment">// Serial the position vector</font> +00117 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m4">Pos</a>); +00118 +00119 <font class="comment">// Serial the rotation vector</font> +00120 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m3">Rot</a>); +00121 +00122 <font class="comment">// Serial the scale vector</font> +00123 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m5">Scale</a>); +00124 +00125 <font class="comment">// Serial the parent location in the vector (-1 if no parent)</font> +00126 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CInstanceGroup_1_1CInstance.html#m1">nParent</a>); +00127 } +00128 +00129 <font class="comment">// ---------------------------------------------------------------------------</font> +00130 <font class="comment">// CInstanceGroup</font> +00131 <font class="comment">// ---------------------------------------------------------------------------</font> +00132 +00133 <font class="comment">// ***************************************************************************</font> +00134 +<a name="l00135"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a0">00135</a> uint CInstanceGroup::getNumInstance ()<font class="keyword"> const</font> +00136 <font class="keyword"></font>{ +00137 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(); +00138 } +00139 +00140 <font class="comment">// ***************************************************************************</font> +00141 +<a name="l00142"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a1">00142</a> <font class="keyword">const</font> string& CInstanceGroup::getShapeName (uint instanceNb)<font class="keyword"> const</font> +00143 <font class="keyword"></font>{ +00144 <font class="comment">// Return the name of the n-th instance</font> +00145 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[instanceNb].Name; +00146 } +00147 +00148 <font class="comment">// ***************************************************************************</font> +00149 +<a name="l00150"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a2">00150</a> <font class="keyword">const</font> string& CInstanceGroup::getInstanceName (uint instanceNb)<font class="keyword"> const</font> +00151 <font class="keyword"></font>{ +00152 <font class="comment">// Return the name of the n-th instance</font> +00153 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[instanceNb].InstanceName; +00154 } +00155 +00156 <font class="comment">// ***************************************************************************</font> +00157 +<a name="l00158"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a3">00158</a> <font class="keyword">const</font> CVector& CInstanceGroup::getInstancePos (uint instanceNb)<font class="keyword"> const</font> +00159 <font class="keyword"></font>{ +00160 <font class="comment">// Return the position vector of the n-th instance</font> +00161 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[instanceNb].Pos; +00162 } +00163 +00164 <font class="comment">// ***************************************************************************</font> +00165 +<a name="l00166"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a4">00166</a> <font class="keyword">const</font> CQuat& CInstanceGroup::getInstanceRot (uint instanceNb)<font class="keyword"> const</font> +00167 <font class="keyword"></font>{ +00168 <font class="comment">// Return the rotation vector of the n-th instance</font> +00169 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[instanceNb].Rot; +00170 } +00171 +00172 <font class="comment">// ***************************************************************************</font> +00173 +<a name="l00174"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a5">00174</a> <font class="keyword">const</font> CVector& CInstanceGroup::getInstanceScale (uint instanceNb)<font class="keyword"> const</font> +00175 <font class="keyword"></font>{ +00176 <font class="comment">// Return the scale vector of the n-th instance</font> +00177 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[instanceNb].Scale; +00178 } +00179 +00180 <font class="comment">// ***************************************************************************</font> +00181 +<a name="l00182"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a6">00182</a> <font class="keywordtype">void</font> CInstanceGroup::getInstanceMatrix(uint instanceNb,<a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &dest)<font class="keyword"> const</font> +00183 <font class="keyword"></font>{ +00184 dest.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_0">identity</a>(); +00185 dest.<a class="code" href="classNLMISC_1_1CMatrix.html#z292_0">translate</a>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#a3">getInstancePos</a>(instanceNb)); +00186 dest.<a class="code" href="classNLMISC_1_1CMatrix.html#z292_4">rotate</a>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#a4">getInstanceRot</a>(instanceNb)); +00187 dest.<a class="code" href="classNLMISC_1_1CMatrix.html#z292_6">scale</a>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#a5">getInstanceScale</a>(instanceNb)); +00188 } +00189 +00190 +00191 +00192 <font class="comment">// ***************************************************************************</font> +00193 +<a name="l00194"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a7">00194</a> <font class="keyword">const</font> sint32 CInstanceGroup::getInstanceParent (uint instanceNb)<font class="keyword"> const</font> +00195 <font class="keyword"></font>{ +00196 <font class="comment">// Return the scale vector of the n-th instance</font> +00197 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[instanceNb].nParent; +00198 } +00199 +00200 +00201 <font class="comment">// ***************************************************************************</font> +<a name="l00202"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a8">00202</a> <font class="keyword">const</font> CInstanceGroup::CInstance &CInstanceGroup::getInstance(uint instanceNb)<font class="keyword"> const</font> +00203 <font class="keyword"></font>{ +00204 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[instanceNb]; +00205 } +00206 +00207 <font class="comment">// ***************************************************************************</font> +<a name="l00208"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a9">00208</a> CInstanceGroup::CInstance &CInstanceGroup::getInstance(uint instanceNb) +00209 { +00210 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[instanceNb]; +00211 } +00212 +00213 <font class="comment">// ***************************************************************************</font> +<a name="l00214"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a11">00214</a> CTransformShape *CInstanceGroup::getTransformShape(uint instanceNb)<font class="keyword"> const</font> +00215 <font class="keyword"></font>{ +00216 <font class="keywordflow">if</font>(instanceNb><a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.size()) +00217 <font class="keywordflow">return</font> NULL; +00218 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[instanceNb]; +00219 } +00220 +00221 <font class="comment">// ***************************************************************************</font> +<a name="l00222"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a12">00222</a> CInstanceGroup::CInstanceGroup() +00223 { +00224 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_3">_IGSurfaceLight</a>.setOwner(<font class="keyword">this</font>); +00225 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m8">_GlobalPos</a> = CVector(0,0,0); +00226 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a> = NULL; +00227 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m7">_ClusterSystem</a> = NULL; +00228 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_1">_RealTimeSunContribution</a>= <font class="keyword">true</font>; +00229 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_1">_AddToSceneState</a> = <a class="code" href="classNL3D_1_1CInstanceGroup.html#s6s2">StateNotAdded</a>; +00230 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o0">_TransformName</a> = NULL; +00231 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o1">_AddRemoveInstance</a> = NULL; +00232 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o2">_IGAddBeginCallback</a> = NULL; +00233 } +00234 +00235 <font class="comment">// ***************************************************************************</font> +<a name="l00236"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a13">00236</a> CInstanceGroup::~CInstanceGroup() +00237 { +00238 } +00239 +00240 <font class="comment">// ***************************************************************************</font> +<a name="l00241"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a15">00241</a> <font class="keywordtype">void</font> CInstanceGroup::build (<font class="keyword">const</font> CVector &vGlobalPos, <font class="keyword">const</font> TInstanceArray& array, +00242 <font class="keyword">const</font> std::vector<CCluster>& Clusters, +00243 <font class="keyword">const</font> std::vector<CPortal>& Portals, +00244 <font class="keyword">const</font> std::vector<CPointLightNamed> &pointLightList, +00245 <font class="keyword">const</font> CIGSurfaceLight::TRetrieverGridMap *retrieverGridMap, +00246 <font class="keywordtype">float</font> igSurfaceLightCellSize) +00247 { +00248 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m8">_GlobalPos</a> = vGlobalPos; +00249 <font class="comment">// Copy the array</font> +00250 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a> = array; +00251 +00252 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a> = Portals; +00253 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a> = Clusters; +00254 +00255 <font class="comment">// Link portals and clusters</font> +00256 uint32 i, j, k; +00257 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>.size(); ++i) +00258 { +00259 <font class="keywordflow">for</font> (j = 0; j < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>.size(); ++j) +00260 { +00261 <font class="keywordtype">bool</font> bPortalInCluster = <font class="keyword">true</font>; +00262 <font class="keywordflow">for</font> (k = 0; k < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i]._Poly.size(); ++k) +00263 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[j].isIn (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i]._Poly[k]) ) +00264 { +00265 bPortalInCluster = <font class="keyword">false</font>; +00266 <font class="keywordflow">break</font>; +00267 } +00268 <font class="keywordflow">if</font> (bPortalInCluster) +00269 { +00270 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i].setCluster(&<a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[j]); +00271 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[j].link (&<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i]); +00272 } +00273 } +00274 } +00275 +00276 <font class="comment">// Create Meta Cluster if needed</font> +00277 <font class="comment">/*</font> +00278 <font class="comment"> CCluster clusterTemp;</font> +00279 <font class="comment"> bool mustAdd = false;</font> +00280 <font class="comment"> for (i = 0; i < _Portals.size(); ++i)</font> +00281 <font class="comment"> if (_Portals[i].getNbCluster() == 1)</font> +00282 <font class="comment"> {</font> +00283 <font class="comment"> mustAdd = true;</font> +00284 <font class="comment"> break;</font> +00285 <font class="comment"> }</font> +00286 <font class="comment"> if (mustAdd)</font> +00287 <font class="comment"> {</font> +00288 <font class="comment"> CCluster clusterTemp;</font> +00289 <font class="comment"> _ClusterInfos.push_back(clusterTemp);</font> +00290 <font class="comment"> CCluster *pMetaCluster = &_ClusterInfos[_ClusterInfos.size()-1];</font> +00291 <font class="comment"> pMetaCluster->setMetaCluster();</font> +00292 <font class="comment"> for (i = 0; i < _Portals.size(); ++i)</font> +00293 <font class="comment"> if (_Portals[i].getNbCluster() == 1)</font> +00294 <font class="comment"> {</font> +00295 <font class="comment"> _Portals[i].setCluster(pMetaCluster);</font> +00296 <font class="comment"> pMetaCluster->link(&_Portals[i]);</font> +00297 <font class="comment"> }</font> +00298 <font class="comment"> }*/</font> +00299 +00300 +00301 <font class="comment">// Build the list of light. NB: sort by LightGroupName the array.</font> +00302 std::vector<uint> plRemap; +00303 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_0">buildPointLightList</a>(pointLightList, plRemap); +00304 +00305 <font class="comment">// Build IgSurfaceLight</font> +00306 <font class="comment">// clear</font> +00307 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_3">_IGSurfaceLight</a>.clear(); +00308 <font class="keywordflow">if</font>(retrieverGridMap) +00309 { +00310 <font class="comment">//build</font> +00311 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_3">_IGSurfaceLight</a>.build(*retrieverGridMap, igSurfaceLightCellSize, plRemap); +00312 } +00313 } +00314 +00315 +00316 <font class="comment">// ***************************************************************************</font> +<a name="l00317"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a14">00317</a> <font class="keywordtype">void</font> CInstanceGroup::build (<font class="keyword">const</font> CVector &vGlobalPos, <font class="keyword">const</font> TInstanceArray& array, +00318 <font class="keyword">const</font> std::vector<CCluster>& Clusters, +00319 <font class="keyword">const</font> std::vector<CPortal>& Portals) +00320 { +00321 <font class="comment">// empty pointLightList</font> +00322 std::vector<CPointLightNamed> pointLightList; +00323 +00324 <a class="code" href="classNL3D_1_1CInstanceGroup.html#a14">build</a>(vGlobalPos, array, Clusters, Portals, pointLightList); +00325 } +00326 +00327 +00328 <font class="comment">// ***************************************************************************</font> +<a name="l00329"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a16">00329</a> <font class="keywordtype">void</font> CInstanceGroup::retrieve (CVector &vGlobalPos, TInstanceArray& array, +00330 std::vector<CCluster>& Clusters, +00331 std::vector<CPortal>& Portals, +00332 std::vector<CPointLightNamed> &pointLightList)<font class="keyword"> const</font> +00333 <font class="keyword"></font>{ +00334 <font class="comment">// Just copy infos. NB: light information order have change but is still valid</font> +00335 vGlobalPos= <a class="code" href="classNL3D_1_1CInstanceGroup.html#m8">_GlobalPos</a>; +00336 array= <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>; +00337 +00338 Portals= <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>; +00339 Clusters= <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>; +00340 <font class="comment">// Must reset links to all portals and clusters.</font> +00341 uint i; +00342 <font class="keywordflow">for</font>(i=0; i<Portals.size(); i++) +00343 Portals[i].resetClusterLinks(); +00344 <font class="keywordflow">for</font>(i=0; i<Clusters.size(); i++) +00345 Clusters[i].resetPortalLinks(); +00346 +00347 +00348 pointLightList= <a class="code" href="classNL3D_1_1CInstanceGroup.html#z770_0">getPointLightList</a>(); +00349 } +00350 +00351 +00352 <font class="comment">// ***************************************************************************</font> +00353 +<a name="l00354"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a17">00354</a> <font class="keywordtype">void</font> CInstanceGroup::serial (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>& f) +00355 { +00356 <font class="comment">// Serial a header</font> +00357 f.<a class="code" href="classNLMISC_1_1IStream.html#a30">serialCheck</a> ((uint32)'TPRG'); +00358 +00359 <font class="comment">/*</font> +00360 <font class="comment"> Version 5:</font> +00361 <font class="comment"> _ _RealTimeSunContribution</font> +00362 <font class="comment"> Version 4:</font> +00363 <font class="comment"> _ IGSurfaceLight</font> +00364 <font class="comment"> Version 3:</font> +00365 <font class="comment"> - PointLights</font> +00366 <font class="comment"> */</font> +00367 <font class="comment">// Serial a version number</font> +00368 sint version=f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a> (5); +00369 +00370 +00371 <font class="comment">// _RealTimeSunContribution</font> +00372 <font class="keywordflow">if</font> (version >= 5) +00373 { +00374 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_1">_RealTimeSunContribution</a>); +00375 } +00376 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00377 { +00378 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_1">_RealTimeSunContribution</a>= <font class="keyword">true</font>; +00379 } +00380 +00381 +00382 <font class="comment">// Serial the IGSurfaceLight</font> +00383 <font class="keywordflow">if</font> (version >= 4) +00384 { +00385 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_3">_IGSurfaceLight</a>); +00386 } +00387 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00388 { +00389 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_3">_IGSurfaceLight</a>.clear(); +00390 } +00391 +00392 +00393 <font class="comment">// Serial the PointLights info</font> +00394 <font class="keywordflow">if</font> (version >= 3) +00395 { +00396 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>); +00397 } +00398 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00399 { +00400 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>.clear(); +00401 } +00402 +00403 +00404 <font class="keywordflow">if</font> (version >= 2) +00405 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#m8">_GlobalPos</a>); +00406 +00407 <font class="keywordflow">if</font> (version >= 1) +00408 { +00409 f.<a class="code" href="classNLMISC_1_1IStream.html#a7">serialCont</a> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>); +00410 f.<a class="code" href="classNLMISC_1_1IStream.html#a7">serialCont</a> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>); +00411 <font class="comment">// Links</font> +00412 <font class="keywordflow">if</font> (f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00413 { +00414 uint32 i, j; +00415 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>.size(); ++i) +00416 { +00417 uint32 nNbPortals; +00418 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (nNbPortals); +00419 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]._Portals.resize (nNbPortals); +00420 <font class="comment">// Recreate clusters to portals links</font> +00421 <font class="keywordflow">for</font> (j = 0; j < nNbPortals; ++j) +00422 { +00423 sint32 nPortalNb; +00424 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (nPortalNb); +00425 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]._Portals[j] = &<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[nPortalNb]; +00426 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[nPortalNb].setCluster (&<a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]); +00427 } +00428 } +00429 } +00430 <font class="keywordflow">else</font> <font class="comment">// We are writing to the stream</font> +00431 { +00432 uint32 i, j; +00433 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>.size(); ++i) +00434 { +00435 uint32 nNbPortals = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]._Portals.size(); +00436 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (nNbPortals); +00437 <font class="keywordflow">for</font> (j = 0; j < nNbPortals; ++j) +00438 { +00439 sint32 nPortalNb = (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]._Portals[j] - &<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[0]); +00440 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (nPortalNb); +00441 } +00442 } +00443 } +00444 } +00445 +00446 <font class="comment">// Serial the array</font> +00447 f.<a class="code" href="classNLMISC_1_1IStream.html#a7">serialCont</a> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>); +00448 } +00449 +00450 <font class="comment">// ***************************************************************************</font> +<a name="l00451"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a18">00451</a> <font class="keywordtype">void</font> CInstanceGroup::createRoot (CScene& scene) +00452 { +00453 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a> = (CTransform*)scene.createModel (<a class="code" href="namespaceNL3D.html#a276">TransformId</a>); +00454 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->setDontUnfreezeChildren (<font class="keyword">true</font>); +00455 <a class="code" href="classNL3D_1_1CInstanceGroup.html#a37">setPos</a> (CVector(0,0,0)); +00456 } +00457 +00458 <font class="comment">// ***************************************************************************</font> +<a name="l00459"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a19">00459</a> <font class="keywordtype">void</font> CInstanceGroup::setTransformNameCallback (ITransformName *pTN) +00460 { +00461 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o0">_TransformName</a> = pTN; +00462 } +00463 +00464 +00465 <font class="comment">// ***************************************************************************</font> +<a name="l00466"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a20">00466</a> <font class="keywordtype">void</font> CInstanceGroup::setAddRemoveInstanceCallback(IAddRemoveInstance *callback) +00467 { +00468 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o1">_AddRemoveInstance</a> = callback; +00469 } +00470 +00471 <font class="comment">// ***************************************************************************</font> +<a name="l00472"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a21">00472</a> <font class="keywordtype">void</font> CInstanceGroup::setIGAddBeginCallback(IIGAddBegin *callback) +00473 { +00474 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o2">_IGAddBeginCallback</a> = callback; +00475 } +00476 +00477 <font class="comment">// ***************************************************************************</font> +<a name="l00478"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a22">00478</a> <font class="keywordtype">bool</font> CInstanceGroup::addToScene (CScene& scene, IDriver *driver) +00479 { +00480 uint32 i; +00481 +00482 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.resize (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(), NULL); +00483 +00484 <font class="keywordflow">if</font> (_IGAddBeginCallback) +00485 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o2">_IGAddBeginCallback</a>->startAddingIG(<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size()); +00486 +00487 <font class="comment">// Creation and positionning of the new instance</font> +00488 +00489 vector<CInstance>::iterator it = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.begin(); +00490 +00491 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(); ++i, ++it) +00492 { +00493 CInstance &rInstanceInfo = *it; +00494 <font class="keywordflow">if</font> (!rInstanceInfo.DontAddToScene) +00495 { +00496 string shapeName; +00497 +00498 <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#a1">getShapeName</a> = <font class="keyword">true</font>; +00499 +00500 <font class="comment">// If there is a callback added to this instance group then transform</font> +00501 <font class="comment">// the name of the shape to load.</font> +00502 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#o0">_TransformName</a> != NULL && !rInstanceInfo.InstanceName.empty()) +00503 { +00504 shapeName = <a class="code" href="classNL3D_1_1CInstanceGroup.html#o0">_TransformName</a>->transformName (i, rInstanceInfo.InstanceName); +00505 <font class="keywordflow">if</font> (!shapeName.empty()) +00506 <a class="code" href="classNL3D_1_1CInstanceGroup.html#a1">getShapeName</a> = <font class="keyword">false</font>; +00507 } +00508 +00509 <font class="keywordflow">if</font> (getShapeName) +00510 { +00511 <font class="keywordflow">if</font> (rInstanceInfo.Name.find(<font class="charliteral">'.'</font>) == std::string::npos) +00512 { +00513 shapeName = rInstanceInfo.Name + <font class="stringliteral">".shape"</font>; +00514 } +00515 <font class="keywordflow">else</font> <font class="comment">// extension has already been added</font> +00516 { +00517 shapeName = rInstanceInfo.Name; +00518 } +00519 } +00520 strlwr (shapeName); +00521 +00522 +00523 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i] = scene.createInstance (shapeName); +00524 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i] == NULL ) +00525 { +00526 +00527 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Not found '%s' file\n"</font>, shapeName.c_str()); +00528 <font class="comment">//#if defined(NL_DEBUG) && defined(__STL_DEBUG)</font> +00529 <font class="comment">// nlstop;</font> +00530 <font class="comment">//#endif</font> +00531 +00532 <font class="comment">/*</font> +00533 <font class="comment"> for (uint32 j = 0; j < i; ++j)</font> +00534 <font class="comment"> {</font> +00535 <font class="comment"> scene.deleteInstance(_Instances[j]);</font> +00536 <font class="comment"> _Instances[j] = NULL;</font> +00537 <font class="comment"> }</font> +00538 <font class="comment"> throw NLMISC::Exception("CInstanceGroup::addToScene : unable to create %s shape file", rInstanceInfo.Name.c_str());</font> +00539 <font class="comment"> */</font> +00540 } +00541 } +00542 } +00543 +00544 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#c0">addToSceneWhenAllShapesLoaded</a> (scene, driver); +00545 } +00546 +00547 <font class="comment">// ***************************************************************************</font> +00548 <font class="comment">// Private method</font> +<a name="l00549"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#c0">00549</a> <font class="keywordtype">bool</font> CInstanceGroup::addToSceneWhenAllShapesLoaded (CScene& scene, IDriver *driver) +00550 { +00551 uint32 i, j; +00552 vector<CInstance>::iterator it = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.begin(); +00553 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(); ++i, ++it) +00554 { +00555 CInstance &rInstanceInfo = *it; +00556 +00557 <font class="keywordflow">if</font> (!rInstanceInfo.DontAddToScene) +00558 { +00559 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]) +00560 { +00561 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->setPos (rInstanceInfo.Pos); +00562 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->setRotQuat (rInstanceInfo.Rot); +00563 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->setScale (rInstanceInfo.Scale); +00564 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->setPivot (CVector::Null); +00565 +00566 <font class="comment">// Static Light Setup</font> +00567 <font class="keywordflow">if</font>( rInstanceInfo.StaticLightEnabled ) +00568 { +00569 <font class="comment">// Count lights.</font> +00570 uint numPointLights; +00571 <font class="keywordflow">for</font>(numPointLights= 0; numPointLights<CInstanceGroup::NumStaticLightPerInstance; numPointLights++) +00572 { +00573 <font class="keywordflow">if</font>(rInstanceInfo.Light[numPointLights]==0xFF) +00574 <font class="keywordflow">break</font>; +00575 } +00576 <font class="comment">// Max allowed.</font> +00577 numPointLights= <a class="code" href="bit__set_8cpp.html#a0">min</a>(numPointLights, (uint)<a class="code" href="light__contribution_8h.html#a0">NL3D_MAX_LIGHT_CONTRIBUTION</a>); +00578 +00579 <font class="comment">// Get pl ptrs.</font> +00580 CPointLight *pls[CInstanceGroup::NumStaticLightPerInstance]; +00581 <font class="keywordflow">for</font>(uint j=0; j<numPointLights;j++) +00582 { +00583 uint plId= rInstanceInfo.Light[j]; +00584 pls[j]= (CPointLight*)(&<a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>.getPointLights()[plId]); +00585 } +00586 +00587 <font class="comment">// get frozenAmbientlight.</font> +00588 CPointLight *frozenAmbientlight; +00589 <font class="keywordflow">if</font>(rInstanceInfo.LocalAmbientId == 0xFF) +00590 <font class="comment">// must take the sun one.</font> +00591 frozenAmbientlight= NULL; +00592 <font class="keywordflow">else</font> +00593 <font class="comment">// ok, take the local ambient one.</font> +00594 frozenAmbientlight= (CPointLight*)(&<a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>.getPointLights()[rInstanceInfo.LocalAmbientId]); +00595 +00596 <font class="comment">// Setup the instance.</font> +00597 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->freezeStaticLightSetup(pls, numPointLights, rInstanceInfo.SunContribution, frozenAmbientlight); +00598 } +00599 +00600 <font class="comment">// Driver not NULL ?</font> +00601 <font class="keywordflow">if</font> (driver) +00602 { +00603 <font class="comment">// Flush shape's texture with this driver</font> +00604 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->Shape->flushTextures (*driver); +00605 } +00606 } +00607 } +00608 <font class="keywordflow">else</font> +00609 { +00610 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i] = NULL; +00611 } +00612 } +00613 +00614 <font class="comment">// Setup the hierarchy</font> +00615 <font class="comment">// We just have to set the traversal HRC (Hierarchy)</font> +00616 ITrav *pHrcTrav = scene.getTrav (<a class="code" href="namespaceNL3D.html#a41">HrcTravId</a>); +00617 +00618 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a> == NULL) +00619 { +00620 <a class="code" href="classNL3D_1_1CInstanceGroup.html#a18">createRoot</a> (scene); +00621 } +00622 it = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.begin(); +00623 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(); ++i, ++it) +00624 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[i].DontAddToScene && <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i] != NULL) +00625 { +00626 CInstance &rInstanceInfo = *it; +00627 <font class="keywordflow">if</font>( rInstanceInfo.nParent != -1 ) <font class="comment">// Is the instance get a parent</font> +00628 pHrcTrav->link (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[rInstanceInfo.nParent], <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]); +00629 <font class="keywordflow">else</font> +00630 pHrcTrav->link (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>, <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]); +00631 } +00632 <font class="comment">// Attach the root of the instance group to the root of the hierarchy traversal</font> +00633 pHrcTrav->link (NULL, <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>); +00634 +00635 <font class="comment">// Cluster / Portals</font> +00636 <font class="comment">// -----------------</font> +00637 +00638 CClipTrav *pClipTrav = (CClipTrav*)(scene.getTrav (<a class="code" href="namespaceNL3D.html#a25">ClipTravId</a>)); +00639 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m6">_ClipTrav</a> = pClipTrav; +00640 +00641 <font class="comment">// Create the MOT links (create the physical clusters)</font> +00642 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>.resize (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>.size()); +00643 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>.size(); ++i) +00644 { +00645 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i] = (CCluster*)scene.createModel (<a class="code" href="namespaceNL3D.html#a26">ClusterId</a>); +00646 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->Group = <font class="keyword">this</font>; +00647 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->_Portals = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]._Portals; +00648 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->_LocalVolume = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]._LocalVolume; +00649 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->_LocalBBox = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]._LocalBBox; +00650 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->_Volume = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]._Volume; +00651 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->_BBox = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i]._BBox; +00652 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->FatherVisible = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i].FatherVisible; +00653 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->VisibleFromFather = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i].VisibleFromFather; +00654 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->Name = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[i].Name; +00655 pClipTrav->registerCluster (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]); +00656 pClipTrav->unlink (NULL, <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]); +00657 } +00658 +00659 <font class="comment">// Relink portals with newly created clusters</font> +00660 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>.size(); ++i) +00661 <font class="keywordflow">for</font> (j = 0; j < 2; ++j) +00662 { +00663 sint32 nClusterNb; +00664 nClusterNb = (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i]._Clusters[j] - &<a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[0]); +00665 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i]._Clusters[j] = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[nClusterNb]; +00666 } +00667 +00668 <font class="comment">// Link shapes to clusters</font> +00669 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.size(); ++i) +00670 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i] != NULL && !<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[i].DontAddToScene) +00671 { +00672 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[i].Clusters.size() > 0) +00673 { +00674 pClipTrav->unlink (NULL, <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]); +00675 <font class="keywordflow">for</font> (j = 0; j < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[i].Clusters.size(); ++j) +00676 pClipTrav->link (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[i].Clusters[j]], <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]); +00677 <font class="comment">// For the first time we have to set all the instances to NOT move (and not be rebinded)</font> +00678 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->freeze(); +00679 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->setClusterSystem (<font class="keyword">this</font>); +00680 } +00681 <font class="keywordflow">else</font> +00682 { +00683 <font class="comment">// These instances are not attached to a cluster at this level so we cannot freeze them</font> +00684 <font class="comment">// Moreover we must set their clustersystem they will be tested against</font> +00685 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->setClusterSystem (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m7">_ClusterSystem</a>); +00686 } +00687 } +00688 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->freeze(); +00689 +00690 <font class="comment">// HRC OBS like</font> +00691 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>.size(); ++i) +00692 { +00693 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->setWorldMatrix (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->getMatrix()); +00694 +00695 <font class="keywordflow">for</font> (j = 0; j < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->getNbPortals(); ++j) +00696 { +00697 CPortal *pPortal = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->getPortal(j); +00698 pPortal->setWorldMatrix (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->getMatrix()); +00699 } +00700 +00701 <font class="comment">// Re affect the cluster to the accelerator if not the root</font> +00702 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->isRoot()) +00703 { +00704 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m6">_ClipTrav</a>->Accel.erase (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]->AccelIt); +00705 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m6">_ClipTrav</a>->registerCluster (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]); +00706 } +00707 } +00708 +00709 +00710 <font class="comment">// Link the instance group to the parent</font> +00711 <a class="code" href="classNL3D_1_1CInstanceGroup.html#a43">linkToParent</a> (scene.getGlobalInstanceGroup()); +00712 +00713 <font class="comment">// Attach the clusters to the root of the instance group</font> +00714 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>.size(); ++i) +00715 pHrcTrav->link (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>, <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]); +00716 +00717 +00718 <font class="comment">// Default: freezeHRC all instances.</font> +00719 <a class="code" href="classNL3D_1_1CInstanceGroup.html#a41">freezeHRC</a>(); +00720 +00721 +00722 <font class="comment">// Register the instanceGroup for light animation</font> +00723 <font class="comment">// -----------------</font> +00724 <font class="comment">// If some PointLight to animate</font> +00725 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>.getPointLights().size() > 0) +00726 scene.addInstanceGroupForLightAnimation(<font class="keyword">this</font>); +00727 +00728 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_1">_AddToSceneState</a> = <a class="code" href="classNL3D_1_1CInstanceGroup.html#s6s4">StateAdded</a>; +00729 +00730 <font class="keywordflow">if</font> (_AddRemoveInstance) +00731 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o1">_AddRemoveInstance</a>->instanceGroupAdded(); +00732 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00733 } +00734 +00735 <font class="comment">// ***************************************************************************</font> +<a name="l00736"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a23">00736</a> <font class="keywordtype">bool</font> CInstanceGroup::addToSceneAsync (CScene& scene, IDriver *driver) +00737 { +00738 uint32 i; +00739 +00740 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_1">_AddToSceneState</a> = <a class="code" href="classNL3D_1_1CInstanceGroup.html#s6s3">StateAdding</a>; +00741 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_2">_AddToSceneTempScene</a> = &scene; +00742 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_3">_AddToSceneTempDriver</a> = driver; +00743 +00744 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.resize (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(), NULL); +00745 +00746 <font class="keywordflow">if</font> (_IGAddBeginCallback) +00747 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o2">_IGAddBeginCallback</a>->startAddingIG(<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size()); +00748 +00749 <font class="comment">// Creation and positionning of the new instance</font> +00750 +00751 vector<CInstance>::iterator it = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.begin(); +00752 set<string> allShapesToLoad; +00753 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_0">_AddToSceneSignal</a> = <font class="keyword">false</font>; +00754 <font class="keywordtype">bool</font> loadAsyncStarted = <font class="keyword">false</font>; +00755 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(); ++i, ++it) +00756 { +00757 CInstance &rInstanceInfo = *it; +00758 <font class="keywordflow">if</font> (!rInstanceInfo.DontAddToScene) +00759 { +00760 string shapeName; +00761 <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#a1">getShapeName</a> = <font class="keyword">true</font>; +00762 +00763 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#o0">_TransformName</a> != NULL && !rInstanceInfo.InstanceName.empty()) +00764 { +00765 shapeName = <a class="code" href="classNL3D_1_1CInstanceGroup.html#o0">_TransformName</a>->transformName (i, rInstanceInfo.InstanceName); +00766 <font class="keywordflow">if</font> (!shapeName.empty()) +00767 <a class="code" href="classNL3D_1_1CInstanceGroup.html#a1">getShapeName</a> = <font class="keyword">false</font>; +00768 } +00769 +00770 +00771 <font class="keywordflow">if</font> (getShapeName) +00772 { +00773 <font class="keywordflow">if</font> (rInstanceInfo.Name.find(<font class="charliteral">'.'</font>) == std::string::npos) +00774 { +00775 shapeName = rInstanceInfo.Name + <font class="stringliteral">".shape"</font>; +00776 } +00777 <font class="keywordflow">else</font> <font class="comment">// extension has already been added</font> +00778 { +00779 shapeName = rInstanceInfo.Name; +00780 } +00781 } +00782 shapeName = strlwr (shapeName); +00783 +00784 shapeName = strlwr (shapeName); +00785 <font class="keywordflow">if</font> (allShapesToLoad.find(shapeName) == allShapesToLoad.end()) +00786 { +00787 allShapesToLoad.insert (shapeName); +00788 <font class="keywordflow">if</font> (scene.getShapeBank()->isPresent(shapeName) != CShapeBank::Present) +00789 { +00790 <font class="comment">// Load it from file asynchronously</font> +00791 scene.getShapeBank()->loadAsync (shapeName, scene.getDriver(), &<a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_0">_AddToSceneSignal</a>); +00792 loadAsyncStarted = <font class="keyword">true</font>; +00793 } +00794 } +00795 } +00796 } +00797 <font class="keywordflow">if</font> (!loadAsyncStarted) +00798 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_0">_AddToSceneSignal</a> = <font class="keyword">true</font>; +00799 <font class="keywordflow">else</font> +00800 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_0">_AddToSceneSignal</a> = <font class="keyword">false</font>; +00801 <font class="comment">//CAsyncFileManager::getInstance().signal (&_AddToSceneSignal);</font> +00802 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00803 } +00804 +00805 <font class="comment">// ***************************************************************************</font> +<a name="l00806"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a24">00806</a> <font class="keywordtype">void</font> CInstanceGroup::stopAddToSceneAsync () +00807 { +00808 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_1">_AddToSceneState</a> != <a class="code" href="classNL3D_1_1CInstanceGroup.html#s6s3">StateAdding</a>) +00809 <font class="keywordflow">return</font>; +00810 vector<CInstance>::iterator it = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.begin(); +00811 CAsyncFileManager::getInstance().cancelSignal (&<a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_0">_AddToSceneSignal</a>); +00812 <font class="keywordflow">for</font> (uint32 i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(); ++i, ++it) +00813 { +00814 CInstance &rInstanceInfo = *it; +00815 <font class="keywordflow">if</font> (!rInstanceInfo.DontAddToScene) +00816 { +00817 string shapeName; +00818 +00819 +00820 <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#a1">getShapeName</a> = <font class="keyword">true</font>; +00821 +00822 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#o0">_TransformName</a> != NULL && !rInstanceInfo.InstanceName.empty()) +00823 { +00824 shapeName = <a class="code" href="classNL3D_1_1CInstanceGroup.html#o0">_TransformName</a>->transformName (i, rInstanceInfo.InstanceName); +00825 <font class="keywordflow">if</font> (!shapeName.empty()) +00826 <a class="code" href="classNL3D_1_1CInstanceGroup.html#a1">getShapeName</a> = <font class="keyword">false</font>; +00827 } +00828 +00829 +00830 <font class="keywordflow">if</font> (getShapeName) +00831 { +00832 <font class="keywordflow">if</font> (rInstanceInfo.Name.find(<font class="charliteral">'.'</font>) == std::string::npos) +00833 shapeName = rInstanceInfo.Name + <font class="stringliteral">".shape"</font>; +00834 <font class="keywordflow">else</font> <font class="comment">// extension has already been added</font> +00835 shapeName = rInstanceInfo.Name; +00836 } +00837 +00838 shapeName = strlwr (shapeName); +00839 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_2">_AddToSceneTempScene</a>->getShapeBank()->cancelLoadAsync (shapeName); +00840 } +00841 } +00842 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_1">_AddToSceneState</a> = <a class="code" href="classNL3D_1_1CInstanceGroup.html#s6s2">StateNotAdded</a>; +00843 } +00844 +00845 <font class="comment">// ***************************************************************************</font> +<a name="l00846"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a25">00846</a> CInstanceGroup::TState CInstanceGroup::getAddToSceneState () +00847 { +00848 <font class="comment">// If we are adding but we have finished loading shapes (all shapes are here)</font> +00849 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_1">_AddToSceneState</a> == <a class="code" href="classNL3D_1_1CInstanceGroup.html#s6s3">StateAdding</a>) +00850 { +00851 <font class="keywordflow">if</font> (_AddToSceneSignal) +00852 { +00853 <a class="code" href="classNL3D_1_1CInstanceGroup.html#a22">addToScene</a> (*<a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_2">_AddToSceneTempScene</a>, <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_3">_AddToSceneTempDriver</a>); +00854 } +00855 } +00856 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#z772_1">_AddToSceneState</a>; +00857 } +00858 +00859 <font class="comment">// ***************************************************************************</font> +00860 <font class="comment">// Search in the hierarchy of ig the most low level (child) ig that contains the clusters that</font> +00861 <font class="comment">// are flagged to be visible from father or which father is visible</font> +<a name="l00862"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a43">00862</a> <font class="keywordtype">bool</font> CInstanceGroup::linkToParent (CInstanceGroup *pFather) +00863 { +00864 uint32 i, j; +00865 <font class="keywordtype">bool</font> ret; +00866 +00867 +00868 +00869 <font class="keywordflow">for</font> (i = 0; i < pFather->_ClusterInstances.size(); ++i) +00870 { +00871 <font class="keywordflow">for</font>(j = 0; j < pFather->_ClusterInstances[i]->Children.size(); ++j) +00872 { +00873 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#a43">linkToParent</a>(pFather->_ClusterInstances[i]->Children[j]->Group)) +00874 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00875 } +00876 } +00877 ret = <font class="keyword">false</font>; +00878 <font class="keywordflow">if</font> (<font class="keyword">this</font> != pFather) +00879 { +00880 <font class="keywordflow">for</font> (j = 0; j < this-><a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>.size(); ++j) +00881 { +00882 <font class="keywordflow">if</font> ((this-><a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[j]->FatherVisible) || +00883 (this-><a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[j]->VisibleFromFather)) +00884 { +00885 <font class="keywordflow">for</font> (i = 0; i < pFather->_ClusterInstances .size(); ++i) +00886 { +00887 +00888 <font class="keywordflow">if</font> (pFather->_ClusterInstances[i]->isIn(this->_ClusterInstances[j]->getBBox())) +00889 { +00890 <font class="keywordflow">if</font> (this-><a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[j]->Father != pFather->_ClusterInstances[i]) <font class="comment">// not already sons of the right cluster ?</font> +00891 { +00892 <font class="comment">// unlink from parent</font> +00893 this-><a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[j]->unlinkFromParent(); +00894 +00895 <font class="comment">// relink in hierarchy</font> +00896 pFather->_ClusterInstances[i]->Children.push_back(this->_ClusterInstances[j]); +00897 this-><a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[j]->Father = pFather->_ClusterInstances[i]; +00898 } +00899 ret = <font class="keyword">true</font>; +00900 } +00901 } +00902 } +00903 } +00904 } +00905 <font class="keywordflow">return</font> ret; +00906 } +00907 +00908 <font class="comment">// ***************************************************************************</font> +<a name="l00909"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a26">00909</a> <font class="keywordtype">bool</font> CInstanceGroup::removeFromScene (CScene& scene) +00910 { +00911 uint32 i, j, k; +00912 <font class="comment">// Remove shapes</font> +00913 vector<CTransformShape*>::iterator it = <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.begin(); +00914 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(); ++i, ++it) +00915 { +00916 CTransformShape *pTShape = *it; +00917 <font class="keywordflow">if</font>(pTShape) +00918 { +00919 <font class="comment">// For security, unfreeze any StaticLightSetup setuped.</font> +00920 pTShape->unfreezeStaticLightSetup(); +00921 <font class="comment">// delete the instance</font> +00922 scene.deleteInstance (pTShape); +00923 *it = NULL; +00924 } +00925 } +00926 +00927 <font class="comment">// Relink portals with old clusters</font> +00928 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>.size(); ++i) +00929 <font class="keywordflow">for</font> (k = 0; k < 2; ++k) +00930 { +00931 <font class="keywordflow">for</font> (j = 0; j < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>.size(); ++j) +00932 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i]._Clusters[k] == <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[j] ) +00933 <font class="keywordflow">break</font>; +00934 +00935 <a class="code" href="debug_8h.html#a6">nlassert</a> (j!=<a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>.size()); +00936 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i]._Clusters[k] = &<a class="code" href="classNL3D_1_1CInstanceGroup.html#m3">_ClusterInfos</a>[j]; +00937 } +00938 +00939 <font class="comment">// Remove clusters</font> +00940 CClipTrav *pClipTrav = (CClipTrav*)(scene.getTrav (<a class="code" href="namespaceNL3D.html#a25">ClipTravId</a>)); +00941 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>.size(); ++i) +00942 { +00943 pClipTrav->unregisterCluster (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]); +00944 scene.deleteModel (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>[i]); +00945 } +00946 +00947 scene.deleteModel (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>); +00948 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a> = NULL; +00949 +00950 +00951 <font class="comment">// UnRegister the instanceGroup for light animation</font> +00952 <font class="comment">// -----------------</font> +00953 <font class="comment">// If some PointLight to animate</font> +00954 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>.getPointLights().size() > 0) +00955 scene.removeInstanceGroupForLightAnimation(<font class="keyword">this</font>); +00956 +00957 <font class="keywordflow">if</font> (_AddRemoveInstance) +00958 <a class="code" href="classNL3D_1_1CInstanceGroup.html#o1">_AddRemoveInstance</a>->instanceGroupRemoved(); +00959 <font class="keywordflow">return</font> <font class="keyword">true</font>; +00960 } +00961 +00962 +00963 <font class="comment">// ***************************************************************************</font> +00964 <font class="keywordtype">void</font> CInstanceGroup::getLights( set<string> &LightNames ) +00965 { +00966 LightNames.clear(); +00967 <font class="keywordflow">for</font>( uint32 i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.size(); ++i ) +00968 { +00969 CMeshInstance *pMI = dynamic_cast<CMeshInstance*>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]); +00970 <font class="keywordflow">if</font>( pMI != NULL ) +00971 { +00972 uint32 nNbLM = pMI->getNbLightMap(); +00973 <font class="keywordflow">for</font>( uint32 j = 0; j < nNbLM; ++j ) +00974 { +00975 string sTmp; +00976 pMI->getLightMapName( j, sTmp ); +00977 set<string>::iterator itSet = LightNames.find(sTmp); +00978 <font class="keywordflow">if</font>( itSet == LightNames.end() ) +00979 LightNames.insert( sTmp ); +00980 } +00981 } +00982 } +00983 } +00984 +00985 <font class="comment">// ***************************************************************************</font> +00986 <font class="keywordtype">void</font> CInstanceGroup::setLightFactor( <font class="keyword">const</font> string &LightName, CRGBA Factor ) +00987 { +00988 <font class="keywordflow">for</font>( uint32 i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.size(); ++i ) +00989 { +00990 CMeshBaseInstance *pMI = dynamic_cast<CMeshBaseInstance*>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]); +00991 <font class="keywordflow">if</font>( pMI != NULL ) +00992 { +00993 pMI->setLightMapFactor( LightName, Factor ); +00994 } +00995 } +00996 } +00997 +00998 <font class="comment">// ***************************************************************************</font> +00999 <font class="keywordtype">void</font> CInstanceGroup::getBlendShapes( set<string> &BlendShapeNames ) +01000 { +01001 BlendShapeNames.clear(); +01002 <font class="keywordflow">for</font>( uint32 i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.size(); ++i ) +01003 { +01004 CMeshBaseInstance *pMBI = dynamic_cast<CMeshBaseInstance*>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]); +01005 <font class="keywordflow">if</font> (pMBI != NULL) +01006 { +01007 uint32 nNbBS = pMBI->getNbBlendShape(); +01008 <font class="keywordflow">for</font>( uint32 j = 0; j < nNbBS; ++j ) +01009 { +01010 string sTmp; +01011 pMBI->getBlendShapeName( j, sTmp ); +01012 set<string>::iterator itSet = BlendShapeNames.find(sTmp); +01013 <font class="keywordflow">if</font>( itSet == BlendShapeNames.end() ) +01014 BlendShapeNames.insert( sTmp ); +01015 } +01016 } +01017 } +01018 } +01019 +01020 <font class="comment">// ***************************************************************************</font> +01021 <font class="keywordtype">void</font> CInstanceGroup::setBlendShapeFactor( <font class="keyword">const</font> string &BlendShapeName, <font class="keywordtype">float</font> rFactor ) +01022 { +01023 <font class="keywordflow">for</font>( uint32 i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.size(); ++i ) +01024 { +01025 CMeshBaseInstance *pMI = dynamic_cast<CMeshBaseInstance*>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]); +01026 <font class="keywordflow">if</font>( pMI != NULL ) +01027 { +01028 pMI->setBlendShapeFactor( BlendShapeName, rFactor ); +01029 } +01030 } +01031 } +01032 +01033 <font class="comment">// ***************************************************************************</font> +<a name="l01034"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a31">01034</a> <font class="keywordtype">void</font> CInstanceGroup::addCluster(CCluster *pCluster) +01035 { +01036 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m4">_ClusterInstances</a>.push_back(pCluster); +01037 } +01038 +01039 <font class="comment">// ***************************************************************************</font> +<a name="l01040"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a32">01040</a> <font class="keywordtype">void</font> CInstanceGroup::setClusterSystem(CInstanceGroup *pIG) +01041 { +01042 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m7">_ClusterSystem</a> = pIG; +01043 <font class="keywordflow">for</font> (uint32 i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.size(); ++i) +01044 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i] && <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[i].Clusters.size() == 0) +01045 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->setClusterSystem (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m7">_ClusterSystem</a>); +01046 } +01047 +01048 <font class="comment">// ***************************************************************************</font> +<a name="l01049"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a33">01049</a> <font class="keywordtype">void</font> CInstanceGroup::getDynamicPortals (std::vector<std::string> &names) +01050 { +01051 <font class="keywordflow">for</font> (uint32 i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>.size(); ++i) +01052 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i].getName() != <font class="stringliteral">""</font>) +01053 names.push_back (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i].<a class="code" href="zone__lighter_8cpp.html#a11">getName</a>()); +01054 } +01055 +01056 <font class="comment">// ***************************************************************************</font> +<a name="l01057"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a34">01057</a> <font class="keywordtype">void</font> CInstanceGroup::setDynamicPortal (std::string& name, <font class="keywordtype">bool</font> opened) +01058 { +01059 <font class="keywordflow">for</font> (uint32 i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>.size(); ++i) +01060 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i].getName() == name) +01061 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i].open (opened); +01062 } +01063 +01064 <font class="comment">// ***************************************************************************</font> +<a name="l01065"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a35">01065</a> <font class="keywordtype">bool</font> CInstanceGroup::getDynamicPortal (std::string& name) +01066 { +01067 <font class="keywordflow">for</font> (uint32 i = 0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>.size(); ++i) +01068 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i].getName() == name) +01069 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m2">_Portals</a>[i].isOpened (); +01070 <font class="keywordflow">return</font> <font class="keyword">false</font>; +01071 } +01072 +01073 <font class="comment">// ***************************************************************************</font> +<a name="l01074"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a37">01074</a> <font class="keywordtype">void</font> CInstanceGroup::setPos (<font class="keyword">const</font> CVector &pos) +01075 { +01076 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a> != NULL) +01078 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->setPos (pos); +01079 } +01080 +01081 <font class="comment">// ***************************************************************************</font> +<a name="l01082"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a38">01082</a> <font class="keywordtype">void</font> CInstanceGroup::setRotQuat (<font class="keyword">const</font> CQuat &quat) +01083 { +01084 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a> != NULL) +01085 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->setRotQuat (quat); +01086 } +01087 +01088 <font class="comment">// ***************************************************************************</font> +<a name="l01089"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a39">01089</a> CVector CInstanceGroup::getPos () +01090 { +01091 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a> != NULL) +01092 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->getPos (); +01093 <font class="keywordflow">else</font> +01094 <font class="keywordflow">return</font> CVector(0.0f, 0.0f, 0.0f); +01095 } +01096 +01097 <font class="comment">// ***************************************************************************</font> +<a name="l01098"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a40">01098</a> CQuat CInstanceGroup::getRotQuat () +01099 { +01100 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a> != NULL) +01101 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->getRotQuat (); +01102 <font class="keywordflow">else</font> +01103 <font class="keywordflow">return</font> CQuat(); +01104 } +01105 +01106 <font class="comment">// ***************************************************************************</font> +<a name="l01107"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a36">01107</a> <font class="keywordtype">void</font> CInstanceGroup::linkRoot (CScene &scene, CTransform *father) +01108 { +01109 <font class="keywordflow">if</font>(_Root) +01110 { +01111 ITrav *pHrcTrav = scene.getTrav (<a class="code" href="namespaceNL3D.html#a41">HrcTravId</a>); +01112 pHrcTrav->link(father, <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>); +01113 } +01114 } +01115 +01116 <font class="comment">// ***************************************************************************</font> +<a name="l01117"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a41">01117</a> <font class="keywordtype">void</font> CInstanceGroup::freezeHRC() +01118 { +01119 <font class="comment">// For all instances.</font> +01120 <font class="keywordflow">for</font> (uint i=0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.size(); i++) +01121 { +01122 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]) +01123 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->freezeHRC(); +01124 } +01125 <font class="comment">// and for root.</font> +01126 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->freezeHRC(); +01127 } +01128 +01129 +01130 <font class="comment">// ***************************************************************************</font> +<a name="l01131"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#a42">01131</a> <font class="keywordtype">void</font> CInstanceGroup::unfreezeHRC() +01132 { +01133 <font class="comment">// For all instances.</font> +01134 <font class="keywordflow">for</font> (uint i=0; i < <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>.size(); i++) +01135 { +01136 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]) +01137 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m1">_Instances</a>[i]->unfreezeHRC(); +01138 } +01139 <font class="comment">// and for root.</font> +01140 <a class="code" href="classNL3D_1_1CInstanceGroup.html#m5">_Root</a>->unfreezeHRC(); +01141 } +01142 +01143 <font class="comment">// ***************************************************************************</font> +01144 <font class="comment">// ***************************************************************************</font> +01145 <font class="comment">// ***************************************************************************</font> +01146 <font class="comment">// ***************************************************************************</font> +01147 +01148 +01149 <font class="comment">// ***************************************************************************</font> +<a name="l01150"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_0">01150</a> <font class="keywordtype">void</font> CInstanceGroup::buildPointLightList(<font class="keyword">const</font> std::vector<CPointLightNamed> &pointLightList, +01151 std::vector<uint> &plRemap) +01152 { +01153 <font class="comment">// build.</font> +01154 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>.build(pointLightList, plRemap); +01155 +01156 <font class="comment">// remap Instance precalc lighted.</font> +01157 <font class="keywordflow">for</font>(uint i=0; i<<a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>.size(); i++) +01158 { +01159 CInstance &inst= <a class="code" href="classNL3D_1_1CInstanceGroup.html#m0">_InstancesInfos</a>[i]; +01160 <font class="comment">// If the instance has no precomputed lighting, skip</font> +01161 <font class="keywordflow">if</font>(!inst.StaticLightEnabled) +01162 <font class="keywordflow">continue</font>; +01163 +01164 <font class="comment">// remap pointlights</font> +01165 <font class="keywordflow">for</font>(uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>=0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a><CInstanceGroup::NumStaticLightPerInstance; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>++) +01166 { +01167 <font class="comment">// If NULL light, break and continue to next instance</font> +01168 <font class="keywordflow">if</font>(inst.Light[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>]== 0xFF) +01169 <font class="keywordflow">break</font>; +01170 <font class="keywordflow">else</font> +01171 { +01172 <font class="comment">// Check good index.</font> +01173 <a class="code" href="debug_8h.html#a6">nlassert</a>(inst.Light[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>] < <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>.getPointLights().size()); +01174 <font class="comment">// Remap index, because of light sorting.</font> +01175 inst.Light[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>]= plRemap[inst.Light[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>]]; +01176 } +01177 } +01178 +01179 <font class="comment">// remap ambient light</font> +01180 <font class="keywordflow">if</font>(inst.LocalAmbientId!=0xFF) +01181 { +01182 <a class="code" href="debug_8h.html#a6">nlassert</a>(inst.LocalAmbientId < <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>.getPointLights().size()); +01183 inst.LocalAmbientId= plRemap[inst.LocalAmbientId]; +01184 } +01185 } +01186 +01187 } +01188 +01189 <font class="comment">// ***************************************************************************</font> +<a name="l01190"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#z770_3">01190</a> <font class="keywordtype">void</font> CInstanceGroup::setPointLightFactor(<font class="keyword">const</font> std::string &lightGroupName, <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> nFactor) +01191 { +01192 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_2">_PointLightArray</a>.setPointLightFactor(lightGroupName, nFactor); +01193 } +01194 +01195 +01196 <font class="comment">// ***************************************************************************</font> +<a name="l01197"></a><a class="code" href="classNL3D_1_1CInstanceGroup.html#z770_5">01197</a> <font class="keywordtype">void</font> CInstanceGroup::enableRealTimeSunContribution(<font class="keywordtype">bool</font> enable) +01198 { +01199 <a class="code" href="classNL3D_1_1CInstanceGroup.html#z771_1">_RealTimeSunContribution</a>= enable; +01200 } +01201 +01202 +01203 } <font class="comment">// NL3D</font> +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </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> |