diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a03195.html | 222 |
1 files changed, 222 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03195.html b/docs/doxygen/nel/a03195.html new file mode 100644 index 00000000..26a89e86 --- /dev/null +++ b/docs/doxygen/nel/a03195.html @@ -0,0 +1,222 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NL3D::CPSFanLightHelper class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NL3D::CPSFanLightHelper Class Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2> +==================================================================================== +<p> +Well, we could have put a method template in <a class="el" href="a03194.html">CPSFanLight</a>, but some compilers want the definition of the methods in the header, and some compilers don't want friend with function template, so we use a static method template of a friend class instead, which gives us the same result :) +<p> + +<p> +Definition at line <a class="el" href="a06235.html#l00068">68</a> of file <a class="el" href="a06235.html">ps_fan_light.cpp</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>template<class T, class U> void </td><td class="memItemRight" valign=bottom><a class="el" href="a03195.html#NL3D_1_1CPSFanLightHelpere0">drawFanLight</a> (T posIt, U timeIt, <a class="el" href="a03194.html">CPSFanLight</a> &f, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>, <a class="el" href="a04558.html#a11">uint32</a> srcStep)</td></tr> + +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NL3D_1_1CPSFanLightHelpere0" doxytag="NL3D::CPSFanLightHelper::drawFanLight" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" colspan="4"> +template<class T, class U> </td> + </tr> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CPSFanLightHelper::drawFanLight </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">T </td> + <td class="mdname" nowrap> <em>posIt</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>U </td> + <td class="mdname" nowrap> <em>timeIt</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03194.html">CPSFanLight</a> & </td> + <td class="mdname" nowrap> <em>f</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>size</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>srcStep</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline, static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06235.html#l00072">72</a> of file <a class="el" href="a06235.html">ps_fan_light.cpp</a>. +<p> +References <a class="el" href="a06258.html#l00367">NL3D::CPSRotated2DParticle::_Angle2D</a>, <a class="el" href="a06258.html#l00368">NL3D::CPSRotated2DParticle::_Angle2DScheme</a>, <a class="el" href="a06258.html#l00228">NL3D::CPSColoredParticle::_ColorScheme</a>, <a class="el" href="a06258.html#l00844">NL3D::CPSMaterial::_Mat</a>, <a class="el" href="a06236.html#l00158">NL3D::CPSFanLight::_MoveIntensity</a>, <a class="el" href="a06236.html#l00156">NL3D::CPSFanLight::_NbFans</a>, <a class="el" href="a06247.html#l01026">NL3D::CPSLocatedBindable::_Owner</a>, <a class="el" href="a06258.html#l00289">NL3D::CPSSizedParticle::_ParticleSize</a>, <a class="el" href="a06236.html#l00157">NL3D::CPSFanLight::_PhaseSmoothness</a>, <a class="el" href="a06236.html#l00160">NL3D::CPSFanLight::_PhaseSpeed</a>, <a class="el" href="a06235.html#l00047">NL3D::CPSFanLight::_RandomPhaseTab</a>, <a class="el" href="a06235.html#l00048">NL3D::CPSFanLight::_RandomPhaseTabInitialized</a>, <a class="el" href="a06258.html#l00290">NL3D::CPSSizedParticle::_SizeScheme</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera2">NL3D::IDriver::activeVertexBuffer()</a>, <a class="el" href="a06249.html#l00039">CHECK_VERTEX_BUFFER</a>, <a class="el" href="a06247.html#l00931">NL3D::CPSLocatedBindable::computeI()</a>, <a class="el" href="a06247.html#l00940">NL3D::CPSLocatedBindable::computeK()</a>, <a class="el" href="a06235.html#l00057">NL3D::FanLightBufSize</a>, <a class="el" href="a06710.html#l00465">NL3D::CVertexBuffer::getColorPointer()</a>, <a class="el" href="a06247.html#l00890">NL3D::CPSLocatedBindable::getDriver()</a>, <a class="el" href="a06235.html#l00536">NL3D::CPSFanLight::getNumFanlightsInVB()</a>, <a class="el" href="a06235.html#l00459">NL3D::CPSFanLight::getVBnIB()</a>, <a class="el" href="a06710.html#l00438">NL3D::CVertexBuffer::getVertexCoordPointer()</a>, <a class="el" href="a06711.html#l00473">NL3D::CVertexBuffer::getVertexSize()</a>, <a class="el" href="a06246.html#l00500">NL3D::CPSLocated::incrementNbDrawnParticles()</a>, <a class="el" href="a03136.html#NL3D_1_1CPSAttribMakerz714_2">NL3D::CPSAttribMaker< float >::make()</a>, <a class="el" href="a03136.html#NL3D_1_1CPSAttribMakerz714_2">NL3D::CPSAttribMaker< CRGBA >::make()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06152.html#l00060">PARTICLES_CHECK_MEM</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera56">NL3D::IDriver::renderTriangles()</a>, <a class="el" href="a06246.html#l02142">NL3D::CPSLocatedBindable::setupDriverModelMatrix()</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05646.html#l00244">stride</a>, <a class="el" href="a06236.html#l00153">NL3D::CPSFanLight::TIndexBuffer</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00073 { +00074 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>; +00075 <a class="code" href="a04199.html#a6">nlassert</a>(f._RandomPhaseTabInitialized); +00076 <span class="comment">//</span> +00077 f.setupDriverModelMatrix(); +00078 <span class="keyword">const</span> CVector I = f.computeI(); +00079 <span class="keyword">const</span> CVector K = f.computeK(); +00080 <span class="comment">// </span> +00081 CVertexBuffer *vb; +00082 CPSFanLight::TIndexBuffer *ib; +00083 <span class="comment">// get (and build if necessary) the vb and the ib</span> +00084 f.getVBnIB(vb, ib); +00085 IDriver *driver = f.getDriver(); +00086 driver->activeVertexBuffer(*vb); +00087 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> maxNumFanLightToDealWith = <a class="code" href="a04061.html#a0">std::min</a>(FanLightBufSize, f.getNumFanlightsInVB()); +00088 <a class="code" href="a04558.html#a7">uint8</a> *randomPhaseTab = &f._RandomPhaseTab[f._PhaseSmoothness][0]; +00089 f._Owner->incrementNbDrawnParticles(size); <span class="comment">// for benchmark purpose </span> +00090 <span class="keywordtype">float</span> pSizes[<a class="code" href="a05363.html#a242">FanLightBufSize</a>]; +00091 <span class="keywordtype">float</span> pAngles[<a class="code" href="a05363.html#a242">FanLightBufSize</a>]; +00092 T endPosIt; +00093 +00094 <a class="code" href="a04558.html#a10">sint32</a> k; <span class="comment">// helps to count the fans</span> +00095 +00096 +00097 <span class="comment">// if so, we need to deal process separatly group of particles </span> +00098 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a582">stride</a> = vb->getVertexSize(); +00099 +00100 <span class="keywordtype">float</span> currentAngle; +00101 <span class="keyword">const</span> <span class="keywordtype">float</span> angleStep = 256.0f / f._NbFans; +00102 +00103 +00104 <span class="keywordtype">float</span> *currentSizePt; <span class="comment">// it points either the particle constant size, or a size in a table</span> +00105 <span class="keywordtype">float</span> *currentAnglePt; <span class="comment">// it points either the particle constant angle, or an angle in a table</span> +00106 +00107 +00108 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> currentSizePtIncrement = f._SizeScheme ? 1 : 0; <span class="comment">// increment to get the next size for the size pointer. It is 0 if the size is constant</span> +00109 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> currentAnglePtIncrement = f._Angle2DScheme ? 1 : 0; <span class="comment">// increment to get the next angle for the angle pointer. It is 0 if the size is constant</span> +00110 +00111 +00112 <a class="code" href="a04558.html#a15">uint</a> leftToDo = <a class="code" href="a04223.html#a587">size</a>; +00113 <span class="keywordflow">do</span> +00114 { +00115 <a class="code" href="a04558.html#a7">uint8</a> *ptVect = (<a class="code" href="a04558.html#a7">uint8</a> *) vb->getVertexCoordPointer(); +00116 <a class="code" href="a04558.html#a15">uint</a> toProcess = <a class="code" href="a04061.html#a0">std::min</a>(leftToDo, maxNumFanLightToDealWith); +00117 <span class="comment">// compute individual colors if needed</span> +00118 <span class="keywordflow">if</span> (f._ColorScheme) +00119 { +00120 <span class="comment">// we change the color at each fan light center</span> +00121 f._ColorScheme->make(f._Owner, size - leftToDo, vb->getColorPointer(), vb->getVertexSize() * (f._NbFans + 2), toProcess, <span class="keyword">false</span>, srcStep); +00122 } +00123 <span class="keywordflow">if</span> (f._SizeScheme) +00124 { +00125 currentSizePt = (<span class="keywordtype">float</span> *) (f._SizeScheme->make(f._Owner, size - leftToDo, pSizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep)); +00126 currentSizePt = pSizes; +00127 } +00128 <span class="keywordflow">else</span> +00129 { +00130 currentSizePt = &f._ParticleSize; +00131 } +00132 <span class="keywordflow">if</span> (f._Angle2DScheme) +00133 { +00134 currentAnglePt = (<span class="keywordtype">float</span> *) (f._Angle2DScheme->make(f._Owner, size - leftToDo, pAngles, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep)); +00135 } +00136 <span class="keywordflow">else</span> +00137 { +00138 currentAnglePt = &f._Angle2D; +00139 } +00140 <span class="comment">// </span> +00141 <span class="keywordtype">float</span> fSize, firstSize, sizeStepBase=0.0, sizeStep; +00142 <span class="keywordflow">if</span> (f._PhaseSmoothness) +00143 { +00144 sizeStepBase = 1.f / f._PhaseSmoothness; +00145 } +00146 endPosIt = posIt + toProcess; +00147 <span class="keywordflow">for</span> (;posIt != endPosIt; ++posIt, ++timeIt) +00148 { +00149 +00150 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(*vb, ptVect); +00151 *(CVector *) ptVect = *posIt; +00152 <span class="comment">// the start angle</span> +00153 currentAngle = *currentAnglePt; +00154 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> phaseAdd = (<a class="code" href="a04558.html#a7">uint8</a>) (f._PhaseSpeed * (*timeIt)); +00155 ptVect += <a class="code" href="a04223.html#a582">stride</a>; +00156 <span class="keyword">const</span> <span class="keywordtype">float</span> fanSize = *currentSizePt * 0.5f; +00157 <span class="keyword">const</span> <span class="keywordtype">float</span> moveIntensity = f._MoveIntensity * fanSize; +00158 <span class="comment">// compute radius & vect for first fan</span> +00159 firstSize = fanSize + (moveIntensity * CPSUtil::getCos(randomPhaseTab[0] + phaseAdd)); +00160 *(CVector *) ptVect = (*posIt) + I * firstSize * (CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) currentAngle)) +00161 + K * firstSize * (CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) currentAngle)); +00162 currentAngle += angleStep; +00163 ptVect += <a class="code" href="a04223.html#a582">stride</a>; +00164 fSize = firstSize; +00165 <span class="comment">// computes other fans</span> +00166 <span class="keyword">const</span> <a class="code" href="a04558.html#a10">sint32</a> upperBound = (<a class="code" href="a04558.html#a10">sint32</a>) (f._NbFans - f._PhaseSmoothness - 1); +00167 <span class="keywordflow">for</span> (k = 1; k <= upperBound; ++k) +00168 { +00169 fSize = fanSize + (moveIntensity * CPSUtil::getCos(randomPhaseTab[k] + phaseAdd)); +00170 *(CVector *) ptVect = (*posIt) + I * fSize * (CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) currentAngle)) +00171 + K * fSize * (CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) currentAngle)); +00172 currentAngle += angleStep; +00173 ptVect += <a class="code" href="a04223.html#a582">stride</a>; +00174 } +00175 +00176 <span class="comment">// interpolate radius, so that the fanlight loops correctly</span> +00177 sizeStep = sizeStepBase * (firstSize - fSize); +00178 <span class="keywordflow">for</span> (; k <= (<a class="code" href="a04558.html#a10">sint32</a>) (f._NbFans - 1); ++k) +00179 { +00180 *(CVector *) ptVect = (*posIt) + I * fSize * (CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) currentAngle)) +00181 + K * fSize * (CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) currentAngle)); +00182 currentAngle += angleStep; +00183 ptVect += <a class="code" href="a04223.html#a582">stride</a>; +00184 fSize += sizeStep; +00185 } +00186 <span class="comment">// last fan</span> +00187 *(CVector *) ptVect = (*posIt) + I * firstSize * (CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) *currentAnglePt)) +00188 + K * firstSize * (CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) *currentAnglePt)); +00189 ptVect += <a class="code" href="a04223.html#a582">stride</a>; +00190 currentSizePt += currentSizePtIncrement; +00191 currentAnglePt += currentAnglePtIncrement; +00192 } +00193 driver->renderTriangles(f._Mat, &((*ib)[0]), toProcess * f._NbFans); +00194 leftToDo -= toProcess; +00195 } +00196 <span class="keywordflow">while</span> (leftToDo != 0); +00197 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>; +00198 } +</pre></div> </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following file:<ul> +<li><a class="el" href="a06235.html">ps_fan_light.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 07:13:02 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |