aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/ps__fan__light_8cpp-source.html
blob: dee2f6afd6039e608f4a077562b859ee3bb995b5 (plain)
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
<!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="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><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="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/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="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/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="/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:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>ps_fan_light.cpp</h1><a href="ps__fan__light_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
00027 
00028 <font class="preprocessor">#include "<a class="code" href="ps__fan__light_8h.html">3d/ps_fan_light.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="ps__macro_8h.html">3d/ps_macro.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="ps__attrib__maker_8h.html">3d/ps_attrib_maker.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="ps__iterator_8h.html">3d/ps_iterator.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="particle__system_8h.html">3d/particle_system.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="driver_8h.html">3d/driver.h</a>"</font>
00034 
00035 
00036 
00037 <font class="keyword">namespace </font>NL3D 
00038 {
00039 
00040 
00041 
00043 <font class="comment">// fan light implementation //</font>
00045 <font class="comment"></font>
00046 
<a name="l00047"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#r0">00047</a> uint8 CPSFanLight::_RandomPhaseTab[32][128];
<a name="l00048"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#r6">00048</a> <font class="keywordtype">bool</font> CPSFanLight::_RandomPhaseTabInitialized = <font class="keyword">false</font>;
00049 
<a name="l00050"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#r1">00050</a> CPSFanLight::TVBMap                             CPSFanLight::_VBMap; <font class="comment">// fanlight, no texture</font>
<a name="l00051"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#r2">00051</a> CPSFanLight::TVBMap                             CPSFanLight::_TexVBMap; <font class="comment">// fanlight, textured</font>
<a name="l00052"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#r3">00052</a> CPSFanLight::TVBMap                             CPSFanLight::_ColoredVBMap; <font class="comment">// fanlight, no texture, varying color</font>
<a name="l00053"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#r4">00053</a> CPSFanLight::TVBMap                             CPSFanLight::_ColoredTexVBMap; <font class="comment">// fanlight, textured, varying color</font>
<a name="l00054"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#r5">00054</a> CPSFanLight::TIBMap                             CPSFanLight::_IBMap;
00055 
00056 
00057 <font class="keyword">static</font> <font class="keyword">const</font> uint <a class="code" href="namespaceNL3D.html#a190">FanLightBufSize</a>  = 128; <font class="comment">// the size of a buffer of particle to deal with at a time</font>
00058 <font class="keyword">static</font> <font class="keyword">const</font> uint NumVertsInBuffer = 4 * <a class="code" href="namespaceNL3D.html#a190">FanLightBufSize</a>;
00059 
00060 
00062 
<a name="l00068"></a><a class="code" href="classNL3D_1_1CPSFanLightHelper.html">00068</a> <font class="keyword">class </font>CPSFanLightHelper
00069 {
00070 <font class="keyword">public</font>:
00071         <font class="keyword">template</font> &lt;<font class="keyword">class</font> T, <font class="keyword">class</font> U&gt;     
<a name="l00072"></a><a class="code" href="classNL3D_1_1CPSFanLightHelper.html#d0">00072</a>         <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSFanLightHelper.html#d0">drawFanLight</a>(T posIt, U timeIt, CPSFanLight &amp;f, uint size, uint32 srcStep)
00073         {
00074                 PARTICLES_CHECK_MEM;
00075                 <a class="code" href="debug_8h.html#a6">nlassert</a>(f._RandomPhaseTabInitialized);
00076                 <font class="comment">//</font>
00077                 f.setupDriverModelMatrix();
00078                 <font class="keyword">const</font> CVector I = f.computeI();
00079                 <font class="keyword">const</font> CVector K = f.computeK();         
00080                 <font class="comment">//              </font>
00081                 CVertexBuffer *vb;
00082                 CPSFanLight::TIndexBuffer  *ib;
00083                 <font class="comment">// get (and build if necessary) the vb and the ib</font>
00084                 f.getVBnIB(vb, ib);
00085                 IDriver *driver = f.getDriver();
00086                 driver-&gt;activeVertexBuffer(*vb);
00087                 <font class="keyword">const</font> uint maxNumFanLightToDealWith = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(<a class="code" href="namespaceNL3D.html#a190">FanLightBufSize</a>, f.getNumFanlightsInVB());       
00088                 uint8 *randomPhaseTab = &amp;f._RandomPhaseTab[f._PhaseSmoothness][0];
00089                 f._Owner-&gt;incrementNbDrawnParticles(size); <font class="comment">// for benchmark purpose                     </font>
00090                 <font class="keywordtype">float</font> pSizes[<a class="code" href="namespaceNL3D.html#a190">FanLightBufSize</a>];
00091                 <font class="keywordtype">float</font> pAngles[<a class="code" href="namespaceNL3D.html#a190">FanLightBufSize</a>];
00092                 T endPosIt;             
00093 
00094                 sint32 k; <font class="comment">// helps to count the fans</font>
00095 
00096                 
00097                  <font class="comment">// if so, we need to deal process separatly group of particles                 </font>
00098                 <font class="keyword">const</font> uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a> = vb-&gt;getVertexSize();
00099 
00100                 <font class="keywordtype">float</font> currentAngle;
00101                 <font class="keyword">const</font> <font class="keywordtype">float</font> angleStep = 256.0f / f._NbFans;     
00102 
00103                 
00104                 <font class="keywordtype">float</font> *currentSizePt; <font class="comment">// it points either the particle constant size, or a size in a table</font>
00105                 <font class="keywordtype">float</font> *currentAnglePt; <font class="comment">// it points either the particle constant angle, or an angle in a table</font>
00106 
00107                 
00108                 <font class="keyword">const</font> uint32 currentSizePtIncrement = f._SizeScheme ? 1 : 0; <font class="comment">// increment to get the next size for the size pointer. It is 0 if the size is constant</font>
00109                 <font class="keyword">const</font> uint32 currentAnglePtIncrement = f._Angle2DScheme ? 1 : 0; <font class="comment">// increment to get the next angle for the angle pointer. It is 0 if the size is constant</font>
00110                                 
00111 
00112                 uint leftToDo = size;
00113                 <font class="keywordflow">do</font>
00114                 {                               
00115                         uint8 *ptVect = (uint8 *) vb-&gt;getVertexCoordPointer();
00116                         uint toProcess = <a class="code" href="bit__set_8cpp.html#a0">std::min</a>(leftToDo, maxNumFanLightToDealWith);                                                  
00117                         <font class="comment">// compute individual colors if needed</font>
00118                         <font class="keywordflow">if</font> (f._ColorScheme)
00119                         {
00120                                 <font class="comment">// we change the color at each fan light center</font>
00121                                 f._ColorScheme-&gt;make(f._Owner, size - leftToDo, vb-&gt;getColorPointer(), vb-&gt;getVertexSize() * (f._NbFans + 2), toProcess, <font class="keyword">false</font>, srcStep);
00122                         }
00123                         <font class="keywordflow">if</font> (f._SizeScheme)
00124                         {
00125                                 currentSizePt  = (<font class="keywordtype">float</font> *) (f._SizeScheme-&gt;make(f._Owner, size - leftToDo, pSizes, <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>, srcStep));
00126                                 currentSizePt = pSizes;
00127                         }
00128                         <font class="keywordflow">else</font>
00129                         {
00130                                 currentSizePt = &amp;f._ParticleSize;
00131                         }
00132                         <font class="keywordflow">if</font> (f._Angle2DScheme)
00133                         {
00134                                 currentAnglePt = (<font class="keywordtype">float</font> *) (f._Angle2DScheme-&gt;make(f._Owner, size - leftToDo, pAngles, <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>, srcStep));                                       
00135                         }
00136                         <font class="keywordflow">else</font>
00137                         {
00138                                 currentAnglePt = &amp;f._Angle2D;
00139                         }                       
00140                         <font class="comment">//                                                              </font>
00141                         <font class="keywordtype">float</font> fSize, firstSize, sizeStepBase=0.0, sizeStep;
00142                         <font class="keywordflow">if</font> (f._PhaseSmoothness)
00143                         {
00144                                 sizeStepBase = 1.f / f._PhaseSmoothness;
00145                         }
00146                         endPosIt = posIt + toProcess;
00147                         <font class="keywordflow">for</font> (;posIt != endPosIt; ++posIt, ++timeIt)
00148                         {       
00149                                 
00150                                 <a class="code" href="ps__macro_8h.html#a0">CHECK_VERTEX_BUFFER</a>(*vb, ptVect);
00151                                 *(CVector *) ptVect = *posIt;                           
00152                                 <font class="comment">// the start angle</font>
00153                                 currentAngle = *currentAnglePt;
00154                                 <font class="keyword">const</font> uint8 phaseAdd = (uint8) (f._PhaseSpeed * (*timeIt));
00155                                 ptVect += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00156                                 <font class="keyword">const</font> <font class="keywordtype">float</font> fanSize = *currentSizePt * 0.5f;
00157                                 <font class="keyword">const</font> <font class="keywordtype">float</font> moveIntensity = f._MoveIntensity * fanSize;                         
00158                                 <font class="comment">// compute radius &amp; vect for first fan</font>
00159                                 firstSize  = fanSize + (moveIntensity * CPSUtil::getCos(randomPhaseTab[0] + phaseAdd));
00160                                 *(CVector *) ptVect = (*posIt) + I * firstSize * (CPSUtil::getCos((sint32) currentAngle))
00161                                                                           + K * firstSize * (CPSUtil::getSin((sint32) currentAngle));
00162                                 currentAngle += angleStep;
00163                                 ptVect += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00164                                 fSize = firstSize;
00165                                 <font class="comment">// computes other fans</font>
00166                                 <font class="keyword">const</font> sint32 upperBound = (sint32) (f._NbFans - f._PhaseSmoothness - 1);
00167                                 <font class="keywordflow">for</font> (k = 1; k &lt;= upperBound; ++k)
00168                                 {
00169                                         fSize  = fanSize + (moveIntensity * CPSUtil::getCos(randomPhaseTab[k] + phaseAdd));
00170                                         *(CVector *) ptVect = (*posIt) + I * fSize * (CPSUtil::getCos((sint32) currentAngle))
00171                                                                                   + K * fSize * (CPSUtil::getSin((sint32) currentAngle));
00172                                         currentAngle += angleStep;
00173                                         ptVect += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00174                                 }
00175 
00176                                 <font class="comment">// interpolate radius, so that the fanlight loops correctly</font>
00177                                 sizeStep = sizeStepBase * (firstSize - fSize);
00178                                 <font class="keywordflow">for</font> (; k &lt;= (sint32) (f._NbFans - 1); ++k)
00179                                 {                               
00180                                         *(CVector *) ptVect = (*posIt) + I * fSize * (CPSUtil::getCos((sint32) currentAngle))
00181                                                                                   + K * fSize * (CPSUtil::getSin((sint32) currentAngle));
00182                                         currentAngle += angleStep;
00183                                         ptVect += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00184                                         fSize  += sizeStep;
00185                                 }
00186                                 <font class="comment">// last fan</font>
00187                                 *(CVector *) ptVect = (*posIt) + I * firstSize * (CPSUtil::getCos((sint32) *currentAnglePt))
00188                                                                                   + K * firstSize * (CPSUtil::getSin((sint32) *currentAnglePt));
00189                                 ptVect += <a class="code" href="driver__opengl__extension__def_8h.html#a374">stride</a>;
00190                                 currentSizePt += currentSizePtIncrement;
00191                                 currentAnglePt += currentAnglePtIncrement;
00192                         }                       
00193                         driver-&gt;renderTriangles(f._Mat, &amp;((*ib)[0]), toProcess * f._NbFans);
00194                         leftToDo -= toProcess;
00195                 }               
00196                 <font class="keywordflow">while</font> (leftToDo != 0);
00197                 PARTICLES_CHECK_MEM;
00198         }
00199 };
00200 
00201         
00203 <font class="comment">// this blur a tab of bytes once</font>
00204 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a422">BlurBytesTab</a>(<font class="keyword">const</font> uint8 *<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>, uint8 *dest, uint size)
00205 {
00206         std::vector&lt;uint8&gt; b(<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a> + size);
00207         <font class="keywordflow">for</font> (sint k = 1 ; k &lt; (sint) (size - 1); ++k)
00208         {
00209                 dest[k] = (uint8) (((uint16) b[k - 1] + (uint16) b[k + 1])&gt;&gt;1);
00210         }
00211 }
00212 
<a name="l00214"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#d0">00214</a> <font class="keywordtype">void</font> CPSFanLight::initFanLightPrecalc(<font class="keywordtype">void</font>)
00215 {
00216         <font class="comment">// build several random tab, and linearly interpolate between l values</font>
00217         <font class="keywordtype">float</font> currPhase, nextPhase, phaseStep;
00218         <font class="keywordflow">for</font> (uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; 32 ; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>++)
00219         {
00220                 nextPhase = (float) (uint8) (rand()&amp;0xFF);
00221                 uint32 k = 0;
00222                 <font class="keywordflow">while</font> (k &lt; 128)
00223                 {
00224                         currPhase = nextPhase;
00225                         nextPhase = (float) (uint8) (rand()&amp;0xFF);
00226                         phaseStep = (nextPhase - currPhase) / (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + 1);
00227 
00228                         <font class="keywordflow">for</font> (uint32 m = 0; m &lt;= <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>; ++m)
00229                         {
00230                                 <a class="code" href="classNL3D_1_1CPSFanLight.html#r0">_RandomPhaseTab</a>[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>][k] = (uint8) currPhase;
00231                                 currPhase += phaseStep;
00232                                 ++k;
00233                                 <font class="keywordflow">if</font> (k &gt;= 128) <font class="keywordflow">break</font>;
00234                         }
00235                 }
00236                 <font class="keywordflow">for</font> (uint m = 0; m &lt; 2 * <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>; ++m)
00237                         <a class="code" href="namespaceNL3D.html#a422">BlurBytesTab</a>(&amp;<a class="code" href="classNL3D_1_1CPSFanLight.html#r0">_RandomPhaseTab</a>[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>][0], &amp;<a class="code" href="classNL3D_1_1CPSFanLight.html#r0">_RandomPhaseTab</a>[<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>][0], 128);
00238         }       
00239         <font class="comment">//#ifdef NL_DEBUG</font>
00240                 <a class="code" href="classNL3D_1_1CPSFanLight.html#r6">_RandomPhaseTabInitialized</a> = <font class="keyword">true</font>;
00241         <font class="comment">//#endif</font>
00242 }
00243 
<a name="l00245"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#a13">00245</a> uint32 CPSFanLight::getMaxNumFaces(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
00246 <font class="keyword"></font>{
00247         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
00248         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getMaxSize() * <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>;
00249 }
00250 
<a name="l00252"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#a11">00252</a> <font class="keywordtype">bool</font> CPSFanLight::hasTransparentFaces(<font class="keywordtype">void</font>)
00253 {
00254         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSMaterial.html#a3">getBlendingMode</a>() != CPSMaterial::alphaTest ;
00255 }
00256 
<a name="l00258"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#a12">00258</a> <font class="keywordtype">bool</font> CPSFanLight::hasOpaqueFaces(<font class="keywordtype">void</font>)
00259 {
00260         <font class="keywordflow">return</font> !<a class="code" href="classNL3D_1_1CPSFanLight.html#a11">hasTransparentFaces</a>();
00261 }
00262 
<a name="l00264"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#b0">00264</a> <font class="keywordtype">void</font> CPSFanLight::newElement(CPSLocated *emitterLocated, uint32 emitterIndex)
00265 {
00266         <a class="code" href="classNL3D_1_1CPSColoredParticle.html#b2">newColorElement</a>(emitterLocated, emitterIndex);
00267         <a class="code" href="classNL3D_1_1CPSSizedParticle.html#b1">newSizeElement</a>(emitterLocated, emitterIndex);
00268         <a class="code" href="classNL3D_1_1CPSRotated2DParticle.html#b1">newAngle2DElement</a>(emitterLocated, emitterIndex);
00269 }
00270 
<a name="l00272"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#b1">00272</a> <font class="keywordtype">void</font> CPSFanLight::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
00273 {
00274         <a class="code" href="classNL3D_1_1CPSColoredParticle.html#b3">deleteColorElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00275         <a class="code" href="classNL3D_1_1CPSSizedParticle.html#b2">deleteSizeElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00276         <a class="code" href="classNL3D_1_1CPSRotated2DParticle.html#b2">deleteAngle2DElement</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
00277 }
00278 
<a name="l00280"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#a8">00280</a> <font class="keywordtype">void</font> CPSFanLight::setPhaseSpeed(<font class="keywordtype">float</font> multiplier)
00281 {
00282         <a class="code" href="classNL3D_1_1CPSFanLight.html#o4">_PhaseSpeed</a> = 256.0f * multiplier;
00283 }
00284 
<a name="l00286"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#c4">00286</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> CPSFanLight::setupMaterial()
00287 {
00288         CParticleSystem &amp;ps = *(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner());
00289         <font class="keywordtype">bool</font> useGlobalColor = (ps.getColorAttenuationScheme() != NULL);
00290         <font class="keywordflow">if</font> (useGlobalColor != <a class="code" href="classNL3D_1_1CPSFanLight.html#o6">_UseGlobalColor</a>)
00291         {
00292                 <a class="code" href="classNL3D_1_1CPSFanLight.html#c5">touch</a>();
00293                 <a class="code" href="classNL3D_1_1CPSFanLight.html#o6">_UseGlobalColor</a> = useGlobalColor;
00294         }
00295         <font class="keywordflow">if</font> (_Touched)
00296         {               
00298                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSFanLight.html#o3">_Tex</a> == NULL)
00299                 {                               
00300                         <a class="code" href="classNL3D_1_1CPSMaterial.html#a5">forceTexturedMaterialStages</a>(1);
00301                         <a class="code" href="namespaceNL3D.html#a439">SetupModulatedStage</a>(<a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>, 0, CMaterial::Diffuse, CMaterial::Constant);
00302                 }
00303                 <font class="keywordflow">else</font>
00304                 {
00305                         <a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>.setTexture(0, <a class="code" href="classNL3D_1_1CPSFanLight.html#o3">_Tex</a>);
00306                         <a class="code" href="classNL3D_1_1CPSMaterial.html#a5">forceTexturedMaterialStages</a>(2);                         
00307                         <a class="code" href="namespaceNL3D.html#a439">SetupModulatedStage</a>(<a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>, 0, CMaterial::Texture, CMaterial::Constant);
00308                         <a class="code" href="namespaceNL3D.html#a439">SetupModulatedStage</a>(<a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>, 1, CMaterial::Diffuse, CMaterial::Previous);          
00309                 }
00310 
00311                 <font class="keywordflow">if</font> (!useGlobalColor)
00312                 {
00313                         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSColoredParticle.html#n1">_ColorScheme</a>)
00314                         {
00315                                 <a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>.texConstantColor(0, <a class="code" href="classNL3D_1_1CPSColoredParticle.html#n0">_Color</a>);
00316                         }
00317                         <font class="keywordflow">else</font>
00318                         {
00319                                 <a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>.texConstantColor(0, <a class="code" href="classNLMISC_1_1CRGBA.html#p7">NLMISC::CRGBA::White</a>);
00320                         }
00321                 }
00322                 <a class="code" href="classNL3D_1_1CPSFanLight.html#o5">_Touched</a> = <font class="keyword">false</font>;
00323         }       
00324 
00325         <font class="comment">// always setup global colors </font>
00326         <font class="keywordflow">if</font> (useGlobalColor)
00327         {                               
00328                 <font class="keywordflow">if</font> (_ColorScheme)
00329                 {
00330                         <a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>.texConstantColor(0, ps.getGlobalColor());
00331                 }
00332                 <font class="keywordflow">else</font>
00333                 {
00334                         <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> col;
00335                         col.<a class="code" href="classNLMISC_1_1CRGBA.html#a9">modulateFromColor</a>(ps.getGlobalColor(), <a class="code" href="classNL3D_1_1CPSColoredParticle.html#n0">_Color</a>);
00336                         <a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>.texConstantColor(0, col);
00337                 }
00338         }
00339 }
00340 
<a name="l00342"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#c1">00342</a> <font class="keywordtype">void</font> CPSFanLight::draw(<font class="keywordtype">bool</font> opaque)
00343 {
00344         PARTICLES_CHECK_MEM;    
00345         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize()) <font class="keywordflow">return</font>; 
00346 
00347         uint32 <a class="code" href="classNL3D_1_1CPSParticle.html#a4">step</a>;
00348         uint   numToProcess;
00349         <a class="code" href="classNL3D_1_1CPSParticle.html#b4">computeSrcStep</a>(<a class="code" href="classNL3D_1_1CPSParticle.html#a4">step</a>, numToProcess);     
00350         <font class="keywordflow">if</font> (!numToProcess) <font class="keywordflow">return</font>;
00351         
00352         <a class="code" href="classNL3D_1_1CPSFanLight.html#c4">setupMaterial</a>();        
00353         
00354         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSParticle.html#a4">step</a> == (1 &lt;&lt; 16))
00355         {
00356                 CPSFanLightHelper::drawFanLight(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().begin(),
00357                                                                             <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getTime().begin(),
00358                                                                            *<font class="keyword">this</font>,
00359                                                                                 numToProcess,
00360                                                                                 <a class="code" href="classNL3D_1_1CPSParticle.html#a4">step</a>
00361                                                                            );
00362         }
00363         <font class="keywordflow">else</font>
00364         {               
00365                 CPSFanLightHelper::drawFanLight(<a class="code" href="namespaceNL3D.html#a199">TIteratorVectStep1616</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().begin(), 0, <a class="code" href="classNL3D_1_1CPSParticle.html#a4">step</a>),
00366                                                                                 <a class="code" href="namespaceNL3D.html#a198">TIteratorTimeStep1616</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getTime().begin(), 0, <a class="code" href="classNL3D_1_1CPSParticle.html#a4">step</a>),
00367                                                                             *<font class="keyword">this</font>,
00368                                                                             numToProcess,
00369                                                                             <a class="code" href="classNL3D_1_1CPSParticle.html#a4">step</a>                                
00370                                                                            );
00371         }
00372         
00373         PARTICLES_CHECK_MEM;
00374 }
00375 
<a name="l00377"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#z718_2">00377</a> <font class="keywordtype">void</font> CPSFanLight::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
00378 {
00379         sint ver = f.serialVersion(2);
00380         CPSParticle::serial(f);
00381         CPSColoredParticle::serialColorScheme(f);       
00382         CPSSizedParticle::serialSizeScheme(f);  
00383         CPSRotated2DParticle::serialAngle2DScheme(f);
00384         f.serial(_NbFans);
00385         serialMaterial(f);
00386         <font class="keywordflow">if</font> (ver &gt; 1)
00387         {
00388                 f.serial(_PhaseSmoothness, _MoveIntensity);
00389                 ITexture *tex = _Tex;
00390                 f.serialPolyPtr(tex);
00391                 <font class="keywordflow">if</font> (f.isReading()) _Tex = tex ;
00392         }
00393         <font class="keywordflow">if</font> (f.isReading())
00394         {
00395                 init();         
00396         }       
00397 }
00398 
<a name="l00400"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#a1">00400</a> <font class="keywordtype">bool</font> CPSFanLight::completeBBox(<a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> &amp;box)<font class="keyword"> const</font>
00401 <font class="keyword"></font>{
00402         <font class="comment">// TODO</font>
00403 
00404         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00405 }
00406 
<a name="l00408"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#z718_0">00408</a> CPSFanLight::CPSFanLight(uint32 nbFans) : _NbFans(nbFans),
00409                                                                                   _PhaseSmoothness(0),
00410                                                                                   _MoveIntensity(1.5f),
00411                                                                                   _Tex(NULL),
00412                                                                                   _PhaseSpeed(256),
00413                                                                                   _Touched(true),
00414                                                                                   _UseGlobalColor(false)
00415 
00416 {
00417         <a class="code" href="debug_8h.html#a6">nlassert</a>(nbFans &gt;= 3);
00418 
00419 
00420         <a class="code" href="classNL3D_1_1CPSFanLight.html#c0">init</a>();
00421         <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n3">_Name</a> = std::string(<font class="stringliteral">"FanLight"</font>);
00422 }
00423 
00424 
<a name="l00426"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#z718_1">00426</a> CPSFanLight::~CPSFanLight()
00427 {
00428 }
00429 
00430 
<a name="l00432"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#a2">00432</a> <font class="keywordtype">void</font> CPSFanLight::setNbFans(uint32 nbFans)
00433 {
00434         <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a> = nbFans;
00435 
00436         <a class="code" href="classNL3D_1_1CPSFanLight.html#b2">resize</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getMaxSize());
00437 
00438         <a class="code" href="classNL3D_1_1CPSParticle.html#b0">notifyOwnerMaxNumFacesChanged</a>();
00439 }
00440 
<a name="l00442"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#b2">00442</a> <font class="keywordtype">void</font> CPSFanLight::resize(uint32 size)
00443 {       
00444         <a class="code" href="debug_8h.html#a6">nlassert</a>(size &lt; (1 &lt;&lt; 16));
00445         <a class="code" href="classNL3D_1_1CPSColoredParticle.html#b4">resizeColor</a>(size);
00446         <a class="code" href="classNL3D_1_1CPSRotated2DParticle.html#b3">resizeAngle2D</a>(size);
00447         <a class="code" href="classNL3D_1_1CPSSizedParticle.html#b3">resizeSize</a>(size);
00448         
00449 }
00450 
<a name="l00452"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#c0">00452</a> <font class="keywordtype">void</font> CPSFanLight::init(<font class="keywordtype">void</font>)
00453 {
00454         <a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>.setLighting(<font class="keyword">false</font>);        
00455         <a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>.setZFunc(CMaterial::less);
00456         <a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>.setDoubleSided(<font class="keyword">true</font>);
00457         <a class="code" href="classNL3D_1_1CPSMaterial.html#n0">_Mat</a>.setColor(<a class="code" href="classNLMISC_1_1CRGBA.html#p7">NLMISC::CRGBA::White</a>);
00458 
00459         <a class="code" href="classNL3D_1_1CPSFanLight.html#a10">updateMatAndVbForColor</a>();
00460 }
00461 
<a name="l00463"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#a10">00463</a> <font class="keywordtype">void</font> CPSFanLight::updateMatAndVbForColor(<font class="keywordtype">void</font>)
00464 {       
00465         <a class="code" href="classNL3D_1_1CPSFanLight.html#c5">touch</a>();
00466 }
00467 
<a name="l00469"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#c2">00469</a> <font class="keywordtype">void</font> CPSFanLight::getVBnIB(CVertexBuffer *&amp;retVb, CPSFanLight::TIndexBuffer *&amp;retIb)
00470 {
00471         <a class="code" href="classNL3D_1_1CPSFanLight.html#u0">TVBMap</a> &amp;vbMap = <a class="code" href="classNL3D_1_1CPSColoredParticle.html#n1">_ColorScheme</a> ? (<a class="code" href="classNL3D_1_1CPSFanLight.html#o3">_Tex</a> == NULL  ? <a class="code" href="classNL3D_1_1CPSFanLight.html#r3">_ColoredVBMap</a> : <a class="code" href="classNL3D_1_1CPSFanLight.html#r4">_ColoredTexVBMap</a>)
00472                                                                  : (<a class="code" href="classNL3D_1_1CPSFanLight.html#o3">_Tex</a> == NULL  ? <a class="code" href="classNL3D_1_1CPSFanLight.html#r1">_VBMap</a> : <a class="code" href="classNL3D_1_1CPSFanLight.html#r2">_TexVBMap</a>);
00473         TVBMap::iterator vbIt = vbMap.find(<a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>);
00474         <font class="keywordflow">if</font> (vbIt != vbMap.end())
00475         {
00476                 retVb = &amp;(vbIt-&gt;second);
00477                 TIBMap::iterator pbIt = <a class="code" href="classNL3D_1_1CPSFanLight.html#r5">_IBMap</a>.find(<a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>);
00478                 <a class="code" href="debug_8h.html#a6">nlassert</a>(pbIt != <a class="code" href="classNL3D_1_1CPSFanLight.html#r5">_IBMap</a>.end());
00479                 retIb = &amp;(pbIt-&gt;second);
00480         }
00481         <font class="keywordflow">else</font> <font class="comment">// we need to create the vb</font>
00482         {               
00483                 <font class="comment">// create an entry (we setup the primitive block at the same time, this could be avoided, but doesn't make much difference)             </font>
00484                 CVertexBuffer &amp;vb = vbMap[<a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>]; <font class="comment">// create a vb</font>
00485                 <a class="code" href="classNL3D_1_1CPSFanLight.html#u1">TIndexBuffer</a> &amp;ib = <a class="code" href="classNL3D_1_1CPSFanLight.html#r5">_IBMap</a>[<a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>]; <font class="comment">// eventually create a pb</font>
00486                 <font class="keyword">const</font> uint32 size = <a class="code" href="classNL3D_1_1CPSFanLight.html#c3">getNumFanlightsInVB</a>();
00487                 vb.setVertexFormat(CVertexBuffer::PositionFlag |
00488                                                    CVertexBuffer::PrimaryColorFlag |
00489                                                    (<a class="code" href="classNL3D_1_1CPSFanLight.html#o3">_Tex</a> != NULL ?  CVertexBuffer::TexCoord0Flag : 0) 
00490                                                   );
00491                 vb.setNumVertices(size * (2 + <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>));                        
00492                 ib.resize(size * <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a> * 3);          
00493                 <font class="comment">// pointer on the current index to fill</font>
00494                 TIndexBuffer::iterator ptIndex = ib.begin();    
00495                 
00496                 <font class="comment">// index of the first vertex of the current fanFilght</font>
00497                 uint currVertFan = 0;
00498 
00499                 uint <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>; <font class="comment">// the current fan in the current fanlight</font>
00500                 uint k; <font class="comment">// the current fan light</font>
00501 
00502                 <font class="keywordflow">for</font> (k = 0; k &lt; size; ++k)
00503                 {
00504                         <font class="keywordflow">for</font> (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00505                         {
00506                                 *ptIndex++ = currVertFan;
00507                                 *ptIndex++ = currVertFan + (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + 1);
00508                                 *ptIndex++ = currVertFan + (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + 2);
00509                         }                                       
00510                         currVertFan += 2 + <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>;
00511                 }
00512                         
00513                 <font class="keywordflow">for</font> (k = 0; k &lt; size; ++k)
00514                 {                       
00515                         <font class="keywordflow">if</font> (_Tex)
00516                         {
00517                                 vb.setTexCoord(k * (<a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a> + 2), 0, <a class="code" href="classNLMISC_1_1CUV.html">NLMISC::CUV</a>(0, 0));
00518                         }
00519                         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSColoredParticle.html#n1">_ColorScheme</a>)
00520                         {
00521                                 vb.setColor(k * (<a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a> + 2), CRGBA::White);                   
00522                         }               
00523                         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSFanLight.html#o3">_Tex</a>)
00524                         {
00525                                 <font class="keywordflow">for</font>(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 1; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt;= <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a> + 1; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00526                                 {
00527                                         vb.setColor(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + k * (<a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a> + 2), CRGBA(0, 0, 0));
00528                                 }
00529                         }
00530                         <font class="keywordflow">else</font>
00531                         {
00532                                 <font class="keywordflow">for</font>(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 1; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt;= <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a> + 1; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00533                                 {
00534                                         vb.setColor(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + k * (<a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a> + 2), CRGBA(0, 0, 0));
00535                                         vb.setTexCoord(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + k * (<a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a> + 2), 0, <a class="code" href="classNLMISC_1_1CUV.html">NLMISC::CUV</a>((<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> - 1) / (<font class="keywordtype">float</font>) <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>, 1));
00536                                 }
00537                         }
00538                 }
00539                 
00540                 retVb = &amp;vb;
00541                 retIb = &amp;ib;
00542         }       
00543 }
00544 
<a name="l00546"></a><a class="code" href="classNL3D_1_1CPSFanLight.html#c3">00546</a> uint CPSFanLight::getNumFanlightsInVB()<font class="keyword"> const</font>
00547 <font class="keyword"></font>{
00548         <font class="keyword">const</font> uint numRib = NumVertsInBuffer / (2 + <a class="code" href="classNL3D_1_1CPSFanLight.html#o0">_NbFans</a>);
00549         <font class="keywordflow">return</font> std::max(1u, numRib);
00550 }
00551 
00552 } <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=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>