aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/ps__emitter_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/ps__emitter_8cpp-source.html1527
1 files changed, 1527 insertions, 0 deletions
diff --git a/docs/doxygen/nel/ps__emitter_8cpp-source.html b/docs/doxygen/nel/ps__emitter_8cpp-source.html
new file mode 100644
index 00000000..7921829c
--- /dev/null
+++ b/docs/doxygen/nel/ps__emitter_8cpp-source.html
@@ -0,0 +1,1527 @@
+<!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_emitter.cpp</h1><a href="ps__emitter_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
+00008 <font class="comment"> *</font>
+00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00013 <font class="comment"> * any later version.</font>
+00014 <font class="comment"></font>
+00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00018 <font class="comment"> * General Public License for more details.</font>
+00019 <font class="comment"></font>
+00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00023 <font class="comment"> * MA 02111-1307, USA.</font>
+00024 <font class="comment"> */</font>
+00025
+00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
+00027
+00028 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
+00029 <font class="preprocessor">#include "<a class="code" href="ps__emitter_8h.html">3d/ps_emitter.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="material_8h.html">3d/material.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="line_8h.html">nel/misc/line.h</a>"</font>
+00032 <font class="preprocessor">#include "<a class="code" href="dru_8h.html">3d/dru.h</a>"</font>
+00033 <font class="preprocessor">#include "<a class="code" href="particle__system_8h.html">3d/particle_system.h</a>"</font>
+00034
+00035 <font class="keyword">namespace </font>NL3D {
+00036
+00037
+00038
+00039 <font class="comment">// number of emitter to be processed at once</font>
+00040 <font class="keyword">const</font> uint <a class="code" href="namespaceNL3D.html#a189">emitterBuffSize</a> = 512;
+00041
+00043 <font class="comment">// CPSEmitter implementation //</font>
+<a name="l00045"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#z716_0">00045</a> <font class="comment">CPSEmitter::CPSEmitter() : _EmittedType(NULL),</font>
+00046 _SpeedInheritanceFactor(0.f),
+00047 _EmissionType(regular),
+00048 _Period(0.02f),
+00049 _PeriodScheme(NULL),
+00050 _GenNb(1),
+00051 _GenNbScheme(NULL),
+00052 _EmitDelay(0),
+00053 _MaxEmissionCount(0),
+00054 _SpeedBasisEmission(<font class="keyword">false</font>),
+00055 _EmitDirBasis(<font class="keyword">true</font>),
+00056 _ConsistentEmission(<font class="keyword">true</font>)
+00057 {
+00058 }
+00059
+00060
+<a name="l00062"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#z716_1">00062</a> CPSEmitter::~CPSEmitter()
+00063 {
+00064 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>;
+00065 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>;
+00066 <font class="comment">// if a located is emitted, unregister us as an observer</font>
+00067 <font class="keywordflow">if</font> (_EmittedType)
+00068 {
+00069 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;unregisterDtorObserver(<font class="keyword">this</font>);
+00070 }
+00071 }
+00072
+<a name="l00074"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a31">00074</a> <font class="keywordtype">void</font> CPSEmitter::releaseRefTo(<font class="keyword">const</font> CParticleSystemProcess *other)
+00075 {
+00076 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a> == other)
+00077 {
+00078 <a class="code" href="classNL3D_1_1CPSEmitter.html#a5">setEmittedType</a>(NULL);
+00079 }
+00080 }
+00081
+<a name="l00082"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a32">00082</a> <font class="keywordtype">void</font> CPSEmitter::releaseAllRef()
+00083 {
+00084 <a class="code" href="classNL3D_1_1CPSEmitter.html#a5">setEmittedType</a>(NULL);
+00085 }
+00086
+00087
+<a name="l00089"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#b0">00089</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> CPSEmitter::processEmit(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, sint nbToGenerate)
+00090 {
+00091 <font class="keyword">static</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> speed, pos;
+00092
+00093 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSEmitter.html#n11">_SpeedBasisEmission</a>)
+00094 {
+00095 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n3">_SpeedInheritanceFactor</a> == 0.f)
+00096 {
+00097 <font class="keywordflow">if</font> (_EmitDirBasis)
+00098 {
+00099 <font class="keywordflow">while</font> (nbToGenerate &gt; 0)
+00100 {
+00101 nbToGenerate --;
+00102 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00103 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, speed, this-&gt;_Owner, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00104 }
+00105 }
+00106 <font class="keywordflow">else</font>
+00107 {
+00108 <font class="keywordflow">while</font> (nbToGenerate &gt; 0)
+00109 {
+00110 nbToGenerate --;
+00111 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00112 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, speed, this-&gt;_Owner, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">false</font>);
+00113 }
+00114 }
+00115 }
+00116 <font class="keywordflow">else</font>
+00117 {
+00118 <font class="keywordflow">while</font> (nbToGenerate --)
+00119 {
+00120 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00121 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, speed + <a class="code" href="classNL3D_1_1CPSEmitter.html#n3">_SpeedInheritanceFactor</a> * <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSpeed()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], this-&gt;<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+00122 }
+00123 }
+00124 }
+00125 <font class="keywordflow">else</font>
+00126 {
+00127 <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> m;
+00128 CPSUtil::buildSchmidtBasis(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSpeed()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], m);
+00129 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n3">_SpeedInheritanceFactor</a> == 0.f)
+00130 {
+00131 <font class="keywordflow">while</font> (nbToGenerate &gt; 0)
+00132 {
+00133 nbToGenerate --;
+00134 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00135 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, m * speed, this-&gt;_Owner, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00136 }
+00137 }
+00138 <font class="keywordflow">else</font>
+00139 {
+00140 <font class="keywordflow">while</font> (nbToGenerate --)
+00141 {
+00142 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00143 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, m * speed + <a class="code" href="classNL3D_1_1CPSEmitter.html#n3">_SpeedInheritanceFactor</a> * <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSpeed()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], this-&gt;<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00144 }
+00145 }
+00146 }
+00147 }
+00148
+00152 <font class="keyword">static</font> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a419">CompensateEmission</a>(CPSLocated *emittedType, uint emittedIndex, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> deltaT, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime, <font class="keywordtype">float</font> realEllapsedTimeRatio)
+00153 {
+00154 <font class="comment">// now, update emitted element life time </font>
+00155 <font class="keywordflow">if</font> (emittedType-&gt;getLastForever())
+00156 {
+00157 emittedType-&gt;getTime()[emittedIndex] += realEllapsedTimeRatio * deltaT;
+00158
+00159 <font class="keywordflow">if</font> (emittedType-&gt;isParametricMotionEnabled())
+00160 {
+00161 emittedType-&gt;getParametricInfos()[emittedIndex].Date -= realEllapsedTimeRatio * deltaT;
+00162 }
+00163 <font class="keywordflow">else</font>
+00164 {
+00165 <font class="keywordflow">if</font> (!emittedType-&gt;hasCollisionInfos())
+00166 {
+00167 <font class="comment">// no collision case</font>
+00168 emittedType-&gt;getPos()[emittedIndex] += deltaT * emittedType-&gt;getSpeed()[emittedIndex];
+00169 }
+00170 <font class="keywordflow">else</font> <font class="comment">// if there are collisions, we delay the step to the next iteration to ensure correct collisions</font>
+00171 {
+00172 emittedType-&gt;getCollisionInfo()[emittedIndex].TimeSliceRatio = deltaT / ellapsedTime;
+00173 }
+00174 }
+00175 }
+00176 <font class="keywordflow">else</font>
+00177 {
+00178 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> &amp;destTime = emittedType-&gt;getTime()[emittedIndex];
+00179 <font class="keywordflow">if</font> (emittedType-&gt;getLifeScheme() != NULL)
+00180 {
+00181 destTime = realEllapsedTimeRatio * deltaT * emittedType-&gt;getTimeIncrement()[emittedIndex];
+00182 }
+00183 <font class="keywordflow">else</font>
+00184 {
+00185 <font class="keywordflow">if</font> (emittedType-&gt;getInitialLife() != 0.f)
+00186 {
+00187 destTime = realEllapsedTimeRatio * deltaT / emittedType-&gt;getInitialLife();
+00188 }
+00189 }
+00190 <font class="keywordflow">if</font> (destTime &gt;= 1.f)
+00191 {
+00192 emittedType-&gt;deleteElement(emittedIndex);
+00193 }
+00194 <font class="keywordflow">else</font>
+00195 {
+00196 <font class="keywordflow">if</font> (emittedType-&gt;isParametricMotionEnabled())
+00197 {
+00198 emittedType-&gt;getParametricInfos()[emittedIndex].Date -= realEllapsedTimeRatio * deltaT;
+00199 }
+00200 <font class="keywordflow">else</font>
+00201 {
+00202 <font class="keywordflow">if</font> (!emittedType-&gt;hasCollisionInfos())
+00203 {
+00204 <font class="comment">// no collision case</font>
+00205 emittedType-&gt;getPos()[emittedIndex] += deltaT * emittedType-&gt;getSpeed()[emittedIndex];
+00206 }
+00207 <font class="keywordflow">else</font> <font class="comment">// if there are collisions, we delay the step to the next iteration to ensure correct collisions</font>
+00208 {
+00209 emittedType-&gt;getCollisionInfo()[emittedIndex].TimeSliceRatio = deltaT / ellapsedTime;
+00210 }
+00211 }
+00212 }
+00213 }
+00214 }
+00215
+<a name="l00217"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#b1">00217</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> CPSEmitter::processEmitConsistent(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;emitterPos,
+00218 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>,
+00219 sint nbToGenerate,
+00220 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> deltaT,
+00221 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime,
+00222 <font class="keywordtype">float</font> realEllapsedTimeRatio
+00223 )
+00224 {
+00225 <font class="keyword">static</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> speed, pos;
+00226 sint emittedIndex;
+00227 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSEmitter.html#n11">_SpeedBasisEmission</a>)
+00228 {
+00229 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n3">_SpeedInheritanceFactor</a> == 0.f)
+00230 {
+00231 <font class="keywordflow">if</font> (_EmitDirBasis)
+00232 {
+00233 <font class="keywordflow">while</font> (nbToGenerate &gt; 0)
+00234 {
+00235 nbToGenerate --;
+00236 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(emitterPos, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00237 emittedIndex = <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, speed, this-&gt;_Owner, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">true</font>, deltaT);
+00238 <font class="keywordflow">if</font> (emittedIndex != - 1) <a class="code" href="namespaceNL3D.html#a419">CompensateEmission</a>(<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00239 <font class="keywordflow">else</font> <font class="keywordflow">break</font>;
+00240 }
+00241 }
+00242 <font class="keywordflow">else</font>
+00243 {
+00244 <font class="keywordflow">while</font> (nbToGenerate &gt; 0)
+00245 {
+00246 nbToGenerate --;
+00247 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(emitterPos, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00248 emittedIndex = <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, speed, this-&gt;_Owner, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">false</font>, deltaT);
+00249 <font class="keywordflow">if</font> (emittedIndex != - 1) <a class="code" href="namespaceNL3D.html#a419">CompensateEmission</a>(<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00250 <font class="keywordflow">else</font> <font class="keywordflow">break</font>;
+00251 }
+00252 }
+00253 }
+00254 <font class="keywordflow">else</font>
+00255 {
+00256 <font class="keywordflow">while</font> (nbToGenerate --)
+00257 {
+00258 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(emitterPos, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00259 emittedIndex = <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, speed + <a class="code" href="classNL3D_1_1CPSEmitter.html#n3">_SpeedInheritanceFactor</a> * <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSpeed()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], this-&gt;<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">true</font>, deltaT);
+00260 <font class="keywordflow">if</font> (emittedIndex != - 1) <a class="code" href="namespaceNL3D.html#a419">CompensateEmission</a>(<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00261 <font class="keywordflow">else</font> <font class="keywordflow">break</font>;
+00262 }
+00263 }
+00264 }
+00265 <font class="keywordflow">else</font>
+00266 {
+00267 <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> m;
+00268 CPSUtil::buildSchmidtBasis(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSpeed()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], m);
+00269 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n3">_SpeedInheritanceFactor</a> == 0.f)
+00270 {
+00271 <font class="keywordflow">while</font> (nbToGenerate &gt; 0)
+00272 {
+00273 nbToGenerate --;
+00274 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(emitterPos, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00275 emittedIndex = <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, m * speed, this-&gt;_Owner, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">true</font>, deltaT);
+00276 <font class="keywordflow">if</font> (emittedIndex != - 1) <a class="code" href="namespaceNL3D.html#a419">CompensateEmission</a>(<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00277 <font class="keywordflow">else</font> <font class="keywordflow">break</font>;
+00278 }
+00279 }
+00280 <font class="keywordflow">else</font>
+00281 {
+00282 <font class="keywordflow">while</font> (nbToGenerate --)
+00283 {
+00284 <a class="code" href="classNL3D_1_1CPSEmitter.html#b4">emit</a>(emitterPos, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, pos, speed);
+00285 emittedIndex = <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;newElement(pos, m * speed + <a class="code" href="classNL3D_1_1CPSEmitter.html#n3">_SpeedInheritanceFactor</a> * <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSpeed()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], this-&gt;<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">true</font>, deltaT);
+00286 <font class="keywordflow">if</font> (emittedIndex != - 1) <a class="code" href="namespaceNL3D.html#a419">CompensateEmission</a>(<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>, emittedIndex, deltaT, ellapsedTime, realEllapsedTimeRatio);
+00287 <font class="keywordflow">else</font> <font class="keywordflow">break</font>;
+00288 }
+00289 }
+00290 }
+00291 }
+00292
+00293
+<a name="l00295"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a9">00295</a> <font class="keywordtype">void</font> CPSEmitter::setEmissionType(TEmissionType freqType)
+00296 {
+00297 <a class="code" href="classNL3D_1_1CPSEmitter.html#n4">_EmissionType</a> = freqType;
+00298 }
+00299
+<a name="l00301"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a5">00301</a> <font class="keywordtype">void</font> CPSEmitter::setEmittedType(CPSLocated *et)
+00302 {
+00303 <font class="keywordflow">if</font> (_EmittedType)
+00304 {
+00305 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>-&gt;unregisterDtorObserver(<font class="keyword">this</font>);
+00306 }
+00307 <font class="keywordflow">if</font> (et)
+00308 {
+00309 et-&gt;registerDtorObserver(<font class="keyword">this</font>);
+00310 }
+00311
+00312 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a> = et;
+00313 }
+00314
+<a name="l00316"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a6">00316</a> <font class="keywordtype">void</font> CPSEmitter::notifyTargetRemoved(CPSLocated *ptr)
+00317 {
+00318 <a class="code" href="debug_8h.html#a6">nlassert</a>(ptr == <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>);
+00319 <a class="code" href="classNL3D_1_1CPSEmitter.html#a5">setEmittedType</a>(NULL);
+00320 }
+00321
+<a name="l00323"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a11">00323</a> <font class="keywordtype">void</font> CPSEmitter::setPeriod(<font class="keywordtype">float</font> period)
+00324 {
+00325 <font class="keywordflow">if</font> (_PeriodScheme)
+00326 {
+00327 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>;
+00328 <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a> = NULL;
+00329 }
+00330 <a class="code" href="classNL3D_1_1CPSEmitter.html#n5">_Period</a> = period;
+00331 }
+00332
+<a name="l00334"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a14">00334</a> <font class="keywordtype">void</font> CPSEmitter::setPeriodScheme(CPSAttribMaker&lt;float&gt; *scheme)
+00335 {
+00336 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>;
+00337 <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a> = scheme;
+00338 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a> &amp;&amp; scheme-&gt;hasMemory()) scheme-&gt;resize(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getMaxSize(), <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize());
+00339 }
+00340
+<a name="l00342"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a21">00342</a> <font class="keywordtype">void</font> CPSEmitter::setGenNb(uint32 genNb)
+00343 {
+00344 <font class="keywordflow">if</font> (_GenNbScheme)
+00345 {
+00346 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>;
+00347 <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> = NULL;
+00348 }
+00349 <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a> = genNb;
+00350 }
+00351
+<a name="l00353"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a24">00353</a> <font class="keywordtype">void</font> CPSEmitter::setGenNbScheme(CPSAttribMaker&lt;uint32&gt; *scheme)
+00354 {
+00355 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>;
+00356 <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> = scheme;
+00357 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a> &amp;&amp; scheme-&gt;hasMemory()) scheme-&gt;resize(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getMaxSize(), <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize());
+00358 }
+00359
+<a name="l00361"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a4">00361</a> <font class="keywordtype">void</font> CPSEmitter::showTool(<font class="keywordtype">void</font>)
+00362 {
+00363 uint32 size = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize();
+00364 <font class="keywordflow">if</font> (!size) <font class="keywordflow">return</font>;
+00365 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a21">setupDriverModelMatrix</a>();
+00366
+00367 <font class="keyword">const</font> CVector I = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a22">computeI</a>();
+00368 <font class="keyword">const</font> CVector K = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a24">computeK</a>();
+00369
+00370 <font class="comment">// ugly slow code, but not for runtime</font>
+00371 <font class="keywordflow">for</font> (uint k = 0; k &lt; size; ++k)
+00372 {
+00373 <font class="comment">// center of the current particle</font>
+00374 <font class="keyword">const</font> CVector p = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[k];
+00375 <font class="keyword">const</font> <font class="keywordtype">float</font> sSize =0.1f;
+00376 std::vector&lt;NLMISC::CLine&gt; lines;
+00377 <a class="code" href="classNLMISC_1_1CLine.html">NLMISC::CLine</a> <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>;
+00378 l.<a class="code" href="classNLMISC_1_1CLine.html#m0">V0</a> = p - sSize * I; l.<a class="code" href="classNLMISC_1_1CLine.html#m1">V1</a> = p + sSize * I; lines.push_back(l);
+00379 l.<a class="code" href="classNLMISC_1_1CLine.html#m0">V0</a> = p - sSize * K; l.<a class="code" href="classNLMISC_1_1CLine.html#m1">V1</a> = p + sSize * K; lines.push_back(l);
+00380 l.<a class="code" href="classNLMISC_1_1CLine.html#m0">V0</a> = p - sSize * (I + K); l.<a class="code" href="classNLMISC_1_1CLine.html#m1">V1</a> = p + sSize * (I + K); lines.push_back(l);
+00381 l.<a class="code" href="classNLMISC_1_1CLine.html#m0">V0</a> = p - sSize * (I - K); l.<a class="code" href="classNLMISC_1_1CLine.html#m1">V1</a> = p + sSize * (I - K); lines.push_back(l);
+00382
+00383 CMaterial mat;
+00384 mat.setBlendFunc(CMaterial::one, CMaterial::one);
+00385 mat.setZWrite(<font class="keyword">false</font>);
+00386 mat.setLighting(<font class="keyword">false</font>);
+00387 mat.setBlend(<font class="keyword">true</font>);
+00388 mat.setZFunc(CMaterial::less);
+00389
+00390
+00391 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#l0">CPSLocated</a> *loc;
+00392 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>;
+00393 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#z720_0">CPSLocatedBindable</a> *lb;
+00394 <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);
+00395
+00396 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));
+00397
+00398
+00399 CDRU::drawLinesUnlit(lines, mat, *<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a10">getDriver</a>() );
+00400 }
+00401 }
+00402
+<a name="l00404"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a28">00404</a> <font class="keywordtype">void</font> CPSEmitter::singleEmit(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, uint quantity)
+00405 {
+00406 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+00407 <font class="keyword">const</font> uint32 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>,0) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00408 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, quantity * nbToGenerate);
+00409 }
+00410
+00411
+<a name="l00413"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#b2">00413</a> <font class="keywordtype">void</font> CPSEmitter::processRegularEmission(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime)
+00414 {
+00415 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+00416 <font class="keyword">const</font> uint size = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize();
+00417 uint leftToDo = size, toProcess;
+00418 <font class="keywordtype">float</font> emitPeriod[<a class="code" href="namespaceNL3D.html#a189">emitterBuffSize</a>];
+00419 <font class="keywordtype">float</font> *currEmitPeriod;
+00420 uint currEmitPeriodPtrInc = <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a> ? 1 : 0;
+00421 sint32 nbToGenerate;
+00422
+00423 TPSAttribTime::iterator phaseIt = <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin(), endPhaseIt;
+00424 TPSAttribUInt8::iterator numEmitIt = <a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.begin();
+00425
+00426 <font class="comment">// we don't use an iterator here</font>
+00427 <font class="comment">// because it could be invalidated if size change (a located could generate itself) </font>
+00428 <font class="keywordflow">do</font>
+00429 {
+00430 toProcess = leftToDo &lt; <a class="code" href="namespaceNL3D.html#a189">emitterBuffSize</a> ? leftToDo : <a class="code" href="namespaceNL3D.html#a189">emitterBuffSize</a>;
+00431
+00432
+00433 <font class="keywordflow">if</font> (_PeriodScheme)
+00434 {
+00435 currEmitPeriod = (<font class="keywordtype">float</font> *) (<a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>-&gt;make(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, size - leftToDo, emitPeriod, <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>));
+00436 }
+00437 <font class="keywordflow">else</font>
+00438 {
+00439 currEmitPeriod = &amp;<a class="code" href="classNL3D_1_1CPSEmitter.html#n5">_Period</a>;
+00440 }
+00441
+00442 endPhaseIt = phaseIt + toProcess;
+00443
+00444 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a> == 0) <font class="comment">// no emission count limit</font>
+00445 {
+00447 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a> == 0.f) <font class="comment">// no emission delay</font>
+00448 {
+00449 <font class="keywordflow">do</font>
+00450 {
+00451 *phaseIt += ellapsedTime;
+00452 <font class="keywordflow">if</font> ( *phaseIt &gt;= *currEmitPeriod) <font class="comment">// phase is greater than period -&gt; must emit</font>
+00453 {
+00454 <font class="keywordflow">if</font> (*currEmitPeriod != 0)
+00455 {
+00456 *phaseIt -= ::floorf(*phaseIt / *currEmitPeriod) * *currEmitPeriod;
+00457 }
+00458 <font class="keyword">const</font> uint32 k = phaseIt - (<a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin());
+00459 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, k) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00460 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(k, nbToGenerate);
+00461 }
+00462
+00463 ++phaseIt;
+00464 currEmitPeriod += currEmitPeriodPtrInc;
+00465 }
+00466 <font class="keywordflow">while</font> (phaseIt != endPhaseIt);
+00467 }
+00468 <font class="keywordflow">else</font> <font class="comment">// thhere's an emission delay</font>
+00469 {
+00470 <font class="keywordflow">do</font>
+00471 {
+00472 *phaseIt += ellapsedTime;
+00473 <font class="keywordflow">if</font> ( *phaseIt &gt;= *currEmitPeriod + <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>) <font class="comment">// phase is greater than period -&gt; must emit</font>
+00474 {
+00475 <font class="keywordflow">if</font> (*currEmitPeriod != 0)
+00476 {
+00477 *phaseIt -= ::floorf((*phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>) / *currEmitPeriod) * *currEmitPeriod;
+00478 }
+00479 <font class="keyword">const</font> uint32 k = phaseIt - (<a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin());
+00480 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, k) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00481 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(k, nbToGenerate);
+00482 }
+00483
+00484 ++phaseIt;
+00485 currEmitPeriod += currEmitPeriodPtrInc;
+00486 }
+00487 <font class="keywordflow">while</font> (phaseIt != endPhaseIt);
+00488 }
+00489 }
+00490 <font class="keywordflow">else</font> <font class="comment">// there's an emission count limit</font>
+00491 {
+00493 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a> == 0.f) <font class="comment">// no emission delay</font>
+00494 {
+00495 <font class="keywordflow">do</font>
+00496 {
+00497 <font class="keywordflow">if</font> (*numEmitIt &lt; <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>)
+00498 {
+00499 *phaseIt += ellapsedTime;
+00500 <font class="keywordflow">if</font> ( *phaseIt &gt;= *currEmitPeriod) <font class="comment">// phase is greater than period -&gt; must emit</font>
+00501 {
+00502 <font class="keywordflow">if</font> (*currEmitPeriod != 0)
+00503 {
+00504 *phaseIt -= ::floorf(*phaseIt / *currEmitPeriod) * *currEmitPeriod;
+00505 }
+00506 <font class="keyword">const</font> uint32 k = phaseIt - (<a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin());
+00507 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, k) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00508 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(k, nbToGenerate);
+00509 ++*numEmitIt;
+00510 }
+00511 }
+00512 ++phaseIt;
+00513 currEmitPeriod += currEmitPeriodPtrInc;
+00514 ++ numEmitIt;
+00515 }
+00516 <font class="keywordflow">while</font> (phaseIt != endPhaseIt);
+00517 }
+00518 <font class="keywordflow">else</font> <font class="comment">// there's an emission delay</font>
+00519 {
+00520 <font class="keywordflow">do</font>
+00521 {
+00522 <font class="keywordflow">if</font> (*numEmitIt &lt; <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>)
+00523 {
+00524 *phaseIt += ellapsedTime;
+00525 <font class="keywordflow">if</font> ( *phaseIt &gt;= *currEmitPeriod + <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>) <font class="comment">// phase is greater than period -&gt; must emit</font>
+00526 {
+00527 <font class="keywordflow">if</font> (*currEmitPeriod != 0)
+00528 {
+00529 *phaseIt -= ::floorf((*phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>) / *currEmitPeriod) * *currEmitPeriod;
+00530 }
+00531 <font class="keyword">const</font> uint32 k = phaseIt - (<a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin());
+00532 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, k) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00533 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(k, nbToGenerate);
+00534 ++*numEmitIt;
+00535 }
+00536 }
+00537 ++phaseIt;
+00538 currEmitPeriod += currEmitPeriodPtrInc;
+00539 ++numEmitIt;
+00540 }
+00541 <font class="keywordflow">while</font> (phaseIt != endPhaseIt);
+00542 }
+00543 }
+00544
+00545 leftToDo -= toProcess;
+00546 }
+00547 <font class="keywordflow">while</font> (leftToDo);
+00548 }
+00549
+00551 <font class="comment">// depending on wether its motion is parametric or incremental. This is used to create emittees at the right position</font>
+00552
+00553 <font class="keyword">static</font> <font class="keyword">inline</font> uint <a class="code" href="namespaceNL3D.html#a420">GenEmitterPositions</a>(CPSLocated *emitter,
+00554 CPSLocated *emittee,
+00555 uint emitterIndex,
+00556 uint numStep,
+00557 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> deltaT, <font class="comment">/* fraction of time needed to reach the first emission */</font>
+00558 <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> step,
+00559 std::vector&lt;NLMISC::CVector&gt; &amp;dest
+00560 )
+00561 {
+00562 <font class="keyword">const</font> uint toProcess = std::max(1U, std::min(numStep, (uint) emittee-&gt;getMaxSize()));
+00563 dest.resize(toProcess);
+00564
+00565
+00566 <font class="keywordflow">if</font> (!emitter-&gt;isParametricMotionEnabled()) <font class="comment">// standard case : take current pos and integrate</font>
+00567 {
+00568 <font class="keywordflow">if</font> (toProcess == 1) <font class="comment">// only one emission -&gt; takes current pos</font>
+00569 {
+00570 dest[0] = emitter-&gt;getPos()[emitterIndex] - deltaT * emitter-&gt;getSpeed()[emitterIndex];
+00571 }
+00572 <font class="keywordflow">else</font>
+00573 {
+00574 std::vector&lt;NLMISC::CVector&gt;::iterator outIt = dest.end();
+00575 std::vector&lt;NLMISC::CVector&gt;::iterator endIt = dest.begin();
+00576 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> pos = emitter-&gt;getPos()[emitterIndex] - deltaT * emitter-&gt;getSpeed()[emitterIndex];
+00577 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> speed = step * emitter-&gt;getSpeed()[emitterIndex];
+00578 <font class="keywordflow">do</font>
+00579 {
+00580 -- outIt;
+00581 *outIt = pos;
+00582 pos -= speed;
+00583 }
+00584 <font class="keywordflow">while</font> (outIt != endIt);
+00585 }
+00586 }
+00587 <font class="keywordflow">else</font> <font class="comment">// compute parametric trajectory</font>
+00588 {
+00589 emitter-&gt;integrateSingle(emitter-&gt;getOwner()-&gt;getSystemDate() - deltaT - step * toProcess,
+00590 step,
+00591 toProcess,
+00592 emitterIndex,
+00593 &amp;dest[0]
+00594 );
+00595 }
+00596
+00597 <font class="keywordflow">return</font> toProcess;
+00598 }
+00599
+<a name="l00601"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#b3">00601</a> <font class="keywordtype">void</font> CPSEmitter::processRegularEmissionConsistent(<a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime, <font class="keywordtype">float</font> realEllapsedTimeRatio)
+00602 {
+00604
+00605 <font class="keyword">static</font> std::vector&lt;NLMISC::CVector&gt; emitterPositions;
+00606 <font class="comment">// Positions for the emitter. They are computed by using a parametric trajectory or by using integration</font>
+00607
+00608 <font class="keyword">const</font> uint size = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize();
+00609 uint leftToDo = size, toProcess;
+00610 <font class="keywordtype">float</font> emitPeriod[<a class="code" href="namespaceNL3D.html#a189">emitterBuffSize</a>];
+00611 <font class="keywordtype">float</font> *currEmitPeriod;
+00612 uint currEmitPeriodPtrInc = <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a> ? 1 : 0;
+00613 sint32 nbToGenerate;
+00614
+00615
+00616 TPSAttribTime::iterator phaseIt = <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin(), endPhaseIt;
+00617 TPSAttribUInt8::iterator numEmitIt = <a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.begin();
+00618
+00619 <font class="comment">// we don't use an iterator here</font>
+00620 <font class="comment">// because it could be invalidated if size change (a located could generate itself) </font>
+00621 <font class="keywordflow">do</font>
+00622 {
+00623 toProcess = leftToDo &lt; <a class="code" href="namespaceNL3D.html#a189">emitterBuffSize</a> ? leftToDo : <a class="code" href="namespaceNL3D.html#a189">emitterBuffSize</a>;
+00624
+00625
+00626 <font class="keywordflow">if</font> (_PeriodScheme)
+00627 {
+00628 currEmitPeriod = (<font class="keywordtype">float</font> *) (<a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>-&gt;make(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, size - leftToDo, emitPeriod, <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>));
+00629 }
+00630 <font class="keywordflow">else</font>
+00631 {
+00632 currEmitPeriod = &amp;<a class="code" href="classNL3D_1_1CPSEmitter.html#n5">_Period</a>;
+00633 }
+00634
+00635 endPhaseIt = phaseIt + toProcess;
+00636
+00637 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a> == 0) <font class="comment">// no emission count limit</font>
+00638 {
+00640 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a> == 0.f) <font class="comment">// no emission delay</font>
+00641 {
+00642 <font class="keywordflow">do</font>
+00643 {
+00644 *phaseIt += ellapsedTime;
+00645 <font class="keywordflow">if</font> ( *phaseIt &gt;= *currEmitPeriod) <font class="comment">// phase is greater than period -&gt; must emit</font>
+00646 {
+00647 <font class="keywordflow">if</font> (*currEmitPeriod != 0)
+00648 {
+00651 *phaseIt = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(*phaseIt, *currEmitPeriod + ellapsedTime);
+00652 <font class="comment">//</font>
+00654 <font class="comment"> uint numEmissions = (uint) ::floorf(*phaseIt / *currEmitPeriod);</font>
+00655 *phaseIt -= *currEmitPeriod * numEmissions;
+00656 <font class="keywordtype">float</font> deltaT = std::max(0.f, *phaseIt);
+00657 <font class="comment">//nlassert(deltaT &gt;= 0.f);</font>
+00658 uint emitterIndex = phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin();
+00659
+00661 numEmissions = <a class="code" href="namespaceNL3D.html#a420">GenEmitterPositions</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>,
+00662 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>,
+00663 emitterIndex,
+00664 numEmissions,
+00665 deltaT,
+00666 *currEmitPeriod,
+00667 emitterPositions
+00668 );
+00669
+00671 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, emitterIndex) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00672 uint k = numEmissions;
+00673 <font class="keywordflow">do</font>
+00674 {
+00675 --k;
+00676 <a class="code" href="classNL3D_1_1CPSEmitter.html#b1">processEmitConsistent</a>(emitterPositions[k],
+00677 emitterIndex,
+00678 nbToGenerate,
+00679 deltaT,
+00680 ellapsedTime,
+00681 realEllapsedTimeRatio);
+00682 deltaT += *currEmitPeriod;
+00683 }
+00684 <font class="keywordflow">while</font> (k);
+00685 }
+00686 <font class="keywordflow">else</font>
+00687 {
+00688 <font class="keyword">const</font> uint32 emitterIndex = phaseIt - (<a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin());
+00689 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, emitterIndex) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00690 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(emitterIndex, nbToGenerate);
+00691 }
+00692 }
+00693
+00694 ++phaseIt;
+00695 currEmitPeriod += currEmitPeriodPtrInc;
+00696 }
+00697 <font class="keywordflow">while</font> (phaseIt != endPhaseIt);
+00698 }
+00699 <font class="keywordflow">else</font> <font class="comment">// thhere's an emission delay</font>
+00700 {
+00701 <font class="keywordflow">do</font>
+00702 {
+00703 *phaseIt += ellapsedTime;
+00704 <font class="keywordflow">if</font> ( *phaseIt &gt;= *currEmitPeriod + <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>) <font class="comment">// phase is greater than period -&gt; must emit</font>
+00705 {
+00706 <font class="keywordflow">if</font> (*currEmitPeriod != 0)
+00707 {
+00710 *phaseIt = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(*phaseIt, *currEmitPeriod + ellapsedTime + <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>);
+00711 <font class="comment">//</font>
+00712 uint numEmissions = (uint) ::floorf((*phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>) / *currEmitPeriod);
+00713 *phaseIt -= *currEmitPeriod * numEmissions;
+00714 <font class="keywordtype">float</font> deltaT = std::max(*phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>, 0.f);
+00715 <font class="comment">//nlassert(deltaT &gt;= 0.f);</font>
+00716
+00717 uint emitterIndex = phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin();
+00719 numEmissions = <a class="code" href="namespaceNL3D.html#a420">GenEmitterPositions</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>,
+00720 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>,
+00721 emitterIndex,
+00722 numEmissions,
+00723 deltaT,
+00724 *currEmitPeriod,
+00725 emitterPositions
+00726 );
+00728 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, emitterIndex) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00729 uint k = numEmissions;
+00730 <font class="keywordflow">do</font>
+00731 {
+00732 --k;
+00733 <a class="code" href="classNL3D_1_1CPSEmitter.html#b1">processEmitConsistent</a>(emitterPositions[k],
+00734 emitterIndex,
+00735 nbToGenerate,
+00736 deltaT,
+00737 ellapsedTime,
+00738 realEllapsedTimeRatio);
+00739 deltaT += *currEmitPeriod;
+00740 }
+00741 <font class="keywordflow">while</font> (k);
+00742 }
+00743 <font class="keywordflow">else</font>
+00744 {
+00745 <font class="keyword">const</font> uint32 emitterIndex = phaseIt - (<a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin());
+00746 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, emitterIndex) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00747 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(emitterIndex, nbToGenerate);
+00748 }
+00749 }
+00750
+00751 ++phaseIt;
+00752 currEmitPeriod += currEmitPeriodPtrInc;
+00753 }
+00754 <font class="keywordflow">while</font> (phaseIt != endPhaseIt);
+00755 }
+00756 }
+00757 <font class="keywordflow">else</font> <font class="comment">// there's an emission count limit</font>
+00758 {
+00760 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a> == 0.f) <font class="comment">// no emission delay</font>
+00761 {
+00762 <font class="keywordflow">do</font>
+00763 {
+00764 <font class="keywordflow">if</font> (*numEmitIt &lt; <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>)
+00765 {
+00766 *phaseIt += ellapsedTime;
+00767 <font class="keywordflow">if</font> ( *phaseIt &gt;= *currEmitPeriod) <font class="comment">// phase is greater than period -&gt; must emit</font>
+00768 {
+00769 <font class="keywordflow">if</font> (*currEmitPeriod != 0)
+00770 {
+00773 *phaseIt = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(*phaseIt, *currEmitPeriod + ellapsedTime);
+00774 <font class="comment">//</font>
+00775 uint numEmissions = (uint) ::floorf(*phaseIt / *currEmitPeriod);
+00776 *numEmitIt += numEmissions;
+00777 *phaseIt -= *currEmitPeriod * numEmissions;
+00778 <font class="keywordtype">float</font> deltaT = std::max(*phaseIt, 0.f);
+00779 <font class="comment">//nlassert(deltaT &gt;= 0.f);</font>
+00780 uint emitterIndex = phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin();
+00781 <font class="keywordflow">if</font> (*numEmitIt &gt; <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>) <font class="comment">// make sure we don't go over the emission limit</font>
+00782 {
+00783 numEmissions -= *numEmitIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>;
+00784 *numEmitIt = <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>;
+00785 }
+00787 numEmissions = <a class="code" href="namespaceNL3D.html#a420">GenEmitterPositions</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>,
+00788 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>,
+00789 emitterIndex,
+00790 numEmissions,
+00791 deltaT,
+00792 *currEmitPeriod,
+00793 emitterPositions
+00794 );
+00795 uint k = numEmissions;
+00797 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, emitterIndex) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00798 <font class="keywordflow">do</font>
+00799 {
+00800 --k;
+00801 <a class="code" href="classNL3D_1_1CPSEmitter.html#b1">processEmitConsistent</a>(emitterPositions[k],
+00802 emitterIndex,
+00803 nbToGenerate,
+00804 deltaT,
+00805 ellapsedTime,
+00806 realEllapsedTimeRatio);
+00807 deltaT += *currEmitPeriod;
+00808 }
+00809 <font class="keywordflow">while</font> (k);
+00810 }
+00811 <font class="keywordflow">else</font>
+00812 {
+00813 <font class="keyword">const</font> uint32 emitterIndex = phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin();
+00814 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, emitterIndex) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00815 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(emitterIndex, nbToGenerate);
+00816 ++*numEmitIt;
+00817 }
+00818 }
+00819 }
+00820 ++phaseIt;
+00821 currEmitPeriod += currEmitPeriodPtrInc;
+00822 ++ numEmitIt;
+00823 }
+00824 <font class="keywordflow">while</font> (phaseIt != endPhaseIt);
+00825 }
+00826 <font class="keywordflow">else</font> <font class="comment">// there's an emission delay</font>
+00827 {
+00828 <font class="keywordflow">do</font>
+00829 {
+00830 <font class="keywordflow">if</font> (*numEmitIt &lt; <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>)
+00831 {
+00832 *phaseIt += ellapsedTime;
+00833 <font class="keywordflow">if</font> ( *phaseIt &gt;= *currEmitPeriod + <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>) <font class="comment">// phase is greater than period -&gt; must emit</font>
+00834 {
+00835 <font class="keywordflow">if</font> (*currEmitPeriod != 0)
+00836 {
+00839 *phaseIt = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(*phaseIt, *currEmitPeriod + ellapsedTime + <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>);
+00840 <font class="comment">//</font>
+00841 uint numEmissions = (uint) ::floorf((*phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>) / *currEmitPeriod);
+00842 *numEmitIt += numEmissions;
+00843 *phaseIt -= *currEmitPeriod * numEmissions;
+00844 <font class="keywordtype">float</font> deltaT = std::max(*phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n9">_EmitDelay</a>, 0.f);
+00845 <font class="comment">//nlassert(deltaT &gt;= 0.f);</font>
+00846 uint emitterIndex = phaseIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin();
+00847 <font class="keywordflow">if</font> (*numEmitIt &gt; <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>) <font class="comment">// make sure we don't go over the emission limit</font>
+00848 {
+00849 numEmissions -= *numEmitIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>;
+00850 *numEmitIt = <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>;
+00851 }
+00853 numEmissions = <a class="code" href="namespaceNL3D.html#a420">GenEmitterPositions</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>,
+00854 <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>,
+00855 emitterIndex,
+00856 numEmissions,
+00857 deltaT,
+00858 *currEmitPeriod,
+00859 emitterPositions
+00860 );
+00861 uint k = numEmissions;
+00863 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, emitterIndex) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00864 <font class="keywordflow">do</font>
+00865 {
+00866 --k;
+00867 <a class="code" href="classNL3D_1_1CPSEmitter.html#b1">processEmitConsistent</a>(emitterPositions[k],
+00868 emitterIndex,
+00869 nbToGenerate,
+00870 deltaT,
+00871 ellapsedTime,
+00872 realEllapsedTimeRatio);
+00873 deltaT += *currEmitPeriod;
+00874 }
+00875 <font class="keywordflow">while</font> (k);
+00876 }
+00877 <font class="keywordflow">else</font>
+00878 {
+00879 <font class="keyword">const</font> uint32 emitterIndex = phaseIt - (<a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin());
+00880 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, emitterIndex) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00881 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(emitterIndex, nbToGenerate);
+00882 ++*numEmitIt;
+00883 }
+00884 }
+00885 }
+00886 ++phaseIt;
+00887 currEmitPeriod += currEmitPeriodPtrInc;
+00888 ++numEmitIt;
+00889 }
+00890 <font class="keywordflow">while</font> (phaseIt != endPhaseIt);
+00891 }
+00892 }
+00893
+00894 leftToDo -= toProcess;
+00895 }
+00896 <font class="keywordflow">while</font> (leftToDo);
+00897 }
+00898
+<a name="l00900"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a3">00900</a> <font class="keywordtype">void</font> CPSEmitter::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> realEllapsedTime)
+00901 {
+00902 <font class="keywordflow">if</font> (pass == <a class="code" href="namespaceNL3D.html#a484a171">PSToolRender</a>)
+00903 {
+00904 <a class="code" href="classNL3D_1_1CPSEmitter.html#a4">showTool</a>();
+00905 <font class="keywordflow">return</font>;
+00906 }
+00907 <font class="keywordflow">if</font> (pass != <a class="code" href="namespaceNL3D.html#a484a166">PSEmit</a> || !<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>) <font class="keywordflow">return</font>;
+00908 <font class="keyword">const</font> uint32 size = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize();
+00909 <font class="keywordflow">if</font> (!size) <font class="keywordflow">return</font>;
+00910
+00911 <font class="keywordflow">if</font> (ellapsedTime == 0.f) <font class="keywordflow">return</font>; <font class="comment">// do nothing when paused</font>
+00912
+00913 <font class="comment">// our behaviour depend of the frequency</font>
+00914 <font class="keywordflow">switch</font> (_EmissionType)
+00915 {
+00916 <font class="keywordflow">case</font> CPSEmitter::once :
+00917 {
+00918 TPSAttribTime::iterator timeIt = <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin()
+00919 , timeEndIt = <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.end();
+00920
+00921 <font class="keywordflow">while</font> (timeIt != timeEndIt)
+00922 {
+00923 <font class="keywordflow">if</font> (*timeIt == 0.f)
+00924 {
+00925 <font class="keyword">const</font> uint32 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, timeIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin()) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00926 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(timeIt - <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.begin(), nbToGenerate);
+00927 *timeIt = 1.f;
+00928 }
+00929 ++timeIt;
+00930 }
+00931 }
+00932 <font class="keywordflow">break</font>;
+00933 <font class="keywordflow">case</font> (CPSEmitter::regular):
+00934 {
+00935 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSEmitter.html#n13">_ConsistentEmission</a>)
+00936 {
+00937 <a class="code" href="classNL3D_1_1CPSEmitter.html#b2">processRegularEmission</a>(ellapsedTime);
+00938 }
+00939 <font class="keywordflow">else</font>
+00940 {
+00941 <a class="code" href="classNL3D_1_1CPSEmitter.html#b3">processRegularEmissionConsistent</a>(ellapsedTime, realEllapsedTime / ellapsedTime);
+00942 }
+00943 }
+00944 <font class="keywordflow">break</font>;
+00945 <font class="keywordflow">default</font>: <font class="keywordflow">break</font>;
+00946 }
+00947 }
+00948
+<a name="l00950"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#b5">00950</a> <font class="keywordtype">void</font> CPSEmitter::newElement(CPSLocated *emitterLocated, uint32 emitterIndex)
+00951 {
+00952 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.getSize() != <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.getMaxSize());
+00953
+00954 <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.insert(0.f);
+00955 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a> != 0)
+00956 {
+00957 <a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.insert(0);
+00958 }
+00959 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>-&gt;newElement(emitterLocated, emitterIndex);
+00960 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;newElement(emitterLocated, emitterIndex);
+00961
+00962 }
+00963
+<a name="l00965"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#b6">00965</a> <font class="keywordtype">void</font> CPSEmitter::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+00966 {
+00967
+00968 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n4">_EmissionType</a> == CPSEmitter::onDeath &amp;&amp; <a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>)
+00969 {
+00970 <font class="keyword">const</font> uint32 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+00971 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, nbToGenerate);
+00972 }
+00973
+00974 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>-&gt;deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00975 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00976 <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00977 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a> != 0)
+00978 {
+00979 <a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00980 }
+00981 }
+00982
+<a name="l00984"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#b7">00984</a> <font class="keywordtype">void</font> CPSEmitter::resize(uint32 size)
+00985 {
+00986 <a class="code" href="debug_8h.html#a6">nlassert</a>(size &lt; (1 &lt;&lt; 16));
+00987 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSEmitter.html#n6">_PeriodScheme</a>-&gt;resize(size, <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize());
+00988 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;resize(size, <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize());
+00989 <a class="code" href="classNL3D_1_1CPSEmitter.html#n1">_Phase</a>.resize(size);
+00990 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a> != 0)
+00991 {
+00992 <a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.resize(size);
+00993 }
+00994 }
+00995
+<a name="l00997"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#b8">00997</a> <font class="keywordtype">void</font> CPSEmitter::bounceOccured(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+00998 {
+00999 <font class="comment">// TODO : avoid duplication with deleteElement</font>
+01000 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n4">_EmissionType</a> == CPSEmitter::onBounce)
+01001 {
+01002 <font class="keyword">const</font> uint32 nbToGenerate = <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a> ? <a class="code" href="classNL3D_1_1CPSEmitter.html#n8">_GenNbScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) : <a class="code" href="classNL3D_1_1CPSEmitter.html#n7">_GenNb</a>;
+01003 <a class="code" href="classNL3D_1_1CPSEmitter.html#b0">processEmit</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, nbToGenerate);
+01004 }
+01005 }
+01006
+<a name="l01008"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a27">01008</a> <font class="keywordtype">void</font> CPSEmitter::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+01009 {
+01010
+01012 sint ver = f.serialVersion(4);
+01013 CPSLocatedBindable::serial(f);
+01014
+01015 f.serialPolyPtr(_EmittedType);
+01016 f.serial(_Phase);
+01017 f.serial(_SpeedInheritanceFactor);
+01018 f.serial(_SpeedBasisEmission);
+01019
+01020 f.serialEnum(_EmissionType);
+01021
+01022 <font class="comment">// this is for use with serial</font>
+01023 <font class="keywordtype">bool</font> trueB = <font class="keyword">true</font>, falseB = <font class="keyword">false</font>;
+01024
+01025 <font class="keywordflow">if</font> (!f.isReading())
+01026 {
+01027 <font class="keywordflow">switch</font> (_EmissionType)
+01028 {
+01029 <font class="keywordflow">case</font> CPSEmitter::regular:
+01030 <font class="keywordflow">if</font> (_PeriodScheme)
+01031 {
+01032 f.serial(trueB);
+01033 f.serialPolyPtr(_PeriodScheme);
+01034 }
+01035 <font class="keywordflow">else</font>
+01036 {
+01037 f.serial(falseB);
+01038 f.serial(_Period);
+01039 }
+01040 <font class="keywordflow">if</font> (ver &gt;= 3)
+01041 {
+01042 f.serial(_EmitDelay, _MaxEmissionCount);
+01043 }
+01044 <font class="keywordflow">break</font>;
+01045 <font class="keywordflow">default</font>:
+01046 <font class="keywordflow">break</font>;
+01047 }
+01048 <font class="keywordflow">if</font> (_GenNbScheme)
+01049 {
+01050 f.serial(trueB);
+01051 f.serialPolyPtr(_GenNbScheme);
+01052 }
+01053 <font class="keywordflow">else</font>
+01054 {
+01055 f.serial(falseB);
+01056 f.serial(_GenNb);
+01057 }
+01058 }
+01059 <font class="keywordflow">else</font>
+01060 {
+01061 <font class="keywordtype">bool</font> useScheme;
+01062 <font class="keywordflow">switch</font> (_EmissionType)
+01063 {
+01064 <font class="keywordflow">case</font> CPSEmitter::regular:
+01065 {
+01066 f.serial(useScheme);
+01067 <font class="keywordflow">if</font> (useScheme)
+01068 {
+01069 <font class="keyword">delete</font> _PeriodScheme;
+01070 f.serialPolyPtr(_PeriodScheme);
+01071 }
+01072 <font class="keywordflow">else</font>
+01073 {
+01074 f.serial(_Period);
+01075 }
+01076 <font class="keywordflow">if</font> (ver &gt;= 3)
+01077 {
+01078 f.serial(_EmitDelay, _MaxEmissionCount);
+01079 updateMaxCountVect();
+01080 }
+01081 }
+01082 <font class="keywordflow">break</font>;
+01083 <font class="keywordflow">default</font>:
+01084 <font class="keywordflow">break</font>;
+01085 }
+01086
+01087 f.serial(useScheme);
+01088 <font class="keywordflow">if</font> (useScheme)
+01089 {
+01090 <font class="keyword">delete</font> _GenNbScheme;
+01091 f.serialPolyPtr(_GenNbScheme);
+01092 }
+01093 <font class="keywordflow">else</font>
+01094 {
+01095 f.serial(_GenNb);
+01096 }
+01097 }
+01098 <font class="keywordflow">if</font> (ver &gt; 1)
+01099 {
+01100 f.serial(_EmitDirBasis);
+01101 }
+01102 <font class="keywordflow">if</font> (ver &gt;= 4)
+01103 {
+01104 f.serial(_ConsistentEmission);
+01105 }
+01106 }
+01107
+<a name="l01109"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#b9">01109</a> <font class="keywordtype">void</font> CPSEmitter::updateMaxCountVect()
+01110 {
+01111 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>)
+01112 {
+01113 <a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.resize(0);
+01114 }
+01115 <font class="keywordflow">else</font>
+01116 {
+01117 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01118 <a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.resize(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getMaxSize());
+01119 <font class="keywordflow">while</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.getSize() != 0)
+01120 {
+01121 <a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.remove(0);
+01122 }
+01123 <font class="keywordflow">while</font> (<a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.getSize() != <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize())
+01124 {
+01125 <a class="code" href="classNL3D_1_1CPSEmitter.html#n2">_NumEmission</a>.insert(0);
+01126 }
+01127 }
+01128 }
+01129
+<a name="l01131"></a><a class="code" href="classNL3D_1_1CPSEmitter.html#a19">01131</a> <font class="keywordtype">void</font> CPSEmitter::setMaxEmissionCount(uint8 count)
+01132 {
+01133 <font class="keywordflow">if</font> (count == <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a>) <font class="keywordflow">return</font>;
+01134 <a class="code" href="classNL3D_1_1CPSEmitter.html#n10">_MaxEmissionCount</a> = count;
+01135 <a class="code" href="classNL3D_1_1CPSEmitter.html#b9">updateMaxCountVect</a>();
+01136 }
+01137
+01138
+01139
+01141 <font class="comment">// implementation of CPSModulatedEmitter //</font>
+01143 <font class="comment"></font>
+<a name="l01144"></a><a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#a8">01144</a> <font class="keywordtype">void</font> CPSModulatedEmitter::serialEmitteeSpeedScheme(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+01145 {
+01146 <font class="keywordtype">bool</font> useScheme;
+01147 <font class="keywordflow">if</font> (!f.isReading())
+01148 {
+01149 useScheme = useEmitteeSpeedScheme();
+01150 }
+01151 f.serial(useScheme);
+01152 <font class="keywordflow">if</font> (useScheme)
+01153 {
+01154 f.serialPolyPtr(_EmitteeSpeedScheme);
+01155 }
+01156 <font class="keywordflow">else</font>
+01157 {
+01158 f.serial(_EmitteeSpeed);
+01159 }
+01160 }
+01161
+01162
+01163
+01165 <font class="comment">// implementation of CPSEmitterOmni //</font>
+01167 <font class="comment"></font>
+<a name="l01169"></a><a class="code" href="classNL3D_1_1CPSEmitterOmni.html#a3">01169</a> <font class="comment">void CPSEmitterOmni::emit(const NLMISC::CVector &amp;srcPos, uint32 index, CVector &amp;pos, CVector &amp;speed)</font>
+01170 {
+01171 <font class="comment">// TODO : verifier que ca marche si une particule s'emet elle-mem</font>
+01172 <a class="code" href="debug_8h.html#a6">nlassert</a>(_EmittedType);
+01173
+01174 CVector <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>( ((rand() % 1000) - 500) / 500.0f
+01175 , ((rand() % 1000) - 500) / 500.0f
+01176 , ((rand() % 1000) - 500) / 500.0f);
+01177 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.normalize();
+01178 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a> *= _EmitteeSpeedScheme ? _EmitteeSpeedScheme-&gt;get(_Owner, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) : _EmitteeSpeed;
+01179
+01180 pos = srcPos;
+01181 speed = <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>;
+01182 }
+01183
+<a name="l01185"></a><a class="code" href="classNL3D_1_1CPSEmitterOmni.html#a1">01185</a> <font class="keywordtype">void</font> CPSEmitterOmni::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+01186 {
+01187 f.serialVersion(1);
+01188 CPSEmitter::serial(f);
+01189 CPSModulatedEmitter::serialEmitteeSpeedScheme(f);
+01190 }
+01191
+<a name="l01193"></a><a class="code" href="classNL3D_1_1CPSEmitterOmni.html#b1">01193</a> <font class="keywordtype">void</font> CPSEmitterOmni::newElement(CPSLocated *emitter, uint32 emitterIndex)
+01194 {
+01195 CPSEmitter::newElement(emitter, emitterIndex);
+01196 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b1">newEmitteeSpeedElement</a>(emitter, emitterIndex);
+01197 }
+01198
+<a name="l01200"></a><a class="code" href="classNL3D_1_1CPSEmitterOmni.html#b2">01200</a> <font class="keywordtype">void</font> CPSEmitterOmni::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+01201 {
+01202 CPSEmitter::deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01203 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b2">deleteEmitteeSpeedElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01204 }
+01205
+<a name="l01207"></a><a class="code" href="classNL3D_1_1CPSEmitterOmni.html#b3">01207</a> <font class="keywordtype">void</font> CPSEmitterOmni::resize(uint32 capacity)
+01208 {
+01209 <a class="code" href="debug_8h.html#a6">nlassert</a>(capacity &lt; (1 &lt;&lt; 16));
+01210 CPSEmitter::resize(capacity);
+01211 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b3">resizeEmitteeSpeed</a>(capacity);
+01212 }
+01213
+<a name="l01215"></a><a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#a3">01215</a> <font class="keywordtype">void</font> CPSEmitterDirectionnal::emit(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;srcPos, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, CVector &amp;pos, CVector &amp;speed)
+01216 {
+01217 <font class="comment">// TODO : verifier que ca marche si une particule s'emet elle-mem</font>
+01218 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>);
+01219
+01220
+01221 speed = (<a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n1">_EmitteeSpeedScheme</a> ? <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n1">_EmitteeSpeedScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) : <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n0">_EmitteeSpeed</a>) * <a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#n0">_Dir</a>;
+01222 pos = srcPos;
+01223 }
+01224
+<a name="l01226"></a><a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#b1">01226</a> <font class="keywordtype">void</font> CPSEmitterDirectionnal::newElement(CPSLocated *emitter, uint32 emitterIndex)
+01227 {
+01228 CPSEmitter::newElement(emitter, emitterIndex);
+01229 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b1">newEmitteeSpeedElement</a>(emitter, emitterIndex);
+01230 }
+01231
+<a name="l01233"></a><a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#b2">01233</a> <font class="keywordtype">void</font> CPSEmitterDirectionnal::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+01234 {
+01235 CPSEmitter::deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01236 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b2">deleteEmitteeSpeedElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01237 }
+01238
+<a name="l01240"></a><a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#b3">01240</a> <font class="keywordtype">void</font> CPSEmitterDirectionnal::resize(uint32 capacity)
+01241 {
+01242 <a class="code" href="debug_8h.html#a6">nlassert</a>(capacity &lt; (1 &lt;&lt; 16));
+01243 CPSEmitter::resize(capacity);
+01244 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b3">resizeEmitteeSpeed</a>(capacity);
+01245 }
+01246
+<a name="l01248"></a><a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#a1">01248</a> <font class="keywordtype">void</font> CPSEmitterDirectionnal::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+01249 {
+01250 f.serialVersion(1);
+01251 CPSEmitter::serial(f);
+01252 CPSModulatedEmitter::serialEmitteeSpeedScheme(f);
+01253 f.serial(_Dir);
+01254 }
+01255
+01257 <font class="comment">// implementation of CPSEmitterRectangle //</font>
+01259 <font class="comment"></font>
+<a name="l01261"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#a1">01261</a> <font class="comment">void CPSEmitterRectangle::serial(NLMISC::IStream &amp;f) throw(NLMISC::EStream)</font>
+01262 {
+01263 f.serialVersion(1);
+01264 CPSEmitter::serial(f);
+01265 CPSModulatedEmitter::serialEmitteeSpeedScheme(f);
+01266 f.serial(_Basis);
+01267 f.serial(_Width);
+01268 f.serial(_Height);
+01269 f.serial(_Dir);
+01270
+01271 }
+01272
+<a name="l01274"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#a3">01274</a> <font class="keywordtype">void</font> CPSEmitterRectangle::emit(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;srcPos, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, CVector &amp;pos, CVector &amp;speed)
+01275 {
+01276 CVector N = <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].X ^ <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].Y;
+01277 pos = srcPos + ((rand() % 32000) * (1.f / 16000) - 1.f) * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].X
+01278 + ((rand() % 32000) * (1.f / 16000) - 1.f) * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].Y;
+01279 speed = (<a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n1">_EmitteeSpeedScheme</a> ? <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n1">_EmitteeSpeedScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) : <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n0">_EmitteeSpeed</a>)
+01280 * (<a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n3">_Dir</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].X+ <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n3">_Dir</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].Y + <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n3">_Dir</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> * N);
+01281 }
+01282
+<a name="l01284"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#a9">01284</a> <font class="keywordtype">void</font> CPSEmitterRectangle::setMatrix(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">const</font> CMatrix &amp;m)
+01285 {
+01286 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = m.getPos();
+01287
+01288
+01289 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].X = m.getI();
+01290 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].Y = m.getJ();
+01291 }
+01292
+<a name="l01294"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#a10">01294</a> CMatrix CPSEmitterRectangle::getMatrix(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const</font>
+01295 <font class="keyword"></font>{
+01296 CMatrix m;
+01297 m.setPos(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]);
+01298 m.setRot(<a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].X, <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].Y, <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].X ^ <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].Y, <font class="keyword">true</font>);
+01299 <font class="keywordflow">return</font> m;
+01300 }
+01301
+<a name="l01303"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#a11">01303</a> <font class="keywordtype">void</font> CPSEmitterRectangle::setScale(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keywordtype">float</font> scale)
+01304 {
+01305 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = scale;
+01306 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = scale;
+01307 }
+01308
+<a name="l01310"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#a12">01310</a> <font class="keywordtype">void</font> CPSEmitterRectangle::setScale(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">const</font> CVector &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>)
+01311 {
+01312 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.x;
+01313 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.y;
+01314 }
+01315
+<a name="l01317"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#a13">01317</a> CVector CPSEmitterRectangle::getScale(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const</font>
+01318 <font class="keyword"></font>{
+01319 <font class="keywordflow">return</font> CVector(<a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>], 1.f);
+01320 }
+01321
+<a name="l01323"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#b1">01323</a> <font class="keywordtype">void</font> CPSEmitterRectangle::newElement(CPSLocated *emitterLocated, uint32 emitterIndex)
+01324 {
+01325 CPSEmitter::newElement(emitterLocated, emitterIndex);
+01326 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b1">newEmitteeSpeedElement</a>(emitterLocated, emitterIndex);
+01327 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>.insert(CPlaneBasis(CVector::K));
+01328 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>.insert(1.f);
+01329 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>.insert(1.f);
+01330 }
+01331
+<a name="l01333"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#b2">01333</a> <font class="keywordtype">void</font> CPSEmitterRectangle::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+01334 {
+01335 CPSEmitter::deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01336 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b2">deleteEmitteeSpeedElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01337 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01338 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01339 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01340 }
+01341
+<a name="l01343"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#b3">01343</a> <font class="keywordtype">void</font> CPSEmitterRectangle::resize(uint32 size)
+01344 {
+01345 <a class="code" href="debug_8h.html#a6">nlassert</a>(size &lt; (1 &lt;&lt; 16));
+01346 CPSEmitter::resize(size);
+01347 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b3">resizeEmitteeSpeed</a>(size);
+01348 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>.resize(size);
+01349 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>.resize(size);
+01350 <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>.resize(size);
+01351 }
+01352
+<a name="l01354"></a><a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#a6">01354</a> <font class="keywordtype">void</font> CPSEmitterRectangle::showTool(<font class="keywordtype">void</font>)
+01355 {
+01356 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+01357 <font class="keyword">const</font> uint size = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize();
+01358 <font class="keywordflow">if</font> (!size) <font class="keywordflow">return</font>;
+01359 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a21">setupDriverModelMatrix</a>();
+01360 CMatrix mat;
+01361
+01362 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#l0">CPSLocated</a> *loc;
+01363 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>;
+01364 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#z720_0">CPSLocatedBindable</a> *lb;
+01365 <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);
+01366
+01367 <font class="keywordflow">for</font> (uint k = 0; k &lt; size; ++k)
+01368 {
+01369 <font class="keyword">const</font> CVector &amp;I = <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[k].X;
+01370 <font class="keyword">const</font> CVector &amp;J = <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n0">_Basis</a>[k].Y;
+01371 mat.setRot(I, J , I ^J);
+01372 mat.setPos(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[k]);
+01373 CPSUtil::displayBasis(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a10">getDriver</a>() ,<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a17">getLocatedMat</a>(), mat, 1.f, *<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a11">getFontGenerator</a>(), *<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a13">getFontManager</a>());
+01374 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a21">setupDriverModelMatrix</a>();
+01375
+01376 <font class="keyword">const</font> CRGBA col = ((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));
+01377
+01378
+01379
+01380 <font class="keyword">const</font> CVector &amp;pos = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[k];
+01381 CPSUtil::display3DQuad(*<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a10">getDriver</a>(), pos + I * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>[k] + J * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>[k]
+01382 , pos + I * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>[k] - J * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>[k]
+01383 , pos - I * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>[k] - J * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>[k]
+01384 , pos - I * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n1">_Width</a>[k] + J * <a class="code" href="classNL3D_1_1CPSEmitterRectangle.html#n2">_Height</a>[k], col);
+01385 }
+01386 }
+01387
+01388
+01389
+01391 <font class="comment">// CPSEmitterconic implementation //</font>
+01393 <font class="comment"></font>
+<a name="l01395"></a><a class="code" href="classNL3D_1_1CPSEmitterConic.html#a1">01395</a> <font class="comment">void CPSEmitterConic::serial(NLMISC::IStream &amp;f) throw(NLMISC::EStream)</font>
+01396 {
+01397 f.serialVersion(1);
+01398 CPSEmitterDirectionnal::serial(f);
+01399 f.serial(_Radius);
+01400 }
+01401
+<a name="l01403"></a><a class="code" href="classNL3D_1_1CPSEmitterConic.html#a6">01403</a> <font class="keywordtype">void</font> CPSEmitterConic::setDir(<font class="keyword">const</font> CVector &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>)
+01404 {
+01405 CPSEmitterDirectionnal::setDir(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>);
+01406
+01407 }
+01408
+<a name="l01410"></a><a class="code" href="classNL3D_1_1CPSEmitterConic.html#a3">01410</a> <font class="keywordtype">void</font> CPSEmitterConic::emit(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;srcPos, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, CVector &amp;pos, CVector &amp;speed)
+01411 {
+01412 <font class="comment">// TODO : optimize that</font>
+01413 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>);
+01414
+01415 <font class="comment">// we choose a custom direction like with omnidirectionnal emitter</font>
+01416 <font class="comment">// then we force the direction vect to have the unit size</font>
+01417
+01418 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">double</font> divRand = (2.0 / RAND_MAX);
+01419
+01420 CVector dir((<font class="keywordtype">float</font>) (rand() * divRand - 1)
+01421 , (<font class="keywordtype">float</font>) (rand() * divRand - 1)
+01422 , (<font class="keywordtype">float</font>) (rand() * divRand - 1) );
+01423
+01424 <font class="keyword">const</font> <font class="keywordtype">float</font> n =dir.norm();
+01425
+01426 dir *= <a class="code" href="classNL3D_1_1CPSEmitterConic.html#n0">_Radius</a> / n;
+01427
+01428 dir -= (<a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#n0">_Dir</a> * dir) * <a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#n0">_Dir</a>;
+01429 dir += <a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#n0">_Dir</a>;
+01430 dir.<a class="code" href="classNLMISC_1_1CVector.html#z331_4">normalize</a>();
+01431
+01432
+01433 speed = (<a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n1">_EmitteeSpeedScheme</a> ? <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n1">_EmitteeSpeedScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) : <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n0">_EmitteeSpeed</a>)
+01434 * dir;
+01435 pos = srcPos;
+01436 }
+01437
+01439 <font class="comment">// CPSSphericalEmitter implementation //</font>
+01441 <font class="comment"></font>
+<a name="l01443"></a><a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#a3">01443</a> <font class="comment">void CPSSphericalEmitter::emit(const NLMISC::CVector &amp;srcPos, uint32 index, CVector &amp;pos, CVector &amp;speed)</font>
+01444 {
+01445 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">double</font> divRand = (2.0 / RAND_MAX);
+01446 CVector dir((<font class="keywordtype">float</font>) (rand() * divRand - 1), (<font class="keywordtype">float</font>) (rand() * divRand - 1) , (<font class="keywordtype">float</font>) (rand() * divRand - 1) );
+01447 dir.normalize();
+01448 pos = srcPos + _Radius[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] * dir;
+01449 speed = (_EmitteeSpeedScheme ? _EmitteeSpeedScheme-&gt;get(_Owner, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) : _EmitteeSpeed) * dir;
+01450 }
+01451
+01452
+<a name="l01454"></a><a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#a4">01454</a> <font class="keywordtype">void</font> CPSSphericalEmitter::showTool(<font class="keywordtype">void</font>)
+01455 {
+01456 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#l0">CPSLocated</a> *loc;
+01457 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>;
+01458 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#z720_0">CPSLocatedBindable</a> *lb;
+01459 <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);
+01460
+01461
+01462 TPSAttribFloat::const_iterator radiusIt = <a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#n0">_Radius</a>.begin();
+01463 TPSAttribVector::const_iterator posIt = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().begin(), endPosIt = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().end();
+01464 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a21">setupDriverModelMatrix</a>();
+01465 <font class="keywordflow">for</font> (uint k = 0; posIt != endPosIt; ++posIt, ++radiusIt, ++k)
+01466 {
+01467 <font class="keyword">const</font> CRGBA col = ((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));
+01468 CPSUtil::displaySphere(*<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a10">getDriver</a>(), *radiusIt, *posIt, 5, col);
+01469 }
+01470 }
+01471
+01472
+<a name="l01474"></a><a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#a7">01474</a> <font class="keywordtype">void</font> CPSSphericalEmitter::setMatrix(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <font class="keyword">const</font> CMatrix &amp;m)
+01475 {
+01476 <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_1CPSSphericalEmitter.html#n0">_Radius</a>.getSize());
+01477 <font class="comment">// compute new pos</font>
+01478 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = m.getPos();
+01479
+01480 }
+01481
+<a name="l01483"></a><a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#a8">01483</a> CMatrix CPSSphericalEmitter::getMatrix(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const</font>
+01484 <font class="keyword"></font>{
+01485 <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_1CPSSphericalEmitter.html#n0">_Radius</a>.getSize());
+01486 CMatrix m;
+01487 m.identity();
+01488 m.translate(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]);
+01489 <font class="keywordflow">return</font> m;
+01490 }
+01491
+<a name="l01493"></a><a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#a1">01493</a> <font class="keywordtype">void</font> CPSSphericalEmitter::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+01494 {
+01495 f.serialVersion(1);
+01496 CPSEmitter::serial(f);
+01497 CPSModulatedEmitter::serialEmitteeSpeedScheme(f);
+01498 f.serial(_Radius);
+01499 }
+01500
+<a name="l01502"></a><a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#b1">01502</a> <font class="keywordtype">void</font> CPSSphericalEmitter::newElement(CPSLocated *emitterLocated, uint32 emitterIndex)
+01503 {
+01504 CPSEmitter::newElement(emitterLocated, emitterIndex);
+01505 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b1">newEmitteeSpeedElement</a>(emitterLocated, emitterIndex);
+01506 <a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#n0">_Radius</a>.insert(1.f);
+01507 }
+01508
+<a name="l01510"></a><a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#b2">01510</a> <font class="keywordtype">void</font> CPSSphericalEmitter::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+01511 {
+01512 CPSEmitter::deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01513 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b2">deleteEmitteeSpeedElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01514 <a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#n0">_Radius</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+01515 }
+01516
+<a name="l01518"></a><a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#b3">01518</a> <font class="keywordtype">void</font> CPSSphericalEmitter::resize(uint32 size)
+01519 {
+01520 <a class="code" href="debug_8h.html#a6">nlassert</a>(size &lt; (1 &lt;&lt; 16));
+01521 CPSEmitter::resize(size);
+01522 <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#b3">resizeEmitteeSpeed</a>(size);
+01523 <a class="code" href="classNL3D_1_1CPSSphericalEmitter.html#n0">_Radius</a>.resize(size);
+01524 }
+01525
+01527 <font class="comment">// CPSRadialEmitter implementation //</font>
+01529 <font class="comment"></font>
+<a name="l01531"></a><a class="code" href="classNL3D_1_1CPSRadialEmitter.html#a1">01531</a> <font class="comment">void CPSRadialEmitter::serial(NLMISC::IStream &amp;f) throw(NLMISC::EStream)</font>
+01532 {
+01533 f.serialVersion(1);
+01534 CPSEmitterDirectionnal::serial(f);
+01535 }
+01536
+<a name="l01538"></a><a class="code" href="classNL3D_1_1CPSRadialEmitter.html#a3">01538</a> <font class="keywordtype">void</font> CPSRadialEmitter::emit(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;srcPos, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;pos, <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;speed)
+01539 {
+01540 <font class="comment">// TODO : verifier que ca marche si une particule s'emet elle-mem</font>
+01541 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSEmitter.html#n0">_EmittedType</a>);
+01542
+01543 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">double</font> divRand = (2.0 / RAND_MAX);
+01544 CVector dir((<font class="keywordtype">float</font>) (rand() * divRand - 1)
+01545 , (<font class="keywordtype">float</font>) (rand() * divRand - 1)
+01546 , (<font class="keywordtype">float</font>) (rand() * divRand - 1) );
+01547 dir -= (dir * <a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#n0">_Dir</a>) * <a class="code" href="classNL3D_1_1CPSEmitterDirectionnal.html#n0">_Dir</a>; <font class="comment">//keep tangential direction</font>
+01548 dir.<a class="code" href="classNLMISC_1_1CVector.html#z331_4">normalize</a>();
+01549
+01550 speed = (<a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n1">_EmitteeSpeedScheme</a> ? <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n1">_EmitteeSpeedScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) : <a class="code" href="classNL3D_1_1CPSModulatedEmitter.html#n0">_EmitteeSpeed</a>) * dir;
+01551 pos = srcPos;
+01552 }
+01553
+01554
+01555
+01556 } <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>