aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/particle__system__model_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/particle__system__model_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/particle__system__model_8cpp-source.html824
1 files changed, 824 insertions, 0 deletions
diff --git a/docs/doxygen/nel/particle__system__model_8cpp-source.html b/docs/doxygen/nel/particle__system__model_8cpp-source.html
new file mode 100644
index 00000000..88c5c582
--- /dev/null
+++ b/docs/doxygen/nel/particle__system__model_8cpp-source.html
@@ -0,0 +1,824 @@
+<!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>particle_system_model.cpp</h1><a href="particle__system__model_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="debug_8h.html">nel/misc/debug.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="hierarchical__timer_8h.html">nel/misc/hierarchical_timer.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="particle__system__model_8h.html">3d/particle_system_model.h</a>"</font>
+00032 <font class="preprocessor">#include "<a class="code" href="particle__system__shape_8h.html">3d/particle_system_shape.h</a>"</font>
+00033 <font class="preprocessor">#include "<a class="code" href="particle__system_8h.html">3d/particle_system.h</a>"</font>
+00034 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font>
+00035 <font class="preprocessor">#include "<a class="code" href="anim__detail__trav_8h.html">3d/anim_detail_trav.h</a>"</font>
+00036 <font class="preprocessor">#include "<a class="code" href="clip__trav_8h.html">3d/clip_trav.h</a>"</font>
+00037 <font class="preprocessor">#include "<a class="code" href="render__trav_8h.html">3d/render_trav.h</a>"</font>
+00038 <font class="preprocessor">#include "<a class="code" href="skeleton__model_8h.html">3d/skeleton_model.h</a>"</font>
+00039
+00040
+00041
+00042 <font class="preprocessor">#include "<a class="code" href="cluster_8h.html">cluster.h</a>"</font> <font class="comment">// ask trap</font>
+00043
+00044
+00045
+00046
+00047 <font class="keyword">namespace </font>NL3D {
+00048
+<a name="l00051"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z657_0">00051</a> CParticleSystemModel::CParticleSystemModel() : _AutoGetEllapsedTime(true),
+00052 _ParticleSystem(NULL),
+00053 _Scene(NULL),
+00054 _EllapsedTime(0.01f),
+00055 _EllapsedTimeRatio(1.f),
+00056 _ToolDisplayEnabled(false),
+00057 _TransparencyStateTouched(true),
+00058 _EditionMode(false),
+00059 _Invalidated(false),
+00060 _InsertedInVisibleList(false),
+00061 _InClusterAndVisible(false),
+00062 _BypassGlobalUserParam(0)
+00063 {
+00064 <a class="code" href="classNL3D_1_1CTransform.html#a1">setOpacity</a>(<font class="keyword">false</font>);
+00065 <a class="code" href="classNL3D_1_1CTransform.html#a0">setTransparency</a>(<font class="keyword">true</font>);
+00066 IAnimatable::resize(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s6">AnimValueLast</a>);
+00067 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o14">_TriggerAnimatedValue</a>.Value = <font class="keyword">true</font>;
+00068
+00069 <font class="comment">// AnimDetail behavior: Must be traversed in AnimDetail, even if no channel mixer registered</font>
+00070 CTransform::setIsForceAnimDetail(<font class="keyword">true</font>);
+00071 }
+00072
+00073
+<a name="l00075"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z661_2">00075</a> <font class="keywordtype">void</font> CParticleSystemModel::setEditionMode(<font class="keywordtype">bool</font> enable <font class="comment">/*= true*/</font>)
+00076 {
+00077 <font class="keywordflow">if</font> (enable)
+00078 {
+00080 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>)
+00081 {
+00082 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>);
+00083 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00084 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#c0">reallocRsc</a>();
+00085 }
+00086 }
+00087 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o9">_EditionMode</a> = enable;
+00088 }
+00089
+<a name="l00091"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z659_1">00091</a> <font class="keywordtype">void</font> CParticleSystemModel::registerPSModelObserver(IPSModelObserver *obs)
+00092 {
+00093 <a class="code" href="debug_8h.html#a6">nlassert</a>(!<a class="code" href="classNL3D_1_1CParticleSystemModel.html#z659_3">isPSModelObserver</a>(obs)); <font class="comment">// this observer has already been registered</font>
+00094 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.push_back(obs);
+00095 }
+00096
+<a name="l00098"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z659_2">00098</a> <font class="keywordtype">void</font> CParticleSystemModel::removePSModelObserver(IPSModelObserver *obs)
+00099 {
+00100 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#z659_3">isPSModelObserver</a>(obs)); <font class="comment">// the observer must have been registered</font>
+00101 std::vector&lt;IPSModelObserver *&gt;::iterator it = std::find(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.begin(), <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.end(), obs);
+00102 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.erase(it);
+00103 }
+00104
+00105
+<a name="l00107"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z659_3">00107</a> <font class="keywordtype">bool</font> CParticleSystemModel::isPSModelObserver(IPSModelObserver *obs)
+00108 {
+00109 <font class="keywordflow">return</font> std::find(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.begin(), <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.end(), obs) != <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.end();
+00110 }
+00111
+00112
+<a name="l00114"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z657_2">00114</a> <font class="keywordtype">void</font> CParticleSystemModel::registerBasic()
+00115 {
+00116 <font class="comment">// register the model and his observers</font>
+00117 CMOT::registerModel(<a class="code" href="namespaceNL3D.html#a172">ParticleSystemModelId</a>, <a class="code" href="namespaceNL3D.html#a277">TransformShapeId</a>, CParticleSystemModel::creator);
+00118 CMOT::registerObs(<a class="code" href="namespaceNL3D.html#a3">AnimDetailTravId</a>, <a class="code" href="namespaceNL3D.html#a172">ParticleSystemModelId</a>, CParticleSystemDetailObs::creator);
+00119 CMOT::registerObs(<a class="code" href="namespaceNL3D.html#a25">ClipTravId</a>, <a class="code" href="namespaceNL3D.html#a172">ParticleSystemModelId</a>, CParticleSystemClipObs::creator);
+00120 CMOT::registerObs(<a class="code" href="namespaceNL3D.html#a232">RenderTravId</a>, <a class="code" href="namespaceNL3D.html#a172">ParticleSystemModelId</a>, CParticleSystemRenderObs::creator);
+00121 }
+00122
+<a name="l00124"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#a0">00124</a> <font class="keywordtype">void</font> CParticleSystemModel::updateOpacityInfos(<font class="keywordtype">void</font>)
+00125 {
+00126 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>);
+00127 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o8">_TransparencyStateTouched</a>) <font class="keywordflow">return</font>;
+00128 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>);
+00129 <a class="code" href="classNL3D_1_1CTransform.html#a1">setOpacity</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>-&gt;hasOpaqueObjects() || <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o7">_ToolDisplayEnabled</a>);
+00130 <a class="code" href="classNL3D_1_1CTransform.html#a0">setTransparency</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>-&gt;hasTransparentObjects());
+00131 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o8">_TransparencyStateTouched</a> = <font class="keyword">false</font>;
+00132 }
+00133
+00134
+<a name="l00136"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#a2">00136</a> <font class="keywordtype">void</font> CParticleSystemModel::getAABBox(<a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> &amp;bbox)<font class="keyword"> const</font>
+00137 <font class="keyword"></font>{
+00138 <font class="keywordflow">if</font> (_ParticleSystem)
+00139 {
+00140 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>-&gt;computeBBox(bbox);
+00141 }
+00142 <font class="keywordflow">else</font>
+00143 {
+00144 NLMISC::safe_cast&lt;CParticleSystemShape *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>)-&gt;getAABBox(bbox);
+00145 }
+00146 }
+00147
+<a name="l00149"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z657_1">00149</a> CParticleSystemModel::~CParticleSystemModel()
+00150 {
+00151 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>);
+00152 <font class="keywordflow">if</font> (_ParticleSystem)
+00153 {
+00154 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>-&gt;getParticleSystemManager().removeSystemModel(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o0">_ModelHandle</a>);
+00155 }
+00156 <font class="comment">// Auto detach me from skeleton. Must do it here, not in ~CTransform().</font>
+00157 <font class="keywordflow">if</font>(_FatherSkeletonModel)
+00158 {
+00159 <font class="comment">// detach me from the skeleton.</font>
+00160 <font class="comment">// Observers hierarchy is modified.</font>
+00161 <a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>-&gt;detachSkeletonSon(<font class="keyword">this</font>);
+00162 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTransform.html#z851_7">_FatherSkeletonModel</a>==NULL);
+00163 }
+00164 }
+00165
+00166
+<a name="l00169"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#c0">00169</a> <font class="keywordtype">void</font> CParticleSystemModel::reallocRsc()
+00170 {
+00171 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a> == NULL);
+00172 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a> = NLMISC::safe_cast&lt;CParticleSystemShape *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>)-&gt;instanciatePS(*<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>);
+00173 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>);
+00174 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>);
+00175 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#l4">CParticleSystemManager</a> &amp;psmgt = <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>-&gt;getParticleSystemManager();
+00176 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o0">_ModelHandle</a> = psmgt.addSystemModel(<font class="keyword">this</font>);
+00177 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>-&gt;getAnimType() == CParticleSystem::AnimAlways)
+00178 {
+00179 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a> = psmgt.addPermanentlyAnimatedSystem(<font class="keyword">this</font>);
+00180 }
+00181 <font class="comment">// touch user params animated value. If the system rsc have been released before, this force to restore them</font>
+00182 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a165">MaxPSUserParam</a>; ++k)
+00183 {
+00184 <a class="code" href="classNL3D_1_1IAnimatable.html#z368_1">touch</a>((uint)CParticleSystemModel::PSParam0 + k, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s0">OwnerBit</a>);
+00185 }
+00186 }
+00187
+<a name="l00189"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#c5">00189</a> <font class="keywordtype">void</font> CParticleSystemModel::releasePSPointer()
+00190 {
+00191 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>.<a class="code" href="classNLMISC_1_1CSmartPtr.html#a10">getNbRef</a>() == 1)
+00192 {
+00193 <font class="comment">// Backup user params (in animated value) so that they will be restored when the system is recreated</font>
+00194 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a165">MaxPSUserParam</a>; ++k)
+00195 {
+00196
+00197 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o15">_UserParam</a>[k].Value = <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>-&gt;getUserParam(k);
+00198 }
+00199 }
+00200 <font class="comment">//</font>
+00201 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a> = NULL; <font class="comment">// one less ref with the smart ptr </font>
+00202 }
+00203
+<a name="l00205"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#c1">00205</a> <font class="keywordtype">bool</font> CParticleSystemModel::refreshRscDeletion(<font class="keyword">const</font> std::vector&lt;CPlane&gt; &amp;worldFrustumPyramid, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;viewerPos)
+00206 {
+00207 <font class="keywordflow">if</font> (_EditionMode) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00216 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>);
+00217 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#l0">CParticleSystemShape</a> *shape = NLMISC::safe_cast&lt;CParticleSystemShape *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00218
+00219 <font class="comment">/* NLMISC::CVector sysPos = getTransformMode() == DirectMatrix ?</font>
+00220 <font class="comment"> getMatrix().getPos() :</font>
+00221 <font class="comment"> getPos(); */</font>
+00222
+00223 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> sysPos = <a class="code" href="classNL3D_1_1CParticleSystemModel.html#a1">getWorldMatrix</a>().getPos();
+00224
+00225 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = sysPos - viewerPos;
+00227 <font class="keyword">const</font> <font class="keywordtype">float</font> dist2 = v * v;
+00228
+00229 <font class="keywordflow">if</font> (dist2 &gt; shape-&gt;_MaxViewDist * shape-&gt;_MaxViewDist) <font class="comment">// too far ?</font>
+00230 {
+00231 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>.Valid)
+00232 {
+00233 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>-&gt;getParticleSystemManager().removePermanentlyAnimatedSystem(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>);
+00234 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>.Valid = <font class="keyword">false</font>;
+00235 }
+00236 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#c5">releasePSPointer</a>();
+00237 <font class="keywordflow">if</font> (shape-&gt;_DestroyModelWhenOutOfRange)
+00238 {
+00239 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o10">_Invalidated</a> = <font class="keyword">true</font>;
+00240 }
+00241 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00242 }
+00243
+00245 <font class="keywordflow">if</font> (shape-&gt;_DestroyWhenOutOfFrustum)
+00246 {
+00247 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemModel.html#c4">checkAgainstPyramid</a>(worldFrustumPyramid) == <font class="keyword">false</font>)
+00248 {
+00249 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>.Valid)
+00250 {
+00251 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>-&gt;getParticleSystemManager().removePermanentlyAnimatedSystem(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>);
+00252 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>.Valid = <font class="keyword">false</font>;
+00253 }
+00254
+00255 <font class="keywordflow">if</font> (shape-&gt;_DestroyModelWhenOutOfRange)
+00256 {
+00257 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o10">_Invalidated</a> = <font class="keyword">true</font>;
+00258 }
+00259 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#c5">releasePSPointer</a>();
+00260 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00261 }
+00262 }
+00263
+00264 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00265 }
+00266
+<a name="l00268"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#c2">00268</a> <font class="keywordtype">void</font> CParticleSystemModel::releaseRsc()
+00269 {
+00270 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>) <font class="keywordflow">return</font>;
+00271
+00272 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>.Valid)
+00273 {
+00274 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>-&gt;getParticleSystemManager().removePermanentlyAnimatedSystem(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>);
+00275 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>.Valid = <font class="keyword">false</font>;
+00276 }
+00277 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>);
+00278 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>-&gt;getParticleSystemManager().removeSystemModel(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o0">_ModelHandle</a>);
+00279 }
+00280
+<a name="l00282"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#c3">00282</a> <font class="keywordtype">void</font> CParticleSystemModel::releaseRscAndInvalidate()
+00283 {
+00284
+00285 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>) <font class="keywordflow">return</font>;
+00286
+00287 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>.Valid)
+00288 {
+00289 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>-&gt;getParticleSystemManager().removePermanentlyAnimatedSystem(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>);
+00290 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o1">_AnimatedModelHandle</a>.Valid = <font class="keyword">false</font>;
+00291 }
+00292 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#c5">releasePSPointer</a>();
+00293 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o10">_Invalidated</a> = <font class="keyword">true</font>;
+00294
+00295 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>);
+00296 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o4">_Scene</a>-&gt;getParticleSystemManager().removeSystemModel(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o0">_ModelHandle</a>);
+00297
+00298 <font class="keyword">static</font> std::vector&lt;IPSModelObserver *&gt; copyVect;
+00299 copyVect.resize(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.size());
+00300 std::copy(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.begin(), <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o13">_Observers</a>.end(), copyVect.begin());
+00301
+00302 <font class="keywordflow">for</font> (std::vector&lt;IPSModelObserver *&gt;::iterator it = copyVect.begin(); it != copyVect.end(); ++it)
+00303 {
+00304 (*it)-&gt;invalidPS(<font class="keyword">this</font>); <font class="comment">// if this crash, then you forgot to call removePSModelObserver !</font>
+00305 }
+00306 }
+00307
+<a name="l00309"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_1">00309</a> IAnimatedValue* CParticleSystemModel::getValue (uint valueId)
+00310 {
+00311 <a class="code" href="debug_8h.html#a6">nlassert</a>(valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s6">AnimValueLast</a>);
+00312 <font class="keywordflow">if</font> (valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s0">OwnerBit</a>) <font class="keywordflow">return</font> CTransformShape::getValue(valueId);
+00313 <font class="keywordflow">if</font> (valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s5">PSTrigger</a>)
+00314 {
+00315
+00316 <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o15">_UserParam</a>[valueId - (uint) <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s1">PSParam0</a>];
+00317 }
+00318 <font class="keywordflow">return</font> &amp;<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o14">_TriggerAnimatedValue</a>;
+00319 }
+00320
+<a name="l00322"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_7">00322</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CParticleSystemModel::getPSParamName (uint valueId)
+00323 {
+00324 <a class="code" href="debug_8h.html#a6">nlassert</a>(valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s6">AnimValueLast</a>);
+00325 <font class="keyword">const</font> <font class="keywordtype">char</font> *name[] = { <font class="stringliteral">"PSParam0"</font>, <font class="stringliteral">"PSParam1"</font>, <font class="stringliteral">"PSParam2"</font>, <font class="stringliteral">"PSParam3"</font> };
+00326 <font class="keywordflow">return</font> name[valueId - (uint) <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s1">PSParam0</a>];
+00327 }
+00328
+<a name="l00330"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_2">00330</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CParticleSystemModel::getValueName (uint valueId)<font class="keyword"> const </font>
+00331 <font class="keyword"></font>{
+00332 <a class="code" href="debug_8h.html#a6">nlassert</a>(valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s6">AnimValueLast</a>);
+00333 <font class="keywordflow">if</font> (valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s0">OwnerBit</a>) <font class="keywordflow">return</font> CTransformShape::getValueName(valueId);
+00334 <font class="keywordflow">if</font> (valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s5">PSTrigger</a>) <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_7">getPSParamName</a>(valueId);
+00335 <font class="keywordflow">return</font> <font class="stringliteral">"PSTrigger"</font>;
+00336 }
+00337
+<a name="l00339"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_3">00339</a> ITrack* CParticleSystemModel::getDefaultTrack (uint valueId)
+00340 {
+00341 <a class="code" href="debug_8h.html#a6">nlassert</a>(valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s6">AnimValueLast</a>);
+00342 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00343
+00344 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#l0">CParticleSystemShape</a> *pss = NLMISC::safe_cast&lt;CParticleSystemShape *&gt;((IShape *) <a class="code" href="classNL3D_1_1CTransformShape.html#m0">Shape</a>);
+00345
+00346 <font class="keywordflow">switch</font> (valueId)
+00347 {
+00348 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s5">PosValue</a>: <font class="keywordflow">return</font> pss-&gt;getDefaultPos();
+00349 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s7">RotQuatValue</a>: <font class="keywordflow">return</font> pss-&gt;getDefaultRotQuat();
+00350 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1ITransformable.html#z872_0s8">ScaleValue</a>: <font class="keywordflow">return</font> pss-&gt;getDefaultScale();
+00351 }
+00352 <font class="keywordflow">if</font> (valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s0">OwnerBit</a>) <font class="keywordflow">return</font> CTransformShape::getDefaultTrack(valueId); <font class="comment">// delegate to parent</font>
+00353
+00354 <font class="comment">// this value belong to us</font>
+00355 <font class="keywordflow">if</font> (valueId &lt; <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s5">PSTrigger</a>)
+00356 {
+00357 <font class="keywordflow">return</font> pss-&gt;getUserParamDefaultTrack(valueId - (uint) <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s1">PSParam0</a>);
+00358 }
+00359 <font class="keywordflow">return</font> pss-&gt;getDefaultTriggerTrack();
+00360 }
+00361
+<a name="l00363"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_4">00363</a> <font class="keywordtype">void</font> CParticleSystemModel::registerToChannelMixer(CChannelMixer *chanMixer, <font class="keyword">const</font> std::string &amp;prefix <font class="comment">/* =std::string() */</font>)
+00364 {
+00365 CTransformShape::registerToChannelMixer(chanMixer, prefix);
+00366 <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s1">PSParam0</a>, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s0">OwnerBit</a>, prefix, <font class="keyword">true</font>);
+00367 <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s2">PSParam1</a>, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s0">OwnerBit</a>, prefix, <font class="keyword">true</font>);
+00368 <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s3">PSParam2</a>, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s0">OwnerBit</a>, prefix, <font class="keyword">true</font>);
+00369 <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s4">PSParam3</a>, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s0">OwnerBit</a>, prefix, <font class="keyword">true</font>);
+00370 <a class="code" href="classNL3D_1_1IAnimatable.html#b0">addValue</a>(chanMixer, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s5">PSTrigger</a>, <a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_0s0">OwnerBit</a>, prefix, <font class="keyword">true</font>);
+00371 }
+00372
+00373
+<a name="l00375"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#a3">00375</a> <font class="keywordtype">float</font> CParticleSystemModel::getNumTriangles (<font class="keywordtype">float</font> distance)
+00376 {
+00377 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>) <font class="keywordflow">return</font> 0;
+00378 <font class="keywordflow">return</font> (float) <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>-&gt;getWantedNumTris(distance);
+00379 }
+00380
+<a name="l00382"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#c4">00382</a> <font class="keywordtype">bool</font> CParticleSystemModel::checkAgainstPyramid(<font class="keyword">const</font> std::vector&lt;CPlane&gt; &amp;pyramid)<font class="keyword"> const</font>
+00383 <font class="keyword"></font>{
+00384 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>)
+00385 <a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> bbox;
+00386 <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o3">_ParticleSystem</a>-&gt;computeBBox(bbox);
+00387 <font class="keyword">const</font> CMatrix &amp;mat = <a class="code" href="classNL3D_1_1ITransformable.html#a2">getMatrix</a>();
+00388
+00389 <font class="comment">// Transform the pyramid in Object space. </font>
+00390 <font class="keywordflow">for</font>(sint i=0; i &lt; (sint) pyramid.size(); i++)
+00391 {
+00392 <font class="comment">// test wether the bbox is entirely in the neg side of the plane</font>
+00393 <font class="keywordflow">if</font> (!bbox.<a class="code" href="classNLMISC_1_1CAABBox.html#z265_1">clipBack</a>(pyramid[i] * mat ))
+00394 {
+00395 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00396 }
+00397 }
+00398 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00399
+00400 }
+00401
+00403 <font class="comment">// CParticleSystemDetailObs implementation //</font>
+00405 <font class="comment"></font>
+<a name="l00407"></a><a class="code" href="classNL3D_1_1CParticleSystemDetailObs.html#a0">00407</a> <font class="comment">void CParticleSystemDetailObs::traverse(IObs *caller)</font>
+00408 {
+00409 CTransformAnimDetailObs::traverse(caller);
+00410 CParticleSystemModel *psm= NLMISC::safe_cast&lt;CParticleSystemModel *&gt;(Model);
+00411 CParticleSystem *ps = psm-&gt;getPS();
+00412 <font class="keywordflow">if</font> (psm-&gt;_Invalidated) <font class="keywordflow">return</font>;
+00413 <font class="keywordflow">if</font> (psm-&gt;getVisibility() == CHrcTrav::Hide) <font class="keywordflow">return</font>;
+00414
+00415
+00416 <font class="keywordflow">if</font> (!psm-&gt;_EditionMode &amp;&amp; !psm-&gt;_InClusterAndVisible)
+00417 {
+00418 CParticleSystemShape *pss = NLMISC::safe_cast&lt;CParticleSystemShape *&gt;((IShape *)psm-&gt;Shape);
+00419 <font class="keywordflow">if</font> (pss-&gt;_DestroyWhenOutOfFrustum)
+00420 {
+00421 <font class="keywordflow">if</font> (pss-&gt;_DestroyModelWhenOutOfRange)
+00422 {
+00423 psm-&gt;releaseRscAndInvalidate();
+00424 }
+00425 <font class="keywordflow">else</font> <font class="comment">// remove rsc but do not invalidate the system</font>
+00426 {
+00427 psm-&gt;releaseRsc();
+00428 }
+00429 <font class="keywordflow">return</font>;
+00430 }
+00431 <font class="keywordflow">if</font> (!ps) <font class="keywordflow">return</font>;
+00432 }
+00433
+00434 <font class="comment">// check for trigger. If the trigger is false, and there is a system instanciated, we delete it.</font>
+00435 <font class="keywordflow">if</font> (!psm-&gt;_EditionMode)
+00436 {
+00437 <font class="keywordflow">if</font> (!psm-&gt;_TriggerAnimatedValue.Value)
+00438 {
+00439 <font class="comment">// system is off, or hasn't been instanciated now...</font>
+00440 <font class="keywordflow">if</font> (ps)
+00441 {
+00442 psm-&gt;releaseRsc();
+00443 }
+00444 <font class="keywordflow">return</font>;
+00445 }
+00446 }
+00447
+00448 <font class="comment">// the system or its center is in the view frustum, but it may not have been instanciated from its shape now</font>
+00449 <font class="keywordflow">if</font> (!ps)
+00450 {
+00451 <a class="code" href="debug_8h.html#a6">nlassert</a>(psm-&gt;_Scene);
+00452 <a class="code" href="debug_8h.html#a6">nlassert</a>(psm-&gt;Shape);
+00453 psm-&gt;reallocRsc();
+00454 ps = psm-&gt;_ParticleSystem;
+00455 }
+00456
+00457 CClipTrav *trav= (CClipTrav*) ClipObs-&gt;Trav;
+00458
+00459 <font class="keywordflow">if</font> (psm-&gt;_InClusterAndVisible || ps-&gt;getAnimType() == CParticleSystem::AnimInCluster)
+00460 {
+00461 <font class="keywordtype">bool</font> animate = <font class="keyword">true</font>;
+00462 <font class="keywordflow">if</font> (ps-&gt;isSharingEnabled())
+00463 {
+00464 <font class="keywordflow">if</font> (ps-&gt;_LastUpdateDate == trav-&gt;CurrentDate)
+00465 {
+00466 animate = <font class="keyword">false</font>;
+00467 }
+00468 <font class="keywordflow">else</font>
+00469 {
+00470 ps-&gt;_LastUpdateDate = trav-&gt;CurrentDate;
+00471 }
+00472 }
+00473 <font class="keywordflow">else</font>
+00474 {
+00475 ps-&gt;_LastUpdateDate = trav-&gt;CurrentDate;
+00476 }
+00477 ps-&gt;_LastUpdateDate = trav-&gt;CurrentDate;
+00478 <font class="keywordflow">if</font> (animate)
+00479 {
+00480 <font class="keyword">const</font> CMatrix &amp;mat= HrcObs-&gt;WorldMatrix;
+00481 ps-&gt;setSysMat(mat);
+00482 ps-&gt;setViewMat(trav-&gt;ViewMatrix);
+00483 psm-&gt;updateOpacityInfos();
+00484
+00485 <font class="comment">//ps-&gt;setSysMat(psm-&gt;getWorldMatrix());</font>
+00486 <a class="code" href="debug_8h.html#a6">nlassert</a>(ps-&gt;getScene());
+00487
+00488
+00489 <font class="comment">// setup the number of faces we allow</font>
+00490 ps-&gt;setNumTris((uint) psm-&gt;getNumTrianglesAfterLoadBalancing());
+00491
+00492
+00493 <font class="comment">// set the global user param that are bypassed</font>
+00494 <a class="code" href="debug_8h.html#a16">nlctassert</a>(<a class="code" href="namespaceNL3D.html#a165">MaxPSUserParam</a> &lt; 8); <font class="comment">// there should be less than 8 parameters because of mask stored in a byte</font>
+00495 ps-&gt;_BypassGlobalUserParam = psm-&gt;_BypassGlobalUserParam;
+00496
+00497 <font class="comment">// setup system user parameters for parameters that have been touched</font>
+00498 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="namespaceNL3D.html#a165">MaxPSUserParam</a>; ++k)
+00499 {
+00500 <font class="keywordflow">if</font> (psm-&gt;isTouched((uint)CParticleSystemModel::PSParam0 + k))
+00501 {
+00502 ps-&gt;setUserParam(k, psm-&gt;_UserParam[k].Value);
+00503 psm-&gt;clearFlag((uint)CParticleSystemModel::PSParam0 + k);
+00504 }
+00505 }
+00506
+00507 <font class="keywordflow">if</font> (ps-&gt;getAnimType() != CParticleSystem::AnimAlways) <font class="comment">// if the animation is always perfomed, then its done by the particle system manager</font>
+00508 {
+00509 <font class="keywordflow">if</font> (psm-&gt;isAutoGetEllapsedTimeEnabled())
+00510 {
+00511 psm-&gt;setEllapsedTime(ps-&gt;getScene()-&gt;getEllapsedTime() * psm-&gt;getEllapsedTimeRatio());
+00512 }
+00513 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> delay = psm-&gt;getEllapsedTime();
+00514 <font class="comment">// animate particles </font>
+00515 ps-&gt;step(CParticleSystem::Anim, delay);
+00516 }
+00517 }
+00518 }
+00519
+00520
+00521 <font class="comment">// add a render obs if in cluster &amp; not hidden</font>
+00522 <font class="keywordflow">if</font> (psm-&gt;_InClusterAndVisible)
+00523 {
+00524 trav-&gt;RenderTrav-&gt;addRenderObs(ClipObs-&gt;RenderObs);
+00525 }
+00526 }
+00527
+00528
+00529
+00531 <font class="comment">// CParticleSystemRenderObs implementation //</font>
+<a name="l00533"></a><a class="code" href="classNL3D_1_1CParticleSystemRenderObs.html#a0">00533</a> <font class="comment">void CParticleSystemRenderObs::traverse(IObs *caller)</font>
+00534 {
+00535
+00536
+00537
+00538 <font class="comment">/*</font>
+00539 <font class="comment"> if (!psm-&gt;_OutOfFrustum)</font>
+00540 <font class="comment"> {*/</font>
+00541 CTransformShapeRenderObs::traverse(caller);
+00542 <font class="comment">//}</font>
+00543 }
+00544
+00545
+00546 <font class="comment">/*</font>
+00547 <font class="comment"> * CParticleSystemClipObs implementation </font>
+00548 <font class="comment"> * IMPORTANT : the Visible attribute is interpreted as 'in traversed clusters'. We need this because we want</font>
+00549 <font class="comment"> * to know when a p.s is in clusters, but not visible. As a matter of fact we may need to have system that are animated</font>
+00550 <font class="comment"> * as long as in cluster, but not visible. </font>
+00551 <font class="comment"> */</font>
+00552
+<a name="l00553"></a><a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a0">00553</a> <font class="keywordtype">void</font> CParticleSystemClipObs::traverse(IObs *caller)
+00554 {
+00555 <a class="code" href="hierarchical__timer_8h.html#a4">H_AUTO</a> ( NL3D_Particles_Clip );
+00556
+00557 <font class="comment">// CTransformClipObs::traverse(caller);</font>
+00558 <a class="code" href="classNL3D_1_1IObs.html#z620_0">traverseSons</a>();
+00559 <a class="code" href="debug_8h.html#a6">nlassert</a>(!caller || dynamic_cast&lt;IBaseClipObs*&gt;(caller));
+00560 CParticleSystemModel *m= (CParticleSystemModel*)<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>;
+00561 <font class="keywordflow">if</font> (m-&gt;_Invalidated) <font class="keywordflow">return</font>;
+00562 CClipTrav *trav= (CClipTrav*)<a class="code" href="classNL3D_1_1IObs.html#m1">Trav</a>;
+00563
+00564
+00565 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CTransformClipObs.html#m0">Date</a> != trav-&gt;CurrentDate)
+00566 {
+00567 m-&gt;_InsertedInVisibleList = <font class="keyword">false</font>;
+00568 m-&gt;_InClusterAndVisible = <font class="keyword">false</font>;
+00569 <a class="code" href="classNL3D_1_1CTransformClipObs.html#m0">Date</a> = trav-&gt;CurrentDate;
+00570 }
+00571 <font class="keywordflow">if</font> (m-&gt;_InClusterAndVisible) <font class="keywordflow">return</font>; <font class="comment">// already visible</font>
+00572
+00573
+00574 CParticleSystem *ps = m-&gt;_ParticleSystem;
+00575
+00576
+00577 <font class="keywordflow">if</font> (ps) <font class="comment">// system instanciated</font>
+00578 {
+00579 <font class="comment">// if there are no more particles, no need to even clip..</font>
+00580 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a2">checkDestroyCondition</a>(ps, m)) <font class="keywordflow">return</font>;
+00581 }
+00582
+00583 <font class="comment">// special case : system sticked to a skeleton</font>
+00584 <font class="keywordflow">if</font>( ((CTransformHrcObs*)<a class="code" href="classNL3D_1_1IBaseClipObs.html#m0">HrcObs</a>)-&gt;_AncestorSkeletonModel!=NULL )
+00585 {
+00586 <font class="keywordtype">bool</font> visible = ((CTransformHrcObs*)<a class="code" href="classNL3D_1_1IBaseClipObs.html#m0">HrcObs</a>)-&gt;_AncestorSkeletonModel-&gt;isClipVisible();
+00587 <font class="comment">// Special test: if we are sticked to a skeletonModel, and if we are still visible, maybe we don't have to</font>
+00588 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> &amp;&amp; m-&gt;_FatherSkeletonModel)
+00589 {
+00590 CClipTrav *clipTrav= NLMISC::safe_cast&lt;CClipTrav*&gt;(Trav);
+00591
+00592 <font class="comment">// if our skeletonModel father is displayed with a Lod, maybe we are not to be displayed</font>
+00593 <font class="keywordflow">if</font>(m-&gt;_FatherSkeletonModel-&gt;isDisplayedAsLodCharacter())
+00594 {
+00595 <font class="comment">// We are visible only if we where sticked to the skeleton with forceCLod==true.</font>
+00596 <font class="comment">// This is also true if we are actually a skeletonModel</font>
+00597 <font class="keywordflow">if</font>(!m-&gt;getShowWhenLODSticked())
+00598 <font class="comment">// otherWise we are not visible. eg: this is the case of skins and some sticked object</font>
+00599 visible = <font class="keyword">false</font>;
+00600 }
+00601 }
+00602 <font class="comment">//</font>
+00603 <font class="keywordflow">if</font> (visible)
+00604 {
+00605 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">true</font>;
+00606 <a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a1">insertInVisibleList</a>();
+00607 m-&gt;_InClusterAndVisible = <font class="keyword">true</font>;
+00608 <font class="keywordflow">return</font>;
+00609 }
+00610 <font class="keywordflow">else</font> <font class="comment">// not visible, may need animation however..</font>
+00611 {
+00612 <font class="keywordflow">if</font> (!ps) <font class="comment">// no resc allocated</font>
+00613 {
+00614 CParticleSystemShape *pss= NLMISC::safe_cast&lt;CParticleSystemShape *&gt;((IShape *)m-&gt;Shape);
+00615 <a class="code" href="debug_8h.html#a6">nlassert</a>(pss);
+00616 <font class="comment">// invalidate the system if too far</font>
+00617 <font class="keyword">const</font> CVector pos = m-&gt;getMatrix().getPos();
+00618 <font class="keyword">const</font> CVector d = pos - trav-&gt;CamPos;
+00619 <font class="keywordflow">if</font> (d * d &gt; pss-&gt;_MaxViewDist * pss-&gt;_MaxViewDist)
+00620 {
+00621 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">false</font>;
+00622 <font class="keywordflow">if</font> (pss-&gt;_DestroyModelWhenOutOfRange)
+00623 {
+00624 m-&gt;_Invalidated = <font class="keyword">true</font>;
+00625 }
+00626 }
+00627 }
+00628 <font class="keywordflow">else</font>
+00629 {
+00630 <font class="comment">// NB : The test to see wether the system is not too far is performed by the particle system manager </font>
+00631 <font class="keywordflow">if</font> (!m-&gt;_EditionMode)
+00632 {
+00633 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">true</font>; <font class="comment">// system near, but maybe not in cluster..</font>
+00634 <a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a1">insertInVisibleList</a>();
+00635 }
+00636 }
+00637 }
+00638 <font class="keywordflow">return</font>;
+00639 }
+00640
+00641
+00642 <font class="comment">//</font>
+00643 <font class="keyword">const</font> std::vector&lt;CPlane&gt; &amp;pyramid= trav-&gt;WorldPyramid;
+00648 <font class="comment">// now the pyramid is directly expressed in the world</font>
+00649 <font class="keyword">const</font> CMatrix &amp;mat= <a class="code" href="classNL3D_1_1IBaseClipObs.html#m0">HrcObs</a>-&gt;WorldMatrix;
+00650
+00651
+00652 <font class="comment">// Transform the pyramid in Object space.</font>
+00653
+00654
+00655 <font class="keywordflow">if</font>(!ps)
+00656 {
+00657 CParticleSystemShape *pss= NLMISC::safe_cast&lt;CParticleSystemShape *&gt;((IShape *)m-&gt;Shape);
+00658 <a class="code" href="debug_8h.html#a6">nlassert</a>(pss);
+00659
+00660 <font class="comment">// the system wasn't present the last time, we use its center to see if it's back in the view frustum,</font>
+00661 <font class="comment">// or if it is near enough.</font>
+00662 <font class="comment">// if this is the case, we say it isn't clipped, so it will be reinstanciated from the shape</font>
+00663 <font class="comment">// during the DetailAnimTraversal</font>
+00664
+00665 <font class="keyword">const</font> CVector pos = m-&gt;getMatrix().getPos();
+00666
+00667 <font class="keyword">const</font> CVector d = pos - trav-&gt;CamPos;
+00668
+00669
+00670 <font class="comment">// check wether system not too far </font>
+00671 <font class="keywordflow">if</font> (d * d &gt; pss-&gt;_MaxViewDist * pss-&gt;_MaxViewDist)
+00672 {
+00673 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">false</font>;
+00674 <font class="keywordflow">if</font> (pss-&gt;_DestroyModelWhenOutOfRange)
+00675 {
+00676 m-&gt;_Invalidated = <font class="keyword">true</font>;
+00677 }
+00678 <font class="keywordflow">return</font>;
+00679 }
+00680
+00681 <font class="comment">// test the shape to see wether we have a precomputed bbox</font>
+00682 <font class="keywordflow">if</font> (!pss-&gt;_UsePrecomputedBBox)
+00683 {
+00686 <font class="keywordflow">for</font>(sint i=0; i &lt; (sint)pyramid.size(); i++)
+00687 {
+00688 <font class="keywordflow">if</font> ( (pyramid[i] * mat ).d &gt; 0.0f ) <font class="comment">// in its basis, the system is at the center</font>
+00689
+00690 {
+00691 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">true</font>;
+00692 <a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a1">insertInVisibleList</a>();
+00693 <font class="keywordflow">return</font>;
+00694 }
+00695 }
+00696
+00697 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">true</font>;
+00698 <a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a1">insertInVisibleList</a>();
+00699 m-&gt;_InClusterAndVisible = <font class="keyword">true</font>;
+00700 <font class="keywordflow">return</font>;
+00701 }
+00702 <font class="keywordflow">else</font>
+00703 {
+00706 <font class="keywordflow">for</font>(sint i=0; i &lt; (sint)pyramid.size(); i++)
+00707 {
+00708 <font class="keywordflow">if</font> ( !pss-&gt;_PrecomputedBBox.clipBack(pyramid[i] * mat ) )
+00709 {
+00710
+00711 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">true</font>;
+00712 <a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a1">insertInVisibleList</a>();
+00713 <font class="keywordflow">return</font>;
+00714 }
+00715 }
+00716
+00717 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">true</font>;
+00718 <a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a1">insertInVisibleList</a>();
+00719 m-&gt;_InClusterAndVisible = <font class="keyword">true</font>;
+00720 <font class="keywordflow">return</font>;
+00721
+00722 }
+00723 }
+00724
+00725 <font class="comment">//=========================================================================================================</font>
+00726 <font class="comment">// the system is already instanciated</font>
+00727
+00728 <a class="code" href="debug_8h.html#a6">nlassert</a>(ps);
+00730 <font class="keywordflow">if</font> (m-&gt;checkAgainstPyramid(pyramid) == <font class="keyword">false</font>)
+00731 {
+00732 <font class="keywordflow">if</font> (!m-&gt;_EditionMode)
+00733 {
+00734 <font class="comment">// system near, but maybe not in cluster.. </font>
+00735 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">true</font>;
+00736 <a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a1">insertInVisibleList</a>();
+00737 }
+00738 <font class="keywordflow">return</font>;
+00739 }
+00740
+00741
+00742 <a class="code" href="classNL3D_1_1IBaseClipObs.html#m4">Visible</a> = <font class="keyword">true</font>;
+00743 <a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a1">insertInVisibleList</a>();
+00744 m-&gt;_InClusterAndVisible = <font class="keyword">true</font>;
+00745 }
+00746
+00747 <font class="comment">//===================================================================</font>
+<a name="l00748"></a><a class="code" href="classNL3D_1_1CParticleSystemClipObs.html#a2">00748</a> <font class="keywordtype">bool</font> CParticleSystemClipObs::checkDestroyCondition(CParticleSystem *ps, CParticleSystemModel *m)
+00749 {
+00750 <a class="code" href="debug_8h.html#a6">nlassert</a>(ps &amp;&amp; m);
+00751 <font class="keywordflow">if</font> (!m-&gt;_EditionMode)
+00752 {
+00756 <font class="keywordflow">if</font> (ps-&gt;getAnimType() != CParticleSystem::AnimAlways)
+00757 {
+00758 <font class="comment">// test deletion condition (no more particle, no more particle and emitters)</font>
+00759 <font class="keywordflow">if</font> (ps-&gt;getDestroyCondition() != CParticleSystem::none)
+00760 {
+00761 <font class="keywordflow">if</font> (ps-&gt;getSystemDate() &gt; ps-&gt;getDelayBeforeDeathConditionTest())
+00762 {
+00763 <font class="keywordflow">switch</font> (ps-&gt;getDestroyCondition())
+00764 {
+00765 <font class="keywordflow">case</font> CParticleSystem::noMoreParticles:
+00766 <font class="keywordflow">if</font> (!ps-&gt;hasParticles())
+00767 {
+00768 m-&gt;releaseRscAndInvalidate();
+00769 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00770 }
+00771 <font class="keywordflow">break</font>;
+00772 <font class="keywordflow">case</font> CParticleSystem::noMoreParticlesAndEmitters:
+00773 <font class="keywordflow">if</font> (!ps-&gt;hasParticles() &amp;&amp; !ps-&gt;hasEmitters())
+00774 {
+00775 m-&gt;releaseRscAndInvalidate();
+00776 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00777 }
+00778 <font class="keywordflow">break</font>;
+00779 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
+00780 }
+00781 }
+00782 }
+00783 }
+00784 }
+00785 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00786 }
+00787
+00788 <font class="comment">//===================================================================</font>
+<a name="l00789"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_5">00789</a> <font class="keywordtype">void</font> CParticleSystemModel::bypassGlobalUserParamValue(uint userParamIndex,<font class="keywordtype">bool</font> byPass <font class="comment">/*=true*/</font>)
+00790 {
+00791 <a class="code" href="debug_8h.html#a16">nlctassert</a>(<a class="code" href="namespaceNL3D.html#a165">MaxPSUserParam</a> &lt; 8); <font class="comment">// there should be less than 8 parameters because of mask stored in a byte</font>
+00792 <a class="code" href="debug_8h.html#a6">nlassert</a>(userParamIndex &lt; <a class="code" href="namespaceNL3D.html#a165">MaxPSUserParam</a>);
+00793 <font class="keywordflow">if</font> (byPass) <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o16">_BypassGlobalUserParam</a> |= (1 &lt;&lt; userParamIndex);
+00794 <font class="keywordflow">else</font> <a class="code" href="classNL3D_1_1CParticleSystemModel.html#o16">_BypassGlobalUserParam</a> &amp;= ~(1 &lt;&lt; userParamIndex);
+00795 }
+00796
+00797 <font class="comment">//===================================================================</font>
+<a name="l00798"></a><a class="code" href="classNL3D_1_1CParticleSystemModel.html#z662_6">00798</a> <font class="keywordtype">bool</font> CParticleSystemModel::isGlobalUserParamValueBypassed(uint userParamIndex)<font class="keyword"> const</font>
+00799 <font class="keyword"></font>{
+00800 <a class="code" href="debug_8h.html#a16">nlctassert</a>(<a class="code" href="namespaceNL3D.html#a165">MaxPSUserParam</a> &lt; 8); <font class="comment">// there should be less than 8 parameters because of mask stored in a byte</font>
+00801 <a class="code" href="debug_8h.html#a6">nlassert</a>(userParamIndex &lt; <a class="code" href="namespaceNL3D.html#a165">MaxPSUserParam</a>);
+00802 <font class="keywordflow">return</font> (<a class="code" href="classNL3D_1_1CParticleSystemModel.html#o16">_BypassGlobalUserParam</a> &amp; (1 &lt;&lt; userParamIndex)) != 0;
+00803 }
+00804
+00805
+00806 } <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>