aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/ps__located_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/ps__located_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/ps__located_8cpp-source.html1818
1 files changed, 1818 insertions, 0 deletions
diff --git a/docs/doxygen/nel/ps__located_8cpp-source.html b/docs/doxygen/nel/ps__located_8cpp-source.html
new file mode 100644
index 00000000..53605158
--- /dev/null
+++ b/docs/doxygen/nel/ps__located_8cpp-source.html
@@ -0,0 +1,1818 @@
+<!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>ps_located.cpp</h1><a href="ps__located_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
+00029
+00030 <font class="preprocessor">#include &lt;algorithm&gt;</font>
+00031 <font class="preprocessor">#include "<a class="code" href="aabbox_8h.html">nel/misc/aabbox.h</a>"</font>
+00032 <font class="preprocessor">#include "<a class="code" href="matrix_8h.html">nel/misc/matrix.h</a>"</font>
+00033 <font class="preprocessor">#include "<a class="code" href="ps__util_8h.html">3d/ps_util.h</a>"</font>
+00034 <font class="preprocessor">#include "<a class="code" href="particle__system_8h.html">3d/particle_system.h</a>"</font>
+00035 <font class="preprocessor">#include "<a class="code" href="ps__zone_8h.html">3d/ps_zone.h</a>"</font>
+00036 <font class="preprocessor">#include "<a class="code" href="driver_8h.html">3d/driver.h</a>"</font>
+00037 <font class="preprocessor">#include "<a class="code" href="material_8h.html">3d/material.h</a>"</font>
+00038 <font class="preprocessor">#include "<a class="code" href="dru_8h.html">3d/dru.h</a>"</font>
+00039 <font class="preprocessor">#include "<a class="code" href="ps__located_8h.html">3d/ps_located.h</a>"</font>
+00040 <font class="preprocessor">#include "<a class="code" href="ps__particle_8h.html">3d/ps_particle.h</a>"</font>
+00041 <font class="preprocessor">#include "<a class="code" href="ps__force_8h.html">3d/ps_force.h</a>"</font>
+00042 <font class="preprocessor">#include "<a class="code" href="ps__emitter_8h.html">3d/ps_emitter.h</a>"</font>
+00043 <font class="preprocessor">#include "<a class="code" href="ps__misc_8h.html">3d/ps_misc.h</a>"</font>
+00044
+00045 <font class="preprocessor">#include "<a class="code" href="line_8h.html">nel/misc/line.h</a>"</font>
+00046 <font class="preprocessor">#include "<a class="code" href="system__info_8h.html">nel/misc/system_info.h</a>"</font>
+00047 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font>
+00048
+00049 <font class="keyword">namespace </font>NL3D {
+00050
+00051
+00052
+00053
+<a name="l00057"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a0">00057</a> CPSLocated::CPSLocated() : _MaxNumFaces(0),
+00058 _Name(std::string("located")),
+00059 _NbFramesToSkip(0),
+00060 _MaxSize(<a class="code" href="namespaceNL3D.html#a200">DefaultMaxLocatedInstance</a>),
+00061 _Size(0),
+00062 _LastForever(true),
+00063 _CollisionInfo(NULL),
+00064 _CollisionInfoNbRef(0),
+00065 _InitialLife(1.f),
+00066 _LifeScheme(NULL),
+00067 _InitialMass(1.f),
+00068 _MassScheme(NULL),
+00069 _UpdateLock(false),
+00070 _LODDegradation(false),
+00071 _NonIntegrableForceNbRefs(0),
+00072 _NumIntegrableForceWithDifferentBasis(0),
+00073 _TriggerOnDeath(false),
+00074 _TriggerID((uint32) 'NONE'),
+00075 _ParametricMotion(false)
+00076 {
+00077 }
+00078
+00079
+00080
+<a name="l00082"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a7">00082</a> <font class="keywordtype">void</font> CPSLocated::releaseRefTo(<font class="keyword">const</font> CParticleSystemProcess *other)
+00083 {
+00084 <font class="comment">// located bindables</font>
+00085 {
+00086 <font class="keywordflow">for</font>(TLocatedBoundCont::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00087 {
+00088 (*it)-&gt;releaseRefTo(other);
+00089 }
+00090 }
+00091 <font class="comment">// dtor observers</font>
+00092 {
+00093
+00094 <font class="keywordflow">for</font>(TDtorObserversVect::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.end(); ++it)
+00095 {
+00096 <font class="keywordflow">if</font> ((*it)-&gt;getOwner() == other)
+00097 {
+00098 CPSLocatedBindable *refMaker = *it;
+00099 refMaker-&gt;notifyTargetRemoved(<font class="keyword">this</font>);
+00100 <font class="keywordflow">break</font>;
+00101 }
+00102 }
+00103 }
+00104 }
+00105
+<a name="l00107"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a8">00107</a> <font class="keywordtype">void</font> CPSLocated::releaseAllRef()
+00108 {
+00109 <font class="comment">// located bindables</font>
+00110 {
+00111 <font class="keywordflow">for</font>(TLocatedBoundCont::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00112 {
+00113 (*it)-&gt;releaseAllRef();
+00114 }
+00115 }
+00116
+00117 <font class="comment">// we must do a copy, because the subsequent call can modify this vector</font>
+00118 <a class="code" href="classNL3D_1_1CPSLocated.html#t2">TDtorObserversVect</a> copyVect(<a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.begin(), <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.end());
+00119 <font class="comment">// call all the dtor observers</font>
+00120 <font class="keywordflow">for</font> (TDtorObserversVect::iterator it = copyVect.begin(); it != copyVect.end(); ++it)
+00121 {
+00122 (*it)-&gt;notifyTargetRemoved(<font class="keyword">this</font>);
+00123 }
+00124 <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.clear();
+00125
+00126 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n13">_CollisionInfoNbRef</a> == 0); <font class="comment">//If this is not = 0, then someone didnt call releaseCollisionInfo</font>
+00127 <font class="comment">// If this happen, you can register with the registerDTorObserver</font>
+00128 <font class="comment">// (observer pattern)</font>
+00129 <font class="comment">// and override notifyTargetRemove to call releaseCollisionInfo</font>
+00130 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.size() == 0);
+00131 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n22">_NonIntegrableForceNbRefs</a> == 0);
+00132 <a class="code" href="debug_8h.html#a6">nlassert</a>(!<a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>);
+00133 }
+00134
+00135
+<a name="l00137"></a><a class="code" href="classNL3D_1_1CPSLocated.html#b5">00137</a> <font class="keywordtype">void</font> CPSLocated::notifyMotionTypeChanged(<font class="keywordtype">void</font>)
+00138 {
+00139 <font class="keywordflow">for</font> (TLocatedBoundCont::const_iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00140 {
+00141 (*it)-&gt;motionTypeChanged(<a class="code" href="classNL3D_1_1CPSLocated.html#n27">_ParametricMotion</a>);
+00142 }
+00143 }
+00144
+00145
+<a name="l00147"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a77">00147</a> <font class="keywordtype">void</font> CPSLocated::integrateSingle(<font class="keywordtype">float</font> startDate, <font class="keywordtype">float</font> deltaT, uint numStep,
+00148 uint32 indexInLocated,
+00149 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> *destPos,
+00150 uint <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a> <font class="comment">/*= sizeof(NLMISC::CVector)*/</font>)
+00151 {
+00152 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#a72">supportParametricMotion</a>() &amp;&amp; <a class="code" href="classNL3D_1_1CPSLocated.html#n27">_ParametricMotion</a>);
+00153 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.size() != 0)
+00154 {
+00155 <font class="keywordtype">bool</font> accumulate = <font class="keyword">false</font>;
+00156 <font class="keywordflow">for</font> (TForceVect::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.end(); ++it)
+00157 {
+00158 <a class="code" href="debug_8h.html#a6">nlassert</a>((*it)-&gt;isIntegrable());
+00159 (*it)-&gt;integrateSingle(startDate, deltaT, numStep, <font class="keyword">this</font>, indexInLocated, destPos, accumulate, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>);
+00160 accumulate = <font class="keyword">true</font>;
+00161 }
+00162 }
+00163 <font class="keywordflow">else</font> <font class="comment">// no forces applied, just deduce position from date, initial pos and speed</font>
+00164 {
+00165 <font class="preprocessor"> #ifdef NL_DEBUG</font>
+00166 <font class="preprocessor"></font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> *endPos = (<a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> *) ( (uint8 *) destPos + <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a> * numStep);
+00167 <font class="preprocessor"> #endif</font>
+00168 <font class="preprocessor"></font> <font class="keyword">const</font> CPSLocated::CParametricInfo &amp;pi = <a class="code" href="classNL3D_1_1CPSLocated.html#m0">_PInfo</a>[indexInLocated];
+00169 destPos = <a class="code" href="namespaceNL3D.html#a436">FillBufUsingSubdiv</a>(pi.Pos, pi.Date, startDate, deltaT, numStep, destPos, <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>);
+00170 <font class="keywordflow">if</font> (numStep != 0)
+00171 {
+00172 <font class="keywordtype">float</font> currDate = startDate - pi.Date;
+00173 <a class="code" href="debug_8h.html#a6">nlassert</a>(currDate &gt;= 0);
+00174 <font class="keywordflow">do</font>
+00175 {
+00176 <font class="preprocessor"> #ifdef NL_DEBUG</font>
+00177 <font class="preprocessor"></font> <a class="code" href="debug_8h.html#a6">nlassert</a>(destPos &lt; endPos);
+00178 <font class="preprocessor"> #endif </font>
+00179 <font class="preprocessor"></font> destPos-&gt;<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> = pi.Pos.x + currDate * pi.Speed.x;
+00180 destPos-&gt;<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> = pi.Pos.y + currDate * pi.Speed.y;
+00181 destPos-&gt;<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> = pi.Pos.z + currDate * pi.Speed.z;
+00182 currDate += deltaT;
+00183 destPos = (<a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> *) ( (uint8 *) destPos + <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>);
+00184 }
+00185 <font class="keywordflow">while</font> (--numStep);
+00186 }
+00187 }
+00188 }
+00189
+<a name="l00190"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a75">00190</a> <font class="keywordtype">void</font> CPSLocated::performParametricMotion(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> date, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> realEllapsedTime)
+00191 {
+00192 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>) <font class="keywordflow">return</font>;
+00193 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#a72">supportParametricMotion</a>() &amp;&amp; <a class="code" href="classNL3D_1_1CPSLocated.html#n27">_ParametricMotion</a>);
+00194
+00195 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.size() != 0)
+00196 {
+00197 <font class="keywordtype">bool</font> accumulate = <font class="keyword">false</font>;
+00198 <font class="keywordflow">for</font> (TForceVect::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.end(); ++it)
+00199 {
+00200 <a class="code" href="debug_8h.html#a6">nlassert</a>((*it)-&gt;isIntegrable());
+00201 (*it)-&gt;integrate(date, <font class="keyword">this</font>, 0, <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>, &amp;<a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>[0], &amp;<a class="code" href="classNL3D_1_1CPSLocated.html#n9">_Speed</a>[0], accumulate);
+00202 accumulate = <font class="keyword">true</font>;
+00203 }
+00204 }
+00205 <font class="keywordflow">else</font>
+00206 {
+00207 CPSLocated::TPSAttribParametricInfo::const_iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#m0">_PInfo</a>.begin(),
+00208 endIt = <a class="code" href="classNL3D_1_1CPSLocated.html#m0">_PInfo</a>.end();
+00209 TPSAttribVector::iterator posIt = <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.begin();
+00210 <font class="keywordtype">float</font> deltaT;
+00211 <font class="keywordflow">do</font>
+00212 {
+00213 deltaT = date - it-&gt;Date;
+00214 posIt-&gt;x = it-&gt;Pos.x + deltaT * it-&gt;Speed.x;
+00215 posIt-&gt;y = it-&gt;Pos.y + deltaT * it-&gt;Speed.y;
+00216 posIt-&gt;z = it-&gt;Pos.z + deltaT * it-&gt;Speed.z;
+00217 ++posIt;
+00218 ++it;
+00219 }
+00220 <font class="keywordflow">while</font> (it != endIt);
+00221 }
+00222 <font class="comment">//step(PSEmit, ellapsedTime, realEllapsedTime); </font>
+00223 }
+00224
+<a name="l00226"></a><a class="code" href="classNL3D_1_1CPSLocated.html#b3">00226</a> <font class="keywordtype">void</font> CPSLocated::allocateParametricInfos(<font class="keywordtype">void</font>)
+00227 {
+00228 <font class="keywordflow">if</font> (_ParametricMotion) <font class="keywordflow">return</font>;
+00229 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#a72">supportParametricMotion</a>());
+00230 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>);
+00231 <font class="keyword">const</font> <font class="keywordtype">float</font> date = <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getSystemDate();
+00232 <a class="code" href="classNL3D_1_1CPSLocated.html#m0">_PInfo</a>.resize(<a class="code" href="classNL3D_1_1CPSLocated.html#n4">_MaxSize</a>);
+00233 <font class="comment">// copy back infos from current position and speeds</font>
+00234 TPSAttribVector::const_iterator posIt = <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.begin(), endPosIt = <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.end();
+00235 TPSAttribVector::const_iterator speedIt = <a class="code" href="classNL3D_1_1CPSLocated.html#n9">_Speed</a>.begin();
+00236 <font class="keywordflow">while</font> (posIt != endPosIt)
+00237 {
+00238 <a class="code" href="classNL3D_1_1CPSLocated.html#m0">_PInfo</a>.insert( CParametricInfo(*posIt, *speedIt, date) );
+00239 ++posIt;
+00240 }
+00241 <a class="code" href="classNL3D_1_1CPSLocated.html#n27">_ParametricMotion</a> = <font class="keyword">true</font>;
+00242 <a class="code" href="classNL3D_1_1CPSLocated.html#b5">notifyMotionTypeChanged</a>();
+00243 }
+00244
+<a name="l00246"></a><a class="code" href="classNL3D_1_1CPSLocated.html#b4">00246</a> <font class="keywordtype">void</font> CPSLocated::releaseParametricInfos(<font class="keywordtype">void</font>)
+00247 {
+00248 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSLocated.html#n27">_ParametricMotion</a>) <font class="keywordflow">return</font>;
+00249 <a class="code" href="namespaceNLMISC.html#a222">NLMISC::contReset</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#m0">_PInfo</a>);
+00250 <a class="code" href="classNL3D_1_1CPSLocated.html#n27">_ParametricMotion</a> = <font class="keyword">false</font>;
+00251 <a class="code" href="classNL3D_1_1CPSLocated.html#b5">notifyMotionTypeChanged</a>();
+00252 }
+00253
+00254
+<a name="l00256"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a72">00256</a> <font class="keywordtype">bool</font> CPSLocated::supportParametricMotion(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+00257 <font class="keyword"></font>{
+00258 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocated.html#n22">_NonIntegrableForceNbRefs</a> == 0 &amp;&amp; <a class="code" href="classNL3D_1_1CPSLocated.html#n23">_NumIntegrableForceWithDifferentBasis</a> == 0;
+00259 }
+00260
+<a name="l00264"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a73">00264</a> <font class="keywordtype">void</font> CPSLocated::enableParametricMotion(<font class="keywordtype">bool</font> enable <font class="comment">/*= true*/</font>)
+00265 {
+00266 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#a72">supportParametricMotion</a>());
+00267 <font class="keywordflow">if</font> (enable)
+00268 {
+00269 <a class="code" href="classNL3D_1_1CPSLocated.html#b3">allocateParametricInfos</a>();
+00270 }
+00271 <font class="keywordflow">else</font>
+00272 {
+00273 <a class="code" href="classNL3D_1_1CPSLocated.html#b4">releaseParametricInfos</a>();
+00274 }
+00275 }
+00276
+00277
+<a name="l00278"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a71">00278</a> <font class="keywordtype">void</font> CPSLocated::setSystemBasis(<font class="keywordtype">bool</font> sysBasis)
+00279 {
+00280 <font class="keywordflow">if</font> (sysBasis != <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#a7">isInSystemBasis</a>())
+00281 {
+00282 <font class="keywordflow">for</font> (TLocatedBoundCont::const_iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00283 {
+00284 (*it)-&gt;basisChanged(sysBasis);
+00285 }
+00286
+00287 CParticleSystemProcess::setSystemBasis(sysBasis);
+00288
+00289 <font class="keywordflow">for</font> (TForceVect::iterator fIt = <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.begin(); fIt != <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.end(); ++fIt)
+00290 {
+00291 <a class="code" href="classNL3D_1_1CPSLocated.html#a84">integrableForceBasisChanged</a>( (*fIt)-&gt;getOwner()-&gt;isInSystemBasis() );
+00292 }
+00293 }
+00294 }
+00295
+<a name="l00296"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a69">00296</a> <font class="keywordtype">void</font> CPSLocated::notifyMaxNumFacesChanged(<font class="keywordtype">void</font>)
+00297 {
+00298 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>) <font class="keywordflow">return</font>;
+00299
+00300 <font class="comment">// we examine wether we have particle attached to us, and ask for the max number of faces they may want</font>
+00301 <a class="code" href="classNL3D_1_1CPSLocated.html#n0">_MaxNumFaces</a> = 0;
+00302 <font class="keywordflow">for</font> (TLocatedBoundCont::const_iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00303 {
+00304 <font class="keywordflow">if</font> ((*it)-&gt;getType() == <a class="code" href="namespaceNL3D.html#a203">PSParticle</a>)
+00305 {
+00306 uint maxNumFaces = ((CPSParticle *) (*it))-&gt;getMaxNumFaces();
+00308 <a class="code" href="classNL3D_1_1CPSLocated.html#n0">_MaxNumFaces</a> += maxNumFaces;
+00309 }
+00310 }
+00311 }
+00312
+00313
+<a name="l00314"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a70">00314</a> uint CPSLocated::querryMaxWantedNumFaces(<font class="keywordtype">void</font>)
+00315 {
+00316 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocated.html#n0">_MaxNumFaces</a>;
+00317 }
+00318
+00319
+<a name="l00321"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a65">00321</a> <font class="keywordtype">bool</font> CPSLocated::hasParticles(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+00322 <font class="keyword"></font>{
+00323 <font class="keywordflow">for</font> (TLocatedBoundCont::const_iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00324 {
+00325 <font class="keywordflow">if</font> ((*it)-&gt;getType() == <a class="code" href="namespaceNL3D.html#a203">PSParticle</a> &amp;&amp; (*it)-&gt;hasParticles()) <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00326 }
+00327 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00328 }
+00329
+<a name="l00331"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a66">00331</a> <font class="keywordtype">bool</font> CPSLocated::hasEmitters(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+00332 <font class="keyword"></font>{
+00333 <font class="keywordflow">for</font> (TLocatedBoundCont::const_iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00334 {
+00335 <font class="keywordflow">if</font> ((*it)-&gt;getType() == <a class="code" href="namespaceNL3D.html#a204">PSEmitter</a> &amp;&amp; (*it)-&gt;hasEmitters()) <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00336 }
+00337 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00338 }
+00339
+00340
+<a name="l00341"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a15">00341</a> <font class="keywordtype">void</font> CPSLocated::getLODVect(<a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, <font class="keywordtype">float</font> &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a>, <font class="keywordtype">bool</font> systemBasis)
+00342 {
+00343 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>);
+00344 <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getLODVect(v, <a class="code" href="driver__opengl__extension__def_8h.html#a378">offset</a>, systemBasis);
+00345 }
+00346
+00347
+00348
+<a name="l00349"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a49">00349</a> <font class="keywordtype">float</font> CPSLocated::getUserParam(uint numParam)<font class="keyword"> const</font>
+00350 <font class="keyword"></font>{
+00351 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>);
+00352 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getUserParam(numParam);
+00353 }
+00354
+<a name="l00355"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a14">00355</a> CScene *CPSLocated::getScene(<font class="keywordtype">void</font>)
+00356 {
+00357 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>);
+00358 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getScene();
+00359 }
+00360
+00361
+<a name="l00362"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a16">00362</a> <font class="keywordtype">void</font> CPSLocated::incrementNbDrawnParticles(uint <a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a>)
+00363 {
+00364 CParticleSystem::NbParticlesDrawn += <a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a>; <font class="comment">// for benchmark purpose </font>
+00365 }
+00366
+<a name="l00367"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a19">00367</a> <font class="keywordtype">void</font> CPSLocated::setInitialLife(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> lifeTime)
+00368 {
+00369 <a class="code" href="classNL3D_1_1CPSLocated.html#n6">_LastForever</a> = <font class="keyword">false</font>;
+00370 <a class="code" href="classNL3D_1_1CPSLocated.html#n14">_InitialLife</a> = lifeTime;
+00371 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSLocated.html#n15">_LifeScheme</a>;
+00372 <a class="code" href="classNL3D_1_1CPSLocated.html#n15">_LifeScheme</a> = NULL;
+00373
+00377 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>; ++k)
+00378 {
+00379 <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>[k] = 0.f;
+00380 }
+00381
+00382 }
+<a name="l00383"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a20">00383</a> <font class="keywordtype">void</font> CPSLocated::setLifeScheme(CPSAttribMaker&lt;float&gt; *scheme)
+00384 {
+00385 <a class="code" href="debug_8h.html#a6">nlassert</a>(scheme);
+00386 <a class="code" href="debug_8h.html#a6">nlassert</a>(!scheme-&gt;hasMemory()); <font class="comment">// scheme with memory is invalid there !!</font>
+00387 <a class="code" href="classNL3D_1_1CPSLocated.html#n6">_LastForever</a> = <font class="keyword">false</font>;
+00388 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSLocated.html#n15">_LifeScheme</a>;
+00389 <a class="code" href="classNL3D_1_1CPSLocated.html#n15">_LifeScheme</a> = scheme;
+00390 }
+<a name="l00391"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a24">00391</a> <font class="keywordtype">void</font> CPSLocated::setInitialMass(<font class="keywordtype">float</font> mass)
+00392 {
+00393 <a class="code" href="classNL3D_1_1CPSLocated.html#n16">_InitialMass</a> = mass;
+00394 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSLocated.html#n17">_MassScheme</a>;
+00395 <a class="code" href="classNL3D_1_1CPSLocated.html#n17">_MassScheme</a> = NULL;
+00396 }
+<a name="l00397"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a25">00397</a> <font class="keywordtype">void</font> CPSLocated::setMassScheme(CPSAttribMaker&lt;float&gt; *scheme)
+00398 {
+00399 <a class="code" href="debug_8h.html#a6">nlassert</a>(scheme);
+00400 <a class="code" href="debug_8h.html#a6">nlassert</a>(!scheme-&gt;hasMemory()); <font class="comment">// scheme with memory is invalid there !!</font>
+00401 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSLocated.html#n17">_MassScheme</a>;
+00402 <a class="code" href="classNL3D_1_1CPSLocated.html#n17">_MassScheme</a> = scheme;
+00403 }
+00404
+00405
+00406
+<a name="l00408"></a><a class="code" href="classNL3D_1_1CPSLocated.html#d0">00408</a> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;CPSLocated::getConversionMatrix(<font class="keyword">const</font> CPSLocated *A, <font class="keyword">const</font> CPSLocated *B)
+00409 {
+00410 <a class="code" href="debug_8h.html#a6">nlassert</a>(A-&gt;_Owner == B-&gt;_Owner); <font class="comment">// conversion must be made between entity of the same system</font>
+00411 <font class="keywordflow">if</font> (A-&gt;_SystemBasisEnabled == B-&gt;_SystemBasisEnabled)
+00412 {
+00413 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CMatrix.html#p0">NLMISC::CMatrix::Identity</a>;
+00414 }
+00415 <font class="keywordflow">else</font>
+00416 {
+00417 <font class="keywordflow">if</font> (B-&gt;_SystemBasisEnabled)
+00418 {
+00419 <font class="keywordflow">return</font> B-&gt;_Owner-&gt;getSysMat();
+00420 }
+00421 <font class="keywordflow">else</font>
+00422 {
+00423 <font class="keywordflow">return</font> A-&gt;_Owner-&gt;getInvertedSysMat();
+00424 }
+00425 }
+00426 }
+00427
+00428
+<a name="l00429"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a52">00429</a> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> CPSLocated::computeI(<font class="keywordtype">void</font>)<font class="keyword"> const </font>
+00430 <font class="keyword"></font>{
+00431 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n1">_SystemBasisEnabled</a>)
+00432 {
+00433 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getInvertedViewMat().getI();
+00434 }
+00435 <font class="keywordflow">else</font>
+00436 {
+00437 <font class="comment">// we must express the I vector in the system basis, so we need to multiply it by the inverted matrix of the system</font>
+00438 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getInvertedSysMat().mulVector(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getInvertedViewMat().getI());
+00439 }
+00440 }
+00441
+00442
+<a name="l00443"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a53">00443</a> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> CPSLocated::computeJ(<font class="keywordtype">void</font>)<font class="keyword"> const </font>
+00444 <font class="keyword"></font>{
+00445 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n1">_SystemBasisEnabled</a>)
+00446 {
+00447 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getInvertedViewMat().getJ();
+00448 }
+00449 <font class="keywordflow">else</font>
+00450 {
+00451 <font class="comment">// we must express the J vector in the system basis, so we need to multiply it by the inverted matrix of the system</font>
+00452 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getInvertedSysMat().mulVector(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getInvertedViewMat().getJ());
+00453 }
+00454 }
+00455
+00456
+00457
+<a name="l00458"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a54">00458</a> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> CPSLocated::computeK(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+00459 <font class="keyword"></font>{
+00460 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n1">_SystemBasisEnabled</a>)
+00461 {
+00462 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getInvertedViewMat().getK();
+00463 }
+00464 <font class="keywordflow">else</font>
+00465 {
+00466 <font class="comment">// we must express the K vector in the system basis, so we need to multiply it by the inverted matrix of the system</font>
+00467 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getInvertedSysMat().mulVector(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getInvertedViewMat().getK());
+00468 }
+00469 }
+00470
+00471
+00472
+<a name="l00473"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a48">00473</a> IDriver *CPSLocated::getDriver()<font class="keyword"> const </font>
+00474 <font class="keyword"></font>{
+00475 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>);
+00476 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getDriver() ); <font class="comment">// you haven't called setDriver on the system</font>
+00477 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getDriver();
+00478 }
+00479
+00481
+<a name="l00482"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a1">00482</a> CPSLocated::~CPSLocated()
+00483 {
+00484 <font class="comment">// we must do a copy, because the subsequent call can modify this vector</font>
+00485 <a class="code" href="classNL3D_1_1CPSLocated.html#t2">TDtorObserversVect</a> copyVect(<a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.begin(), <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.end());
+00486 <font class="comment">// call all the dtor observers</font>
+00487 <font class="keywordflow">for</font> (TDtorObserversVect::iterator it = copyVect.begin(); it != copyVect.end(); ++it)
+00488 {
+00489 (*it)-&gt;notifyTargetRemoved(<font class="keyword">this</font>);
+00490 }
+00491
+00492 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n13">_CollisionInfoNbRef</a> == 0); <font class="comment">//If this is not = 0, then someone didnt call releaseCollisionInfo</font>
+00493 <font class="comment">// If this happen, you can register with the registerDTorObserver</font>
+00494 <font class="comment">// (observer pattern)</font>
+00495 <font class="comment">// and override notifyTargetRemove to call releaseCollisionInfo</font>
+00496 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.size() == 0);
+00497 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n22">_NonIntegrableForceNbRefs</a> == 0);
+00498 <a class="code" href="debug_8h.html#a6">nlassert</a>(!<a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>);
+00499
+00500 <font class="comment">// delete all bindable</font>
+00501
+00502 <font class="keywordflow">for</font> (TLocatedBoundCont::iterator it2 = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it2 != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it2)
+00503 {
+00504 (*it2)-&gt;finalize();
+00505 <font class="keyword">delete</font> *it2;
+00506 }
+00507
+00508
+00509 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSLocated.html#n15">_LifeScheme</a>;
+00510 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSLocated.html#n17">_MassScheme</a>;
+00511 }
+00512
+00513
+00514
+<a name="l00518"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a2">00518</a> <font class="keywordtype">void</font> CPSLocated::bind(CPSLocatedBindable *lb)
+00519 {
+00520 <a class="code" href="debug_8h.html#a6">nlassert</a>(std::find(<a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(), <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(), lb) == <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end());
+00521 TLocatedBoundCont::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin();
+00522 <font class="keywordflow">while</font> (it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end() &amp;&amp; **it &lt; *lb) <font class="comment">// the "&lt;" operator sort them correctly</font>
+00523 {
+00524 ++it;
+00525 }
+00526
+00527 <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.insert(it, lb);
+00528 lb-&gt;setOwner(<font class="keyword">this</font>);
+00529 lb-&gt;resize(<a class="code" href="classNL3D_1_1CPSLocated.html#n4">_MaxSize</a>);
+00530
+00531 <font class="comment">// any located bindable that is bound to us should have no element in it for now !!</font>
+00532 <font class="comment">// we resize it anyway...</font>
+00533
+00534 uint32 initialSize = <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>;
+00535 <font class="keywordflow">for</font> (uint k = 0; k &lt; initialSize; ++k)
+00536 {
+00537 <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a> = k;
+00538 lb-&gt;newElement(NULL, 0);
+00539 }
+00540 <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a> = initialSize;
+00541
+00542
+00543 <font class="keywordflow">if</font> (_ParametricMotion) lb-&gt;motionTypeChanged(<font class="keyword">true</font>);
+00544
+00546 <a class="code" href="classNL3D_1_1CPSLocated.html#a69">notifyMaxNumFacesChanged</a>();
+00547 }
+00548
+00549
+00550
+<a name="l00551"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a6">00551</a> <font class="keywordtype">void</font> CPSLocated::remove(<font class="keyword">const</font> CPSLocatedBindable *p)
+00552 {
+00553 TLocatedBoundCont::iterator it = std::find(<a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(), <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(), p);
+00554 <a class="code" href="debug_8h.html#a6">nlassert</a>(it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end());
+00555 (*it)-&gt;finalize();
+00556 <font class="keyword">delete</font> *it;
+00557 <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.erase(it);
+00558 }
+00559
+00560
+<a name="l00561"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a61">00561</a> <font class="keywordtype">void</font> CPSLocated::registerDtorObserver(CPSLocatedBindable *anObserver)
+00562 {
+00563 <font class="comment">// check wether the observer wasn't registered twice</font>
+00564 <a class="code" href="debug_8h.html#a6">nlassert</a>(std::find(<a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.begin(), <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.end(), anObserver) == <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.end());
+00565 <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.push_back(anObserver);
+00566 }
+00567
+<a name="l00568"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a62">00568</a> <font class="keywordtype">void</font> CPSLocated::unregisterDtorObserver(CPSLocatedBindable *anObserver)
+00569 {
+00570 <font class="comment">// check that it was registered</font>
+00571 TDtorObserversVect::iterator it = std::find(<a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.begin(), <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.end(), anObserver);
+00572 <a class="code" href="debug_8h.html#a6">nlassert</a>(it != <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.end());
+00573 <a class="code" href="classNL3D_1_1CPSLocated.html#n20">_DtorObserversVect</a>.erase(it);
+00574 }
+00575
+00576
+00577
+00578
+00579
+<a name="l00584"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a12">00584</a> sint32 CPSLocated::newElement(<font class="keyword">const</font> CVector &amp;pos, <font class="keyword">const</font> CVector &amp;speed, CPSLocated *emitter, uint32 indexInEmitter, <font class="keywordtype">bool</font> basisConversionForSpeed, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime <font class="comment">/* = 0.f */</font>)
+00585 {
+00586 <font class="keywordflow">if</font> (_UpdateLock)
+00587 {
+00588 <a class="code" href="classNL3D_1_1CPSLocated.html#b1">postNewElement</a>(pos, speed);
+00589 <font class="keywordflow">return</font> -1;
+00590 }
+00591
+00592
+00593 <font class="keywordflow">if</font> (_CollisionInfo)
+00594 {
+00595 <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>-&gt;insert();
+00596 }
+00597
+00598 sint32 creationIndex;
+00599
+00600 <font class="comment">// get the convertion matrix from the emitter basis to the emittee basis</font>
+00601 <font class="comment">// if the emitter is null, we assume that the coordinate are given in the chosen basis for this particle type</font>
+00602
+00603
+00604
+00605 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n4">_MaxSize</a> == <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>) <font class="keywordflow">return</font> -1;
+00606
+00607 <font class="comment">// During creation, we interpolate the position of the system (by using the ellapsed time) if particle are created in world basis and if the emitter is in local basis.</font>
+00608 <font class="comment">// Example a fireball FX let particles in world basis, but the fireball is moving. If we dont interpolate position between 2 frames, emission will appear to be "sporadic".</font>
+00609 <font class="comment">// For now, we manage the local to world case. The world to local is possible, but not very useful</font>
+00610 <font class="keyword">const</font> CMatrix &amp;convMat = emitter ? CPSLocated::getConversionMatrix(<font class="keyword">this</font>, emitter)
+00611 : CMatrix::Identity;
+00612 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n1">_SystemBasisEnabled</a> &amp;&amp; emitter &amp;&amp; emitter-&gt;_SystemBasisEnabled)
+00613 {
+00614 <font class="comment">// Interpolate linearly position of the system based on the ellapsed time.</font>
+00615 <font class="comment">// The system keep track the ellapsed time passed in the call to step(), so it can compute the right position for us</font>
+00616 <font class="preprocessor"> #ifdef NL_DEBUG</font>
+00617 <font class="preprocessor"></font> <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>);
+00618 <font class="preprocessor"> #endif</font>
+00619 <font class="preprocessor"></font> CVector sysPosDelta;
+00620 <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;interpolatePosDelta(sysPosDelta, ellapsedTime);
+00621 creationIndex =<a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.insert(convMat * pos + sysPosDelta);
+00622 }
+00623 <font class="keywordflow">else</font>
+00624 {
+00625 creationIndex =<a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.insert(convMat * pos);
+00626 }
+00627 <a class="code" href="debug_8h.html#a6">nlassert</a>(creationIndex != -1); <font class="comment">// all attributs must contains the same number of elements</font>
+00628
+00629 <a class="code" href="classNL3D_1_1CPSLocated.html#n9">_Speed</a>.insert(basisConversionForSpeed ? convMat.mulVector(speed) : speed);
+00630
+00631
+00632
+00633 <a class="code" href="classNL3D_1_1CPSLocated.html#n7">_InvMass</a>.insert(1.f / ((<a class="code" href="classNL3D_1_1CPSLocated.html#n17">_MassScheme</a> &amp;&amp; emitter) ? <a class="code" href="classNL3D_1_1CPSLocated.html#n17">_MassScheme</a>-&gt;get(emitter, indexInEmitter) : <a class="code" href="classNL3D_1_1CPSLocated.html#n16">_InitialMass</a> ) );
+00634 <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>.insert(0.0f);
+00635 <font class="keyword">const</font> <font class="keywordtype">float</font> lifeTime = (<a class="code" href="classNL3D_1_1CPSLocated.html#n15">_LifeScheme</a> &amp;&amp; emitter) ? <a class="code" href="classNL3D_1_1CPSLocated.html#n15">_LifeScheme</a>-&gt;get(emitter, indexInEmitter) : <a class="code" href="classNL3D_1_1CPSLocated.html#n14">_InitialLife</a> ;
+00636 <a class="code" href="classNL3D_1_1CPSLocated.html#n11">_TimeIncrement</a>.insert( lifeTime ? 1.f / lifeTime : 10E6f);
+00637
+00638 <font class="comment">// test wether parametric motion is used, and generate the infos that are needed then</font>
+00639 <font class="keywordflow">if</font> (_ParametricMotion)
+00640 {
+00641 <a class="code" href="classNL3D_1_1CPSLocated.html#m0">_PInfo</a>.insert( CParametricInfo(<a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>[creationIndex], <a class="code" href="classNL3D_1_1CPSLocated.html#n9">_Speed</a>[creationIndex], <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getSystemDate() ) );
+00642 }
+00643
+00644
+00646 <font class="comment">// generate datas for all bound objects //</font>
+00648 <font class="comment"> _UpdateLock = true; </font>
+00649
+00650
+00651 <font class="keywordflow">for</font> (TLocatedBoundCont::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00652 {
+00653 (*it)-&gt;newElement(emitter, indexInEmitter);
+00654 }
+00655
+00656
+00657 <a class="code" href="classNL3D_1_1CPSLocated.html#n19">_UpdateLock</a> = <font class="keyword">false</font>;
+00658 ++<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>; <font class="comment">// if this is modified, you must also modify the getNewElementIndex in this class</font>
+00659 <font class="comment">// because that method give the index of the element being created for overrider of the newElement method</font>
+00660 <font class="comment">// of the CPSLocatedClass (which is called just above)</font>
+00661
+00662
+00663
+00664 <font class="keywordflow">return</font> creationIndex;
+00665 }
+00666
+<a name="l00667"></a><a class="code" href="classNL3D_1_1CPSLocated.html#b1">00667</a> <font class="keywordtype">void</font> CPSLocated::postNewElement(<font class="keyword">const</font> CVector &amp;pos, <font class="keyword">const</font> CVector &amp;speed)
+00668 {
+00669 <a class="code" href="classNL3D_1_1CPSLocated.html#n18">_RequestStack</a>.push(CPostNewElementRequestInfo(pos, speed));
+00670 }
+00671
+00672
+00673
+00674 <font class="keyword">static</font> <font class="keyword">inline</font> uint32 <a class="code" href="namespaceNL3D.html#a385">IDToLittleEndian</a>(uint32 input)
+00675 {
+00676 <font class="preprocessor"> #ifdef NL_LITTLE_ENDIAN</font>
+00677 <font class="preprocessor"></font> <font class="keywordflow">return</font> input;
+00678 <font class="preprocessor"> #else</font>
+00679 <font class="preprocessor"></font> <font class="keywordflow">return</font> ((input &amp; (0xff&lt;&lt;24))&gt;&gt;24)
+00680 || ((input &amp; (0xff&lt;&lt;16))&gt;&gt;8)
+00681 || ((input &amp; (0xff&lt;&lt;8))&lt;&lt;8)
+00682 || ((input &amp; 0xff)&lt;&lt;24);
+00683 <font class="preprocessor"> #endif</font>
+00684 <font class="preprocessor"></font>}
+00685
+<a name="l00690"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a13">00690</a> <font class="keywordtype">void</font> CPSLocated::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+00691 {
+00692 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>);
+00693
+00694 <font class="comment">// delete all bindable before : they may need our coordinate</font>
+00695 <font class="comment">// to perform a destruction task</font>
+00696
+00697 <a class="code" href="classNL3D_1_1CPSLocated.html#n19">_UpdateLock</a> = <font class="keyword">true</font>;
+00698
+00699
+00700 <font class="keywordflow">for</font> (TLocatedBoundCont::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00701 {
+00702 (*it)-&gt;deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00703 }
+00704
+00705
+00706 <a class="code" href="classNL3D_1_1CPSLocated.html#n19">_UpdateLock</a> = <font class="keyword">false</font>;
+00707
+00708 <font class="comment">// remove common located's attributes</font>
+00709
+00710 <a class="code" href="classNL3D_1_1CPSLocated.html#n7">_InvMass</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00711 <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00712 <a class="code" href="classNL3D_1_1CPSLocated.html#n9">_Speed</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00713 <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00714 <a class="code" href="classNL3D_1_1CPSLocated.html#n11">_TimeIncrement</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00715
+00716 <font class="keywordflow">if</font> (_CollisionInfo)
+00717 {
+00718 <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>-&gt;remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00719 }
+00720
+00721 <font class="keywordflow">if</font> (_ParametricMotion)
+00722 {
+00723 <a class="code" href="classNL3D_1_1CPSLocated.html#m0">_PInfo</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00724 }
+00725
+00726 --<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>;
+00727
+00728 <font class="keywordflow">if</font> (_TriggerOnDeath)
+00729 {
+00730 <font class="keyword">const</font> uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a> = <a class="code" href="namespaceNL3D.html#a385">IDToLittleEndian</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n26">_TriggerID</a>);
+00731 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>);
+00732 uint numLb = <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getNumLocatedBindableByExternID(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+00733 <font class="keywordflow">for</font> (uint k = 0; k &lt; numLb; ++k)
+00734 {
+00735 CPSLocatedBindable *lb = <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getLocatedBindableByExternID(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, k);
+00736 <font class="keywordflow">if</font> (lb-&gt;getType() == <a class="code" href="namespaceNL3D.html#a204">PSEmitter</a>)
+00737 {
+00738 CPSEmitter *e = NLMISC::safe_cast&lt;CPSEmitter *&gt;(lb);
+00739 <a class="code" href="debug_8h.html#a6">nlassert</a>(e-&gt;getOwner());
+00740 uint nbInstances = e-&gt;getOwner()-&gt;getSize();
+00741 <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> &lt; nbInstances; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
+00742 {
+00743 e-&gt;singleEmit(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, 1);
+00744 }
+00745 }
+00746 }
+00747 }
+00748 }
+00749
+00750
+00752
+<a name="l00753"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a46">00753</a> <font class="keywordtype">void</font> CPSLocated::resize(uint32 newSize)
+00754 {
+00755 <a class="code" href="debug_8h.html#a6">nlassert</a>(newSize &lt; (1 &lt;&lt; 16));
+00756 <font class="keywordflow">if</font> (newSize &lt; <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>)
+00757 {
+00758 <font class="keywordflow">for</font> (uint32 k = <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a> - 1; k &gt;= newSize; --k)
+00759 {
+00760 <a class="code" href="classNL3D_1_1CPSLocated.html#a13">deleteElement</a>(k);
+00761
+00762 <font class="keywordflow">if</font> (k == 0) <font class="keywordflow">break</font>; <font class="comment">// we're dealing with unsigned quantities</font>
+00763 }
+00764 <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a> = newSize;
+00765 }
+00766
+00767
+00768 <a class="code" href="classNL3D_1_1CPSLocated.html#n4">_MaxSize</a> = newSize;
+00769 <a class="code" href="classNL3D_1_1CPSLocated.html#n7">_InvMass</a>.resize(newSize);
+00770 <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.resize(newSize);
+00771 <a class="code" href="classNL3D_1_1CPSLocated.html#n9">_Speed</a>.resize(newSize);
+00772 <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>.resize(newSize);
+00773 <a class="code" href="classNL3D_1_1CPSLocated.html#n11">_TimeIncrement</a>.resize(newSize);
+00774
+00775 <font class="keywordflow">if</font> (_ParametricMotion)
+00776 {
+00777 <a class="code" href="classNL3D_1_1CPSLocated.html#m0">_PInfo</a>.resize(newSize);
+00778 }
+00779
+00780 <font class="keywordflow">if</font> (_CollisionInfo)
+00781 {
+00782 <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>-&gt;resize(newSize);
+00783 }
+00784
+00785
+00786
+00787 <font class="comment">// resize attributes for all bound objects</font>
+00788 <font class="keywordflow">for</font> (TLocatedBoundCont::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+00789 {
+00790 (*it)-&gt;resize(newSize);
+00791 }
+00792
+00793
+00795 <a class="code" href="classNL3D_1_1CPSLocated.html#a69">notifyMaxNumFacesChanged</a>();
+00796 }
+00797
+00798
+<a name="l00799"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a47">00799</a> <font class="keywordtype">void</font> CPSLocated::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+00800 {
+00801 sint ver = f.serialVersion(4);
+00802 CParticleSystemProcess::serial(f);
+00803
+00804 f.serial(_Name);
+00805
+00806 f.serial(_InvMass);
+00807 f.serial(_Pos);
+00808 f.serial(_Speed);
+00809 f.serial(_Time);
+00810 f.serial(_TimeIncrement);
+00811
+00812 f.serial(_Size);
+00813 f.serial(_MaxSize);
+00814
+00815 f.serial(_LastForever);
+00816
+00817 f.serialPtr(_CollisionInfo);
+00818 f.serial(_CollisionInfoNbRef);
+00819
+00820
+00821 <font class="keywordflow">if</font> (f.isReading())
+00822 {
+00823 <font class="keyword">delete</font> _LifeScheme;
+00824 <font class="keyword">delete</font> _MassScheme;
+00825
+00826 <font class="keywordtype">bool</font> useScheme;
+00827 f.serial(useScheme);
+00828 <font class="keywordflow">if</font> (useScheme)
+00829 {
+00830 f.serialPolyPtr(_LifeScheme);
+00831 }
+00832 <font class="keywordflow">else</font>
+00833 {
+00834 f.serial(_InitialLife);
+00835 _LifeScheme = NULL;
+00836 }
+00837
+00838 f.serial(useScheme);
+00839 <font class="keywordflow">if</font> (useScheme)
+00840 {
+00841 f.serialPolyPtr(_MassScheme);
+00842 }
+00843 <font class="keywordflow">else</font>
+00844 {
+00845 f.serial(_InitialMass);
+00846 <a class="code" href="debug_8h.html#a6">nlassert</a>(_InitialMass &gt; 0);
+00847 _MassScheme = NULL;
+00848 }
+00849 }
+00850 <font class="keywordflow">else</font>
+00851 {
+00852 <font class="keywordtype">bool</font> bFalse = <font class="keyword">false</font>, bTrue = <font class="keyword">true</font>;
+00853 <font class="keywordflow">if</font> (_LifeScheme)
+00854 {
+00855 f.serial(bTrue);
+00856 f.serialPolyPtr(_LifeScheme);
+00857 }
+00858 <font class="keywordflow">else</font>
+00859 {
+00860 f.serial(bFalse);
+00861 f.serial(_InitialLife);
+00862 }
+00863 <font class="keywordflow">if</font> (_MassScheme)
+00864 {
+00865 f.serial(bTrue);
+00866 f.serialPolyPtr(_MassScheme);
+00867 }
+00868 <font class="keywordflow">else</font>
+00869 {
+00870 f.serial(bFalse);
+00871 <a class="code" href="debug_8h.html#a6">nlassert</a>(_InitialMass &gt; 0);
+00872 f.serial(_InitialMass);
+00873 }
+00874 }
+00875
+00876
+00877 f.serial(_NbFramesToSkip);
+00878
+00879 f.serialContPolyPtr(_DtorObserversVect);
+00880
+00881 <font class="keywordflow">if</font> (f.isReading())
+00882 {
+00883 <font class="keywordflow">while</font>(!_RequestStack.empty())
+00884 {
+00885 _RequestStack.pop();
+00886 }
+00887 uint32 size;
+00888 f.serial(size);
+00889 <font class="keywordflow">for</font> (uint32 k = 0; k &lt; size; ++k)
+00890 {
+00891 TNewElementRequestStack::value_type <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>;
+00892 f.serial(<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
+00893 _RequestStack.push(<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
+00894 }
+00895 }
+00896 <font class="keywordflow">else</font>
+00897 {
+00898 <font class="comment">// when writing the stack, we must make a copy because we can't access elements by their index</font>
+00899 <font class="comment">// so the stack must be destroyed</font>
+00900 TNewElementRequestStack r2;
+00901 uint32 size = (uint32) _RequestStack.size();
+00902 f.serial(size);
+00903
+00904 <font class="keywordflow">while</font>(!_RequestStack.empty())
+00905 {
+00906 r2.push(_RequestStack.top());
+00907 _RequestStack.pop();
+00908 }
+00909 <font class="comment">// now rebuild the stack while serializing it;</font>
+00910 <font class="keywordflow">while</font> (!r2.empty())
+00911 {
+00912 f.serial(r2.top());
+00913 _RequestStack.push(r2.top());
+00914 r2.pop();
+00915 }
+00916
+00917 }
+00918
+00919
+00920
+00921
+00922 f.serial(_UpdateLock);
+00923
+00924 f.serialContPolyPtr(_LocatedBoundCont);
+00925
+00926 <font class="keywordflow">if</font> (ver &gt; 1)
+00927 {
+00928 f.serial(_LODDegradation);
+00929 }
+00930
+00931 <font class="keywordflow">if</font> (ver &gt; 2)
+00932 {
+00933 f.serial(_ParametricMotion);
+00934 }
+00935
+00936 <font class="keywordflow">if</font> (f.isReading())
+00937 {
+00938 <font class="comment">// evaluate our max number of faces</font>
+00939 notifyMaxNumFacesChanged();
+00940
+00941 <font class="keywordflow">if</font> (_ParametricMotion)
+00942 {
+00943 allocateParametricInfos();
+00944 }
+00945 }
+00946
+00947 <font class="keywordflow">if</font> (ver &gt; 3)
+00948 {
+00949 f.serial(_TriggerOnDeath, _TriggerID);
+00950 }
+00951 }
+00952
+00953
+00954 <font class="comment">// integrate speed of particles. Makes eventually use of SSE instructions when present</font>
+00955 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a426">IntegrateSpeed</a>(uint count, <font class="keywordtype">float</font> *src1, <font class="keyword">const</font> <font class="keywordtype">float</font> *src2 ,<font class="keywordtype">float</font> ellapsedTime)
+00956 {
+00957 <font class="preprocessor"> #if 0 // this works, but is not enabled for now. The precision is not that good...</font>
+00958 <font class="preprocessor"></font><font class="preprocessor"> #ifdef NL_OS_WINDOWS</font>
+00959 <font class="preprocessor"></font>
+00960
+00961
+00962 <font class="keywordflow">if</font> (NLMISC::CCpuInfo::hasSSE()
+00963 &amp;&amp; ((uint) src1 &amp; 15) == ((uint) src2 &amp; 15)
+00964 &amp;&amp; ! ((uint) src1 &amp; 3)
+00965 &amp;&amp; ! ((uint) src2 &amp; 3)
+00966 ) <font class="comment">// must must be sure that memory alignment is identical </font>
+00967 {
+00968
+00969 <font class="comment">// compute first datas in order to align to 16 byte boudary</font>
+00970
+00971 uint alignCount = ((uint) src1 &gt;&gt; 2) &amp; 3; <font class="comment">// number of float to process</font>
+00972
+00973 <font class="keywordflow">while</font> (alignCount --)
+00974 {
+00975 *src1++ += ellapsedTime * *src2 ++;
+00976 }
+00977
+00978
+00979
+00980 count -= alignCount;
+00981 <font class="keywordflow">if</font> (count &gt; 3)
+00982 {
+00983 <font class="keywordtype">float</font> et[4] = { ellapsedTime, ellapsedTime, ellapsedTime, ellapsedTime};
+00984 <font class="comment">// sse part of computation</font>
+00985 __asm
+00986 {
+00987 mov ecx, count
+00988 shr ecx, 2
+00989
+00990
+00991 xor edx, edx
+00992
+00993 mov eax, src1
+00994 mov ebx, src2
+00995 movups xmm0, et[0]
+00996 myLoop:
+00997 movaps xmm2, [ebx + 8 * edx]
+00998 movaps xmm1, [eax + 8 * edx]
+00999 mulps xmm2, xmm0
+01000 addps xmm1, xmm2
+01001 movaps [eax + 8 * edx], xmm1
+01002 add edx, 2
+01003 dec ecx
+01004 jne myLoop
+01005 }
+01006 }
+01007 <font class="comment">// proceed with left float</font>
+01008 count &amp;= 3;
+01009
+01010 <font class="keywordflow">if</font> (count)
+01011 {
+01012 src1 += alignCount;
+01013 src2 += alignCount;
+01014 <font class="keywordflow">do</font>
+01015 {
+01016 *src1 += ellapsedTime * *src2;
+01017
+01018 ++src1;
+01019 ++src2;
+01020 }
+01021 <font class="keywordflow">while</font> (--count);
+01022 }
+01023
+01024 }
+01025 <font class="keywordflow">else</font>
+01026 <font class="preprocessor"> #endif</font>
+01027 <font class="preprocessor"></font><font class="preprocessor"> #endif</font>
+01028 <font class="preprocessor"></font> {
+01029 <font class="comment">// standard version </font>
+01030
+01031 <font class="comment">/* for (float *src1End = src1 + count; src1 != src1End; ++src1, ++src2)</font>
+01032 <font class="comment"> { </font>
+01033 <font class="comment"> *src1 += ellapsedTime * *src2; </font>
+01034 <font class="comment"> } */</font>
+01035
+01036
+01037 <font class="comment">// standard version </font>
+01038 uint countDiv8 = count&gt;&gt;3;
+01039 count &amp;= 7; <font class="comment">// takes count % 8</font>
+01040
+01041 <font class="keywordflow">while</font> (countDiv8 --)
+01042 {
+01043 src1[0] += ellapsedTime * src2[0];
+01044 src1[1] += ellapsedTime * src2[1];
+01045 src1[2] += ellapsedTime * src2[2];
+01046 src1[3] += ellapsedTime * src2[3];
+01047
+01048 src1[4] += ellapsedTime * src2[4];
+01049 src1[5] += ellapsedTime * src2[5];
+01050 src1[6] += ellapsedTime * src2[6];
+01051 src1[7] += ellapsedTime * src2[7];
+01052
+01053 src2 += 8;
+01054 src1 += 8;
+01055 }
+01056
+01057 <font class="keywordflow">while</font> (count--)
+01058 {
+01059 *src1++ += ellapsedTime * *src2++;
+01060 }
+01061
+01062
+01063 }
+01064 }
+01065
+01066
+<a name="l01067"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a41">01067</a> <font class="keywordtype">void</font> CPSLocated::step(<a class="code" href="namespaceNL3D.html#a484">TPSProcessPass</a> pass, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> realEt)
+01068 {
+01069 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>) <font class="keywordflow">return</font>;
+01070
+01071
+01072 <font class="keywordflow">if</font> (pass == <a class="code" href="namespaceNL3D.html#a484a168">PSMotion</a>)
+01073 {
+01074
+01075
+01076 <font class="comment">// check wether we must perform LOD degradation</font>
+01077 <font class="keywordflow">if</font> (_LODDegradation)
+01078 {
+01079 <font class="keywordflow">if</font> (ellapsedTime &gt; 0)
+01080 {
+01081 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>);
+01082 <font class="comment">// compute the number of particles to show</font>
+01083 <font class="keyword">const</font> uint maxToHave = (uint) (<a class="code" href="classNL3D_1_1CPSLocated.html#n4">_MaxSize</a> * <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getOneMinusCurrentLODRatio());
+01084 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a> &gt; maxToHave) <font class="comment">// too much instances ?</font>
+01085 {
+01086 <font class="comment">// choose a random element to start at, and a random step</font>
+01087 <font class="comment">// this will avoid a pulse effect when the system is far away</font>
+01088
+01089 uint pos = maxToHave ? rand() % maxToHave : 0;
+01090 uint <a class="code" href="classNL3D_1_1CPSLocated.html#a41">step</a> = maxToHave ? rand() % maxToHave : 0;
+01091
+01092 <font class="keywordflow">do</font>
+01093 {
+01094 <a class="code" href="classNL3D_1_1CPSLocated.html#a13">deleteElement</a>(pos);
+01095 pos += <a class="code" href="classNL3D_1_1CPSLocated.html#a41">step</a>;
+01096 <font class="keywordflow">if</font> (pos &gt;= maxToHave) pos -= maxToHave;
+01097 }
+01098 <font class="keywordflow">while</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a> !=maxToHave);
+01099 }
+01100 }
+01101 }
+01102
+01103
+01104 <font class="comment">// check if we must skip frames</font>
+01105 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSLocated.html#n2">_NbFramesToSkip</a> || !( (uint32) <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getDate() % (<a class="code" href="classNL3D_1_1CPSLocated.html#n2">_NbFramesToSkip</a> + 1)))
+01106 {
+01107
+01108
+01109 <font class="comment">// update the located creation requests that may have been posted</font>
+01110 <a class="code" href="classNL3D_1_1CPSLocated.html#b0">updateNewElementRequestStack</a>();
+01111
+01112
+01113 <font class="comment">// there are 2 integration steps : with and without collisions</font>
+01114
+01115 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>) <font class="comment">// no collisionner are used</font>
+01116 {
+01117 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a> != 0) <font class="comment">// avoid referencing _Pos[0] if there's no size, causes STL vectors to assert...</font>
+01118 <a class="code" href="namespaceNL3D.html#a426">IntegrateSpeed</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a> * 3, &amp;<a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>[0].<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, &amp;<a class="code" href="classNL3D_1_1CPSLocated.html#n9">_Speed</a>[0].<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, ellapsedTime);
+01119 }
+01120 <font class="keywordflow">else</font>
+01121 {
+01122 <font class="comment">// integration with collisions</font>
+01123
+01124 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>);
+01125 TPSAttribCollisionInfo::iterator itc = <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>-&gt;begin();
+01126 TPSAttribVector::iterator itSpeed = <a class="code" href="classNL3D_1_1CPSLocated.html#n9">_Speed</a>.begin();
+01127 TPSAttribVector::iterator itPos = <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.begin();
+01128
+01129 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>;)
+01130 {
+01131 <font class="keywordflow">if</font> (itc-&gt;dist != -1)
+01132 {
+01133 (*itPos) = itc-&gt;newPos;
+01134 (*itSpeed) = itc-&gt;newSpeed;
+01135 <font class="comment">// notify each located bindable that a bounce occured ...</font>
+01136 <font class="keywordflow">for</font> (TLocatedBoundCont::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+01137 {
+01138 (*it)-&gt;bounceOccured(k);
+01139 }
+01140 <font class="keywordflow">switch</font>(itc-&gt;collisionZone-&gt;getCollisionBehaviour())
+01141 {
+01142 <font class="keywordflow">case</font> CPSZone::bounce:
+01143 itc-&gt;reset();
+01144 ++k, ++itPos, ++itSpeed, ++itc;
+01145 <font class="keywordflow">break</font>;
+01146 <font class="keywordflow">case</font> CPSZone::destroy:
+01147 <a class="code" href="classNL3D_1_1CPSLocated.html#a13">deleteElement</a>(k);
+01148 <font class="keywordflow">break</font>;
+01149 }
+01150 }
+01151 <font class="keywordflow">else</font>
+01152 {
+01153 (*itPos) += ellapsedTime * (*itSpeed) * itc-&gt;TimeSliceRatio;
+01154 itc-&gt;reset();
+01155 ++k, ++itPos, ++itSpeed, ++itc;
+01156 }
+01157 }
+01158
+01159
+01160 <font class="comment">// reset collision info for the next time =&gt; done during the traversal</font>
+01162 <font class="comment"> </font>
+01163 }
+01164 }
+01165 <font class="keywordflow">else</font>
+01166 {
+01167 <font class="keywordflow">return</font>; <font class="comment">// we skip the frame...</font>
+01168 }
+01169 }
+01170
+01171 <font class="keywordflow">if</font> (pass != <a class="code" href="namespaceNL3D.html#a484a168">PSMotion</a>)
+01172 {
+01173 <font class="comment">// apply the pass to all bound objects</font>
+01174 <font class="keywordflow">for</font> (TLocatedBoundCont::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+01175 {
+01176 <font class="keywordflow">if</font> ((*it)-&gt;isActive())
+01177 {
+01178 <font class="keywordflow">if</font> ((*it)-&gt;getLOD() == <a class="code" href="namespaceNL3D.html#a485a208">PSLod1n2</a> || <a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getLOD() == (*it)-&gt;getLOD()) <font class="comment">// has this object the right LOD ?</font>
+01179 {
+01180 (*it)-&gt;step(pass, ellapsedTime, realEt);
+01181 }
+01182 }
+01183 }
+01184 }
+01185 <font class="keywordflow">else</font>
+01186 {
+01187 <font class="keywordflow">for</font> (TLocatedBoundCont::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+01188 {
+01189 <font class="keywordflow">if</font> ((*it)-&gt;isActive())
+01190 {
+01191 (*it)-&gt;step(pass, ellapsedTime, realEt);
+01192 }
+01193 }
+01194
+01195 }
+01196 }
+01197
+<a name="l01198"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a76">01198</a> <font class="keywordtype">void</font> CPSLocated::updateLife(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime)
+01199 {
+01200 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>) <font class="keywordflow">return</font>;
+01201 <font class="keywordflow">if</font> (! <a class="code" href="classNL3D_1_1CPSLocated.html#n6">_LastForever</a>)
+01202 {
+01203 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n15">_LifeScheme</a> != NULL)
+01204 {
+01205 TPSAttribTime::iterator itTime = <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>.begin(), itTimeInc = <a class="code" href="classNL3D_1_1CPSLocated.html#n11">_TimeIncrement</a>.begin();
+01206 <font class="keywordflow">for</font> (uint32 k = 0; k &lt; <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>;)
+01207 {
+01208 *itTime += ellapsedTime * *itTimeInc;
+01209 <font class="keywordflow">if</font> (*itTime &gt;= 1.0f)
+01210 {
+01211 <a class="code" href="classNL3D_1_1CPSLocated.html#a13">deleteElement</a>(k);
+01212 }
+01213 <font class="keywordflow">else</font>
+01214 {
+01215 ++k;
+01216 ++itTime;
+01217 ++itTimeInc;
+01218 }
+01219 }
+01220 }
+01221 <font class="keywordflow">else</font>
+01222 {
+01223 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n14">_InitialLife</a> != 0)
+01224 {
+01225 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>);
+01226 <font class="keywordtype">float</font> timeInc = ellapsedTime * 1.f / <a class="code" href="classNL3D_1_1CPSLocated.html#n14">_InitialLife</a>;
+01227 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getSystemDate() &gt;= (<a class="code" href="classNL3D_1_1CPSLocated.html#n14">_InitialLife</a> - ellapsedTime))
+01228 {
+01229 TPSAttribTime::iterator itTime = <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>.begin();
+01230 <font class="keywordflow">for</font> (uint32 k = 0; k &lt; <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>;)
+01231 {
+01232 *itTime += timeInc;
+01233 <font class="keywordflow">if</font> (*itTime &gt;= 1.0f)
+01234 {
+01235 <a class="code" href="classNL3D_1_1CPSLocated.html#a13">deleteElement</a>(k);
+01236 }
+01237 <font class="keywordflow">else</font>
+01238 {
+01239 ++k;
+01240 ++itTime;
+01241 }
+01242 }
+01243 }
+01244 <font class="keywordflow">else</font>
+01245 {
+01246 TPSAttribTime::iterator itTime = <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>.begin(), itEndTime = <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>.end();
+01247 <font class="keywordflow">do</font>
+01248 {
+01249 *itTime += timeInc;
+01250 ++itTime;
+01251 }
+01252 <font class="keywordflow">while</font> (itTime != itEndTime);
+01253 }
+01254 }
+01255 <font class="keywordflow">else</font>
+01256 {
+01257 uint size = <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>;
+01258 <font class="keywordflow">do</font>
+01259 {
+01260 <a class="code" href="classNL3D_1_1CPSLocated.html#a13">deleteElement</a>(0);
+01261 }
+01262 <font class="keywordflow">while</font> (--size);
+01263 }
+01264 }
+01265 }
+01266 <font class="keywordflow">else</font>
+01267 {
+01268 <font class="comment">// the time attribute gives the life in seconds</font>
+01269 TPSAttribTime::iterator itTime = <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>.begin(), endItTime = <a class="code" href="classNL3D_1_1CPSLocated.html#n10">_Time</a>.end();
+01270 <font class="keywordflow">for</font> (; itTime != endItTime; ++itTime)
+01271 {
+01272 *itTime += ellapsedTime;
+01273 }
+01274 }
+01275 }
+01276
+01277
+01278
+01279
+<a name="l01280"></a><a class="code" href="classNL3D_1_1CPSLocated.html#b0">01280</a> <font class="keywordtype">void</font> CPSLocated::updateNewElementRequestStack(<font class="keywordtype">void</font>)
+01281 {
+01282 <font class="keywordflow">while</font> (!<a class="code" href="classNL3D_1_1CPSLocated.html#n18">_RequestStack</a>.empty())
+01283 {
+01284 <a class="code" href="classNL3D_1_1CPSLocated.html#a12">newElement</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n18">_RequestStack</a>.top()._Pos, <a class="code" href="classNL3D_1_1CPSLocated.html#n18">_RequestStack</a>.top()._Speed);
+01285 <a class="code" href="classNL3D_1_1CPSLocated.html#n18">_RequestStack</a>.pop();
+01286 }
+01287 }
+01288
+01289
+<a name="l01290"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a18">01290</a> <font class="keywordtype">bool</font> CPSLocated::computeBBox(<a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> &amp;box)<font class="keyword"> const</font>
+01291 <font class="keyword"></font>{
+01292 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>) <font class="keywordflow">return</font> <font class="keyword">false</font>; <font class="comment">// something to compute ?</font>
+01293
+01294
+01295 TLocatedBoundCont::const_iterator it;
+01296 TPSAttribVector::const_iterator it2;
+01297
+01298 <font class="comment">// check whether any object bound to us need a bbox</font>
+01299
+01300 <font class="keywordflow">for</font> (it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+01301 {
+01302 <font class="keywordflow">if</font> ((*it)-&gt;doesProduceBBox())
+01303 {
+01304 <font class="keywordflow">break</font>;
+01305 }
+01306 }
+01307
+01308 <font class="keywordflow">if</font> (it == <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end())
+01309 {
+01310 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01311 }
+01312
+01313 CVector <a class="code" href="bit__set_8cpp.html#a0">min</a> = <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>[0], max = <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>[0];
+01314
+01315 <font class="keywordflow">for</font> (it2 = <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.begin(); it2 != <a class="code" href="classNL3D_1_1CPSLocated.html#n8">_Pos</a>.end(); ++ it2)
+01316 {
+01317 <font class="keyword">const</font> CVector &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> = (*it2);
+01318 <a class="code" href="bit__set_8cpp.html#a0">min</a>.minof(<a class="code" href="bit__set_8cpp.html#a0">min</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>);
+01319 max.maxof(max, <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>);
+01320 }
+01321
+01322 box.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_3">setMinMax</a>(<a class="code" href="bit__set_8cpp.html#a0">min</a>, max);
+01323
+01324 <font class="comment">// we've considered that located had no extent in space</font>
+01325 <font class="comment">// now, we must call each objects that are bound to the located in order</font>
+01326 <font class="comment">// to complete the bbox if they have no null extent</font>
+01327
+01328 <a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> tmpBox, startBox = box;
+01329
+01330 <font class="keywordflow">for</font> (it = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(); ++it)
+01331 {
+01332 <font class="keywordflow">if</font> ((*it)-&gt;doesProduceBBox())
+01333 {
+01334 tmpBox = startBox;
+01335 <font class="keywordflow">if</font> ((*it)-&gt;completeBBox(tmpBox))
+01336 {
+01337 box = <a class="code" href="classNLMISC_1_1CAABBox.html#z266_2">NLMISC::CAABBox::computeAABBoxUnion</a>(tmpBox, box);
+01338 }
+01339 }
+01340 }
+01341
+01342 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01343 }
+01344
+01345
+<a name="l01347"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a51">01347</a> <font class="keywordtype">void</font> CPSLocated::setupDriverModelMatrix(<font class="keywordtype">void</font>)
+01348 {
+01349 <font class="keywordflow">if</font> (_SystemBasisEnabled)
+01350 {
+01351 <a class="code" href="classNL3D_1_1CPSLocated.html#a48">getDriver</a>()-&gt;setupModelMatrix(<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n0">_Owner</a>-&gt;getSysMat());
+01352 }
+01353 <font class="keywordflow">else</font>
+01354 {
+01355 <a class="code" href="classNL3D_1_1CPSLocated.html#a48">getDriver</a>()-&gt;setupModelMatrix(CMatrix::Identity);
+01356 }
+01357 }
+01358
+01359
+01360
+01361
+<a name="l01362"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a55">01362</a> <font class="keywordtype">void</font> CPSLocated::queryCollisionInfo(<font class="keywordtype">void</font>)
+01363 {
+01364 <font class="keywordflow">if</font> (_CollisionInfoNbRef)
+01365 {
+01366 ++ <a class="code" href="classNL3D_1_1CPSLocated.html#n13">_CollisionInfoNbRef</a>;
+01367 }
+01368 <font class="keywordflow">else</font>
+01369 {
+01370 <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a> = <font class="keyword">new</font> <a class="code" href="namespaceNL3D.html#a201">TPSAttribCollisionInfo</a>;
+01371 <a class="code" href="classNL3D_1_1CPSLocated.html#n13">_CollisionInfoNbRef</a> = 1;
+01372 <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>-&gt;resize(<a class="code" href="classNL3D_1_1CPSLocated.html#n4">_MaxSize</a>);
+01373
+01374 <font class="keywordflow">for</font>(uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CPSLocated.html#n5">_Size</a>; ++k)
+01375 {
+01376 <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>-&gt;insert();
+01377 }
+01378 }
+01379 }
+01380
+<a name="l01381"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a56">01381</a> <font class="keywordtype">void</font> CPSLocated::releaseCollisionInfo(<font class="keywordtype">void</font>)
+01382 {
+01383 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n13">_CollisionInfoNbRef</a>); <font class="comment">// check whether queryCollisionInfo was called</font>
+01384 <font class="comment">// so the number of refs must not = 0 </font>
+01385 --<a class="code" href="classNL3D_1_1CPSLocated.html#n13">_CollisionInfoNbRef</a>;
+01386 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n13">_CollisionInfoNbRef</a> == 0)
+01387 {
+01388 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>;
+01389 <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a> = NULL;
+01390 }
+01391 }
+01392
+01393
+<a name="l01394"></a><a class="code" href="classNL3D_1_1CPSLocated.html#b2">01394</a> <font class="keywordtype">void</font> CPSLocated::resetCollisionInfo(<font class="keywordtype">void</font>)
+01395 {
+01396 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>);
+01397
+01398 TPSAttribCollisionInfo::iterator it = <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>-&gt;begin(), endIt = <a class="code" href="classNL3D_1_1CPSLocated.html#n12">_CollisionInfo</a>-&gt;end();
+01399
+01400 <font class="keywordflow">for</font> (; it != endIt; ++it)
+01401 {
+01402 it-&gt;reset();
+01403 }
+01404 }
+01405
+<a name="l01406"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a82">01406</a> <font class="keywordtype">void</font> CPSLocated::registerIntegrableForce(CPSForce *f)
+01407 {
+01408 <a class="code" href="debug_8h.html#a6">nlassert</a>(std::find(<a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.begin(), <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.end(), f) == <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.end()); <font class="comment">// force registered twice</font>
+01409 <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.push_back(f);
+01410 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n1">_SystemBasisEnabled</a> != f-&gt;getOwner()-&gt;isInSystemBasis())
+01411 {
+01412 ++<a class="code" href="classNL3D_1_1CPSLocated.html#n23">_NumIntegrableForceWithDifferentBasis</a>;
+01413 <a class="code" href="classNL3D_1_1CPSLocated.html#b4">releaseParametricInfos</a>();
+01414 }
+01415 }
+01416
+01417
+<a name="l01418"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a83">01418</a> <font class="keywordtype">void</font> CPSLocated::unregisterIntegrableForce(CPSForce *f)
+01419 {
+01420 <a class="code" href="debug_8h.html#a6">nlassert</a>(f-&gt;getOwner()); <font class="comment">// f must be attached to a located</font>
+01421 std::vector&lt;CPSForce *&gt;::iterator it = std::find(<a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.begin(), <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.end(), f);
+01422 <a class="code" href="debug_8h.html#a6">nlassert</a>(it != <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.end() );
+01423 <a class="code" href="classNL3D_1_1CPSLocated.html#n24">_IntegrableForces</a>.erase(it);
+01424 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n1">_SystemBasisEnabled</a> != f-&gt;getOwner()-&gt;isInSystemBasis())
+01425 {
+01426 --<a class="code" href="classNL3D_1_1CPSLocated.html#n23">_NumIntegrableForceWithDifferentBasis</a>;
+01427 }
+01428 }
+01429
+<a name="l01430"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a85">01430</a> <font class="keywordtype">void</font> CPSLocated::addNonIntegrableForceRef(<font class="keywordtype">void</font>)
+01431 {
+01432 ++<a class="code" href="classNL3D_1_1CPSLocated.html#n22">_NonIntegrableForceNbRefs</a>;
+01433 <a class="code" href="classNL3D_1_1CPSLocated.html#b4">releaseParametricInfos</a>();
+01434 }
+01435
+<a name="l01436"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a86">01436</a> <font class="keywordtype">void</font> CPSLocated::releaseNonIntegrableForceRef(<font class="keywordtype">void</font>)
+01437 {
+01438 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocated.html#n22">_NonIntegrableForceNbRefs</a> != 0);
+01439 --<a class="code" href="classNL3D_1_1CPSLocated.html#n22">_NonIntegrableForceNbRefs</a>;
+01440 }
+01441
+01442
+<a name="l01443"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a84">01443</a> <font class="keywordtype">void</font> CPSLocated::integrableForceBasisChanged(<font class="keywordtype">bool</font> basis)
+01444 {
+01445 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CParticleSystemProcess.html#n1">_SystemBasisEnabled</a> != basis)
+01446 {
+01447 ++<a class="code" href="classNL3D_1_1CPSLocated.html#n23">_NumIntegrableForceWithDifferentBasis</a>;
+01448 <a class="code" href="classNL3D_1_1CPSLocated.html#b4">releaseParametricInfos</a>();
+01449 }
+01450 <font class="keywordflow">else</font>
+01451 {
+01452 --<a class="code" href="classNL3D_1_1CPSLocated.html#n23">_NumIntegrableForceWithDifferentBasis</a>;
+01453 }
+01454 }
+01455
+01456
+<a name="l01458"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a3">01458</a> CPSLocatedBindable *CPSLocated::unbind(uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+01459 {
+01460 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.size());
+01461 CPSLocatedBindable *lb = <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>];
+01462 lb-&gt;setOwner(NULL);
+01463 <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.erase(<a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin() + <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01464 <font class="keywordflow">return</font> lb;
+01465 }
+01466
+<a name="l01468"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a4">01468</a> <font class="keywordtype">bool</font> CPSLocated::isBound(<font class="keyword">const</font> CPSLocatedBindable *lb)<font class="keyword"> const</font>
+01469 <font class="keyword"></font>{
+01470 TLocatedBoundCont::const_iterator it = std::find(<a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.begin(), <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end(), lb);
+01471 <font class="keywordflow">return</font> it != <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.end();
+01472 }
+01473
+<a name="l01475"></a><a class="code" href="classNL3D_1_1CPSLocated.html#a5">01475</a> uint CPSLocated::getIndexOf(<font class="keyword">const</font> CPSLocatedBindable *lb)<font class="keyword"> const</font>
+01476 <font class="keyword"></font>{
+01477 <font class="keywordflow">for</font>(uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>.size(); ++k)
+01478 {
+01479 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocated.html#n3">_LocatedBoundCont</a>[k] == lb) <font class="keywordflow">return</font> k;
+01480 }
+01481 <a class="code" href="debug_8h.html#a6">nlassert</a>(0);
+01482 <font class="keywordflow">return</font> 0;
+01483 }
+01484
+01485
+01486
+01488 <font class="comment">// CPSLocatedBindable implementation //</font>
+01490 <font class="comment"></font>
+01491
+<a name="l01493"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#z720_0">01493</a> CPSLocatedBindable::CPSLocatedBindable() : _LOD(<a class="code" href="namespaceNL3D.html#a485a208">PSLod1n2</a>), _Owner(NULL), _ExternID(0), _Active(true)
+01494 {
+01495 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a> = NULL;
+01496 }
+01497
+<a name="l01498"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#b5">01498</a> <font class="keywordtype">void</font> CPSLocatedBindable::setOwner(CPSLocated *psl)
+01499 {
+01500 <font class="keywordflow">if</font> (psl == NULL)
+01501 {
+01502 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a7">releaseAllRef</a>();
+01503 <font class="keywordflow">if</font> (_Owner)
+01504 {
+01505 <font class="comment">// empty this located bindable. Need to be empty if it must be rebound to another located.</font>
+01506 <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize(); ++k)
+01507 {
+01508 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#b1">deleteElement</a>(0);
+01509 }
+01510 }
+01511 }
+01512 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a> = psl;
+01513 }
+01514
+<a name="l01516"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#z720_3">01516</a> CPSLocatedBindable::~CPSLocatedBindable()
+01517 {
+01518 <font class="keywordflow">if</font> (_ExternID)
+01519 {
+01520 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner())
+01521 {
+01522 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;unregisterLocatedBindableExternID(<font class="keyword">this</font>);
+01523 }
+01524 }
+01525 }
+01526
+<a name="l01528"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a17">01528</a> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;CPSLocatedBindable::getLocatedMat(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+01529 <font class="keyword"></font>{
+01530 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01531 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;isInSystemBasis())
+01532 {
+01533 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getSysMat();
+01534 }
+01535 <font class="keywordflow">else</font>
+01536 {
+01537 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CMatrix.html#p0">NLMISC::CMatrix::Identity</a>;
+01538 }
+01539 }
+01540
+01541
+<a name="l01543"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a5">01543</a> <font class="keywordtype">void</font> CPSLocatedBindable::notifyTargetRemoved(CPSLocated *ptr)
+01544 {
+01545 ptr-&gt;unregisterDtorObserver(<font class="keyword">this</font>);
+01546 }
+01547
+<a name="l01549"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#z720_1">01549</a> <font class="keywordtype">void</font> CPSLocatedBindable::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+01550 {
+01551 sint ver = f.serialVersion(4);
+01552 f.serialPtr(_Owner);
+01553 <font class="keywordflow">if</font> (ver &gt; 1) f.serialEnum(_LOD);
+01554 <font class="keywordflow">if</font> (ver &gt; 2) f.serial(_Name);
+01555 <font class="keywordflow">if</font> (ver &gt; 3)
+01556 {
+01557 <font class="keywordflow">if</font> (f.isReading())
+01558 {
+01559 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>;
+01560 f.serial(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+01561 setExternID(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
+01562 }
+01563 <font class="keywordflow">else</font>
+01564 {
+01565 f.serial(_ExternID);
+01566 }
+01567 }
+01568
+01569 }
+01570
+<a name="l01572"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#b4">01572</a> <font class="keywordtype">void</font> CPSLocatedBindable::displayIcon2d(<font class="keyword">const</font> CVector tab[], uint nbSegs, <font class="keywordtype">float</font> scale)
+01573 {
+01574 uint32 size = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize();
+01575 <font class="keywordflow">if</font> (!size) <font class="keywordflow">return</font>;
+01576 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a21">setupDriverModelMatrix</a>();
+01577
+01578 <font class="keyword">const</font> CVector I = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a22">computeI</a>();
+01579 <font class="keyword">const</font> CVector K = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a24">computeK</a>();
+01580
+01581 <font class="keyword">static</font> std::vector&lt;NLMISC::CLine&gt; lines;
+01582
+01583 lines.clear();
+01584
+01585 <font class="comment">// ugly slow code, but not for runtime</font>
+01586 <font class="keywordflow">for</font> (uint k = 0; k &lt; size; ++k)
+01587 {
+01588 <font class="comment">// center of the current particle</font>
+01589 <font class="keyword">const</font> CVector p = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[k];
+01590
+01591
+01592
+01593 <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> &lt; nbSegs; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
+01594 {
+01595 <a class="code" href="classNLMISC_1_1CLine.html">NLMISC::CLine</a> li;
+01596 li.<a class="code" href="classNLMISC_1_1CLine.html#m0">V0</a> = p + scale * (tab[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt;&lt; 1].x * I + tab[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt;&lt; 1].y * K);
+01597 li.<a class="code" href="classNLMISC_1_1CLine.html#m1">V1</a> = p + scale * (tab[(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt;&lt; 1) + 1].x * I + tab[(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt;&lt; 1) + 1].y * K);
+01598 lines.push_back(li);
+01599 }
+01600
+01601 CMaterial mat;
+01602
+01603 mat.setBlendFunc(CMaterial::one, CMaterial::one);
+01604 mat.setZWrite(<font class="keyword">false</font>);
+01605 mat.setLighting(<font class="keyword">false</font>);
+01606 mat.setBlend(<font class="keyword">true</font>);
+01607 mat.setZFunc(CMaterial::less);
+01608
+01609
+01610
+01611 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#l0">CPSLocated</a> *loc;
+01612 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>;
+01613 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#z720_0">CPSLocatedBindable</a> *lb;
+01614 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getCurrentEditedElement(loc, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, lb);
+01615
+01616 mat.setColor((lb == NULL || <font class="keyword">this</font> == lb) &amp;&amp; loc == <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a> &amp;&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == k ? CRGBA::Red : CRGBA(127, 127, 127));
+01617
+01618
+01619 CDRU::drawLinesUnlit(lines, mat, *<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a10">getDriver</a>() );
+01620 }
+01621
+01622 }
+01623
+<a name="l01625"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a13">01625</a> CFontManager *CPSLocatedBindable::getFontManager(<font class="keywordtype">void</font>)
+01626 {
+01627 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01628 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getFontManager();
+01629 }
+01630
+<a name="l01633"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a14">01633</a> <font class="keyword">const</font> CFontManager *CPSLocatedBindable::getFontManager(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+01634 <font class="keyword"></font>{
+01635 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01636 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getFontManager();
+01637 }
+01638
+01639
+01641 <font class="comment">// Shortcut to get the matrix of the system </font>
+<a name="l01642"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a15">01642</a> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;CPSLocatedBindable::getSysMat(<font class="keywordtype">void</font>)<font class="keyword"> const </font>
+01643 <font class="keyword"></font>{
+01644 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01645 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getSysMat();
+01646 }
+01647
+<a name="l01650"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a16">01650</a> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;CPSLocatedBindable::getInvertedSysMat(<font class="keywordtype">void</font>)<font class="keyword"> const </font>
+01651 <font class="keyword"></font>{
+01652 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01653 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getInvertedSysMat();
+01654
+01655 }
+01656
+<a name="l01658"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a18">01658</a> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;CPSLocatedBindable::getInvertedLocatedMat(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+01659 <font class="keyword"></font>{
+01660 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01661 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;isInSystemBasis())
+01662 {
+01663 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getInvertedSysMat();
+01664 }
+01665 <font class="keywordflow">else</font>
+01666 {
+01667 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CMatrix.html#p0">NLMISC::CMatrix::Identity</a>;
+01668 }
+01669 }
+01670
+<a name="l01673"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a19">01673</a> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;CPSLocatedBindable::getViewMat(<font class="keywordtype">void</font>)<font class="keyword"> const </font>
+01674 <font class="keyword"></font>{
+01675 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01676 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getViewMat();
+01677 }
+01678
+01679
+<a name="l01682"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a20">01682</a> <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;CPSLocatedBindable::getInvertedViewMat(<font class="keywordtype">void</font>)<font class="keyword"> const </font>
+01683 <font class="keyword"></font>{
+01684 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01685 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getInvertedViewMat();
+01686 }
+01687
+<a name="l01690"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a21">01690</a> <font class="keywordtype">void</font> CPSLocatedBindable::setupDriverModelMatrix(<font class="keywordtype">void</font>)
+01691 {
+01692 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01693 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;setupDriverModelMatrix();
+01694 }
+01695
+<a name="l01697"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a33">01697</a> <font class="keywordtype">void</font> CPSLocatedBindable::setExternID(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
+01698 {
+01699 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a> == <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n1">_ExternID</a>) <font class="keywordflow">return</font>;
+01700 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()); <font class="comment">// to call this method, this locatedBindable must be inserted in a system!! </font>
+01701 <font class="comment">// (e.g not standalone)</font>
+01702 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;unregisterLocatedBindableExternID(<font class="keyword">this</font>);
+01703 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a> != 0)
+01704 {
+01705 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;registerLocatedBindableExternID(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, <font class="keyword">this</font>);
+01706 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n1">_ExternID</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>;
+01707 }
+01708 }
+01709
+<a name="l01711"></a><a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a7">01711</a> <font class="keywordtype">void</font> CPSLocatedBindable::releaseAllRef()
+01712 {
+01713 }
+01714
+01715
+01716
+01717
+01718
+01720 <font class="comment">// CPSTargetLocatedBindable implementation //</font>
+01722 <font class="comment"></font>
+<a name="l01724"></a><a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a8">01724</a> <font class="comment">void CPSTargetLocatedBindable::serial(NLMISC::IStream &amp;f) throw(NLMISC::EStream)</font>
+01725 {
+01726 (void)f.serialVersion(1);
+01727 f.serialPtr(_Owner);
+01728 f.serial(_Name);
+01729 <font class="keywordflow">if</font> (f.isReading())
+01730 {
+01731 <font class="comment">// delete previous attached bindables...</font>
+01732 <font class="keywordflow">for</font> (TTargetCont::iterator it = _Targets.begin(); it != _Targets.end(); ++it)
+01733 {
+01734 <font class="keyword">delete</font> (*it);
+01735 }
+01736 _Targets.clear();
+01737 }
+01738 f.serialContPolyPtr(_Targets);
+01739 }
+01740
+01741
+<a name="l01743"></a><a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a0">01743</a> <font class="keywordtype">void</font> CPSTargetLocatedBindable::attachTarget(CPSLocated *ptr)
+01744 {
+01745
+01746 <font class="comment">// a target can't be shared between different particle systems</font>
+01747 <font class="preprocessor"> #ifdef NL_DEBUG</font>
+01748 <font class="preprocessor"></font> <font class="keywordflow">if</font> (_Owner)
+01749 {
+01750 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner() == ptr-&gt;getOwner());
+01751 }
+01752 <font class="preprocessor"> #endif</font>
+01753 <font class="preprocessor"></font>
+01754 <font class="comment">// see wether this target has not been registered before </font>
+01755 <a class="code" href="debug_8h.html#a6">nlassert</a>(std::find(<a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.begin(), <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end(), ptr) == <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end());
+01756 <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.push_back(ptr);
+01757
+01758 <font class="comment">// we register us to be notified when the target disappear</font>
+01759 ptr-&gt;registerDtorObserver(<font class="keyword">this</font>);
+01760 }
+01761
+01762
+<a name="l01764"></a><a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#b0">01764</a> <font class="keywordtype">void</font> CPSTargetLocatedBindable::notifyTargetRemoved(CPSLocated *ptr)
+01765 {
+01766 TTargetCont::iterator it = std::find(<a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.begin(), <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end(), ptr);
+01767 <a class="code" href="debug_8h.html#a6">nlassert</a>(it != <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end());
+01768 <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a7">releaseTargetRsc</a>(*it);
+01769 <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.erase(it);
+01770
+01771 CPSLocatedBindable::notifyTargetRemoved(ptr);
+01772 }
+01773
+01774
+01775
+01776 <font class="comment">// dtor</font>
+01777
+<a name="l01779"></a><a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a9">01779</a> <font class="keywordtype">void</font> CPSTargetLocatedBindable::finalize(<font class="keywordtype">void</font>)
+01780 {
+01784 <font class="keywordflow">for</font> (TTargetCont::iterator it = <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end(); ++it)
+01785 {
+01786 <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a7">releaseTargetRsc</a>(*it);
+01787 }
+01788 }
+01789
+<a name="l01791"></a><a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a10">01791</a> CPSTargetLocatedBindable::~CPSTargetLocatedBindable()
+01792 {
+01793 <font class="comment">// we unregister to all the targets</font>
+01794 <font class="keywordflow">for</font> (TTargetCont::iterator it = <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end(); ++it)
+01795 {
+01796 (*it)-&gt;unregisterDtorObserver(<font class="keyword">this</font>);
+01797 }
+01798 }
+01799
+<a name="l01801"></a><a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a2">01801</a> <font class="keywordtype">void</font> CPSTargetLocatedBindable::releaseRefTo(<font class="keyword">const</font> CParticleSystemProcess *other)
+01802 {
+01803 TTargetCont::iterator it = std::find(<a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.begin(), <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end(), other);
+01804 <font class="keywordflow">if</font> (it == <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end()) <font class="keywordflow">return</font>;
+01805 <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a7">releaseTargetRsc</a>(*it);
+01806 (*it)-&gt;unregisterDtorObserver(<font class="keyword">this</font>);
+01807 <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.erase(it);
+01808 <a class="code" href="debug_8h.html#a6">nlassert</a>(std::find(<a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.begin(), <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end(), other) == <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end());
+01809 }
+01810
+<a name="l01812"></a><a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a3">01812</a> <font class="keywordtype">void</font> CPSTargetLocatedBindable::releaseAllRef()
+01813 {
+01814 <font class="keywordflow">for</font> (TTargetCont::iterator it = <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.begin(); it != <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.end(); ++it)
+01815 {
+01816 <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#a7">releaseTargetRsc</a>(*it);
+01817 (*it)-&gt;unregisterDtorObserver(<font class="keyword">this</font>);
+01818 }
+01819 <a class="code" href="classNL3D_1_1CPSTargetLocatedBindable.html#n0">_Targets</a>.clear();
+01820 CPSLocatedBindable::releaseAllRef();
+01821 }
+01822
+01823
+01824
+01825
+01826 } <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>