1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
<!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::CPSShockWaveHelper 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::CPSShockWaveHelper Class Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
Well, we could have put a method template in <a class="el" href="a03233.html">CPSShockWave</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="a06279.html#l00065">65</a> of file <a class="el" href="a06279.html">ps_shockwave.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> void </td><td class="memItemRight" valign=bottom><a class="el" href="a03234.html#NL3D_1_1CPSShockWaveHelpere0">drawShockWave</a> (T posIt, <a class="el" href="a03233.html">CPSShockWave</a> &<a class="el" href="a04223.html#a626">s</a>, <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_1CPSShockWaveHelpere0" doxytag="NL3D::CPSShockWaveHelper::drawShockWave" ></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> </td>
</tr>
<tr>
<td class="md" nowrap valign="top"> void NL3D::CPSShockWaveHelper::drawShockWave </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><a class="el" href="a03233.html">CPSShockWave</a> & </td>
<td class="mdname" nowrap> <em>s</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="a06279.html#l00069">69</a> of file <a class="el" href="a06279.html">ps_shockwave.cpp</a>.
<p>
References <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="a06710.html#l00438">NL3D::CVertexBuffer::getVertexCoordPointer()</a>, <a class="el" href="a06711.html#l00473">NL3D::CVertexBuffer::getVertexSize()</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_1IDrivera51">NL3D::IDriver::render()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a06197.html#l00180">NL3D::CPrimitiveBlock::setNumQuad()</a>, <a class="el" href="a06279.html#l00044">NL3D::ShockWaveBufSize</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a06259.html#l00048">NL3D::CPlaneBasis::X</a>, and <a class="el" href="a06259.html#l00049">NL3D::CPlaneBasis::Y</a>.
<p>
<div class="fragment"><pre>00070 {
00071 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>;
00072 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a04223.html#a626">s</a>._Owner);
00073
00074 <span class="comment">// get / build the vertex buffer and the primitive block</span>
00075 CVertexBuffer *vb;
00076 CPrimitiveBlock *pb;
00077 <a class="code" href="a04223.html#a626">s</a>.getVBnPB(vb, pb);
00078
00079 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> vSize = vb->getVertexSize();
00080 IDriver *driver = <a class="code" href="a04223.html#a626">s</a>.getDriver();
00081 <a class="code" href="a04223.html#a626">s</a>._Owner->incrementNbDrawnParticles(size); <span class="comment">// for benchmark purpose </span>
00082 <a class="code" href="a04223.html#a626">s</a>.setupDriverModelMatrix();
00083 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> numShockWaveToDealWith = <a class="code" href="a04061.html#a0">std::min</a>(ShockWaveBufSize, <a class="code" href="a04223.html#a626">s</a>.getNumShockWavesInVB());
00084 driver->activeVertexBuffer(*vb);
00085
00086 <span class="keyword">static</span> CPlaneBasis planeBasis[<a class="code" href="a05363.html#a271">ShockWaveBufSize</a>];
00087 <span class="keywordtype">float</span> sizes[<a class="code" href="a05363.html#a271">ShockWaveBufSize</a>];
00088 <span class="keywordtype">float</span> angles[<a class="code" href="a05363.html#a271">ShockWaveBufSize</a>];
00089
00090 <a class="code" href="a04558.html#a15">uint</a> leftToDo = <a class="code" href="a04223.html#a587">size</a>, toProcess;
00091 T endIt;
00092 <a class="code" href="a04558.html#a7">uint8</a> *currVertex;
00093 <a class="code" href="a04558.html#a15">uint</a> k ;
00094
00095 <span class="keyword">const</span> <span class="keywordtype">float</span> angleStep = 256.f / <a class="code" href="a04223.html#a626">s</a>._NbSeg;
00096 <span class="keywordtype">float</span> currAngle;
00097
00098 CPlaneBasis *ptCurrBasis;
00099 <a class="code" href="a04558.html#a11">uint32</a> ptCurrBasisIncrement = <a class="code" href="a04223.html#a626">s</a>._PlaneBasisScheme ? 1 : 0;
00100
00101 <span class="keywordtype">float</span> *ptCurrSize;
00102 <a class="code" href="a04558.html#a11">uint32</a> ptCurrSizeIncrement = <a class="code" href="a04223.html#a626">s</a>._SizeScheme ? 1 : 0;
00103
00104 <span class="keywordtype">float</span> *ptCurrAngle;
00105 <a class="code" href="a04558.html#a11">uint32</a> ptCurrAngleIncrement = <a class="code" href="a04223.html#a626">s</a>._Angle2DScheme ? 1 : 0;
00106
00107 CVector radVect, innerVect;
00108 <span class="keywordtype">float</span> radiusRatio;
00109
00110 <span class="keywordflow">do</span>
00111 {
00112 currVertex = (<a class="code" href="a04558.html#a7">uint8</a> *) vb->getVertexCoordPointer();
00113 toProcess = leftToDo > numShockWaveToDealWith ? numShockWaveToDealWith : leftToDo;
00114 endIt = posIt + toProcess;
00115 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a>._SizeScheme)
00116 {
00117 ptCurrSize = (<span class="keywordtype">float</span> *) (<a class="code" href="a04223.html#a626">s</a>._SizeScheme->make(<a class="code" href="a04223.html#a626">s</a>._Owner, size - leftToDo, (<span class="keywordtype">void</span> *) sizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep));
00118 }
00119 <span class="keywordflow">else</span>
00120 {
00121 ptCurrSize = &<a class="code" href="a04223.html#a626">s</a>._ParticleSize;
00122 }
00123
00124 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a>._PlaneBasisScheme)
00125 {
00126 ptCurrBasis = (CPlaneBasis *) (<a class="code" href="a04223.html#a626">s</a>._PlaneBasisScheme->make(<a class="code" href="a04223.html#a626">s</a>._Owner, size - leftToDo, (<span class="keywordtype">void</span> *) planeBasis, <span class="keyword">sizeof</span>(CPlaneBasis), toProcess, <span class="keyword">true</span>, srcStep));
00127 }
00128 <span class="keywordflow">else</span>
00129 {
00130 ptCurrBasis = &<a class="code" href="a04223.html#a626">s</a>._PlaneBasis;
00131 }
00132
00133 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a>._Angle2DScheme)
00134 {
00135 ptCurrAngle = (<span class="keywordtype">float</span> *) (<a class="code" href="a04223.html#a626">s</a>._Angle2DScheme->make(<a class="code" href="a04223.html#a626">s</a>._Owner, size - leftToDo, (<span class="keywordtype">void</span> *) angles, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep));
00136 }
00137 <span class="keywordflow">else</span>
00138 {
00139 ptCurrAngle = &<a class="code" href="a04223.html#a626">s</a>._Angle2D;
00140 }
00141
00142
00143 <a class="code" href="a04223.html#a626">s</a>.updateVbColNUVForRender(size - leftToDo, toProcess, srcStep, *vb);
00144 <span class="keywordflow">do</span>
00145 {
00146 currAngle = *ptCurrAngle;
00147 <span class="keywordflow">if</span> (fabsf(*ptCurrSize) > 10E-6)
00148 {
00149 radiusRatio = (*ptCurrSize - <a class="code" href="a04223.html#a626">s</a>._RadiusCut) / *ptCurrSize;
00150 }
00151 <span class="keywordflow">else</span>
00152 {
00153 radiusRatio = 0.f;
00154 }
00155
00156 <span class="keywordflow">for</span> (k = 0; k <= <a class="code" href="a04223.html#a626">s</a>._NbSeg; ++k)
00157 {
00158 radVect = *ptCurrSize * (CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) currAngle) * ptCurrBasis->X + CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) currAngle) * ptCurrBasis->Y);
00159 innerVect = radiusRatio * radVect;
00160 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(*vb, currVertex);
00161 * (CVector *) currVertex = *posIt + radVect;
00162 currVertex += vSize;
00163 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(*vb, currVertex);
00164 * (CVector *) currVertex = *posIt + innerVect;
00165 currVertex += vSize;
00166 currAngle += angleStep;
00167 }
00168
00169 ++posIt;
00170 ptCurrBasis += ptCurrBasisIncrement;
00171 ptCurrSize += ptCurrSizeIncrement;
00172 ptCurrAngle += ptCurrAngleIncrement;
00173 }
00174 <span class="keywordflow">while</span> (posIt != endIt);
00175
00176 pb->setNumQuad(toProcess * <a class="code" href="a04223.html#a626">s</a>._NbSeg);
00177 driver->render(*pb, <a class="code" href="a04223.html#a626">s</a>._Mat);
00178 leftToDo -= toProcess;
00179 }
00180 <span class="keywordflow">while</span> (leftToDo);
00181 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>;
00182 }
</pre></div> </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="a06279.html">ps_shockwave.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 07:25:14 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>
|