aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a03193.html
blob: bba5dbedd0b9f32f2cb731ef670e732295c41e24 (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
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
<!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::CPSFaceLookAtHelper 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&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CPSFaceLookAtHelper 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="a03191.html">CPSFaceLookAt</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="a06233.html#l00062">62</a> of file <a class="el" href="a06233.html">ps_face_look_at.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&lt;class T&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03193.html#NL3D_1_1CPSFaceLookAtHelpere0">computeOrientationVectors</a> (T speedIt, const <a class="el" href="a03128.html">CVector</a> &amp;I, const <a class="el" href="a03128.html">CVector</a> &amp;K, <a class="el" href="a02829.html">CLookAtAlign</a> *dest, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class T&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03193.html#NL3D_1_1CPSFaceLookAtHelpere1">drawLookAt</a> (T it, T speedIt, <a class="el" href="a03191.html">CPSFaceLookAt</a> &amp;la, <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>

<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class T&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03193.html#NL3D_1_1CPSFaceLookAtHelpere2">drawLookAtAlignOnMotion</a> (T it, T speedIt, <a class="el" href="a03191.html">CPSFaceLookAt</a> &amp;la, <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_1CPSFaceLookAtHelpere0" doxytag="NL3D::CPSFaceLookAtHelper::computeOrientationVectors" ></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&lt;class T&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CPSFaceLookAtHelper::computeOrientationVectors </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">T&nbsp;</td>
          <td class="mdname" nowrap> <em>speedIt</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>I</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>K</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a02829.html">CLookAtAlign</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>dest</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>&nbsp;</td>
          <td class="mdname" nowrap> <em>size</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</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>
      &nbsp;
    </td>
    <td>

<p>
compute orientation vectors depending on speed 
<p>
Definition at line <a class="el" href="a06233.html#l00068">68</a> of file <a class="el" href="a06233.html">ps_face_look_at.cpp</a>.
<p>
References <a class="el" href="a06233.html#l00044">NL3D::CLookAtAlign::I</a>, <a class="el" href="a06233.html#l00045">NL3D::CLookAtAlign::K</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06682.html#l00125">NLMISC::CVector::normed()</a>, <a class="el" href="a05646.html#l00645">size</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
Referenced by <a class="el" href="a06233.html#l00089">drawLookAtAlignOnMotion()</a>.
<p>
<div class="fragment"><pre>00069         {
00070                 <a class="code" href="a04199.html#a6">nlassert</a>(size &gt; 0);
00071                 <span class="keyword">const</span> CLookAtAlign *endDest = dest + <a class="code" href="a04223.html#a587">size</a>;
00072                 <span class="keywordflow">do</span> 
00073                 {
00074                         <span class="comment">// tmp unoptimized slow version</span>
00075                         CVector normedSpeed = (*speedIt).normed();
00076                         <span class="keywordtype">float</span> iProj = normedSpeed * I;
00077                         <span class="keywordtype">float</span> kProj = normedSpeed * K;
00078                         dest-&gt;I = iProj * I + kProj * K;
00079                         dest-&gt;K = (- kProj * I + iProj * K).normed();
00080                         ++ speedIt;
00081                         ++ dest;
00082                 } 
00083                 <span class="keywordflow">while</span>(dest != endDest);
00084         }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CPSFaceLookAtHelpere1" doxytag="NL3D::CPSFaceLookAtHelper::drawLookAt" ></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&lt;class T&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CPSFaceLookAtHelper::drawLookAt </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">T&nbsp;</td>
          <td class="mdname" nowrap> <em>it</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>T&nbsp;</td>
          <td class="mdname" nowrap> <em>speedIt</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03191.html">CPSFaceLookAt</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>la</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>&nbsp;</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>&nbsp;</td>
          <td class="mdname" nowrap> <em>srcStep</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</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>
      &nbsp;
    </td>
    <td>

<p>
render look at, but dont align on motion
<p>
Definition at line <a class="el" href="a06233.html#l00379">379</a> of file <a class="el" href="a06233.html">ps_face_look_at.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="a06234.html#l00124">NL3D::CPSFaceLookAt::_IndependantSizes</a>, <a class="el" href="a06258.html#l00844">NL3D::CPSMaterial::_Mat</a>, <a class="el" href="a06234.html#l00116">NL3D::CPSFaceLookAt::_MotionBlurCoeff</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="a03191.html#NL3D_1_1CPSFaceLookAtp19">NL3D::CPSFaceLookAt::_SecondSize</a>, <a class="el" href="a06258.html#l00290">NL3D::CPSSizedParticle::_SizeScheme</a>, <a class="el" href="a06234.html#l00117">NL3D::CPSFaceLookAt::_Threshold</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#l00936">NL3D::CPSLocatedBindable::computeJ()</a>, <a class="el" href="a06247.html#l00940">NL3D::CPSLocatedBindable::computeK()</a>, <a class="el" href="a06247.html#l00890">NL3D::CPSLocatedBindable::getDriver()</a>, <a class="el" href="a06246.html#l00092">NL3D::CPSLocated::getLocalToWorldMatrix()</a>, <a class="el" href="a06262.html#l00146">NL3D::CPSQuad::getNeededVB()</a>, <a class="el" href="a06258.html#l00274">NL3D::CPSSizedParticle::getSize()</a>, <a class="el" href="a06258.html#l00265">NL3D::CPSSizedParticle::getSizeScheme()</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#l02125">NL3D::CPSLocatedBindable::getViewMat()</a>, <a class="el" href="a06246.html#l00500">NL3D::CPSLocated::incrementNbDrawnParticles()</a>, <a class="el" href="a03136.html#NL3D_1_1CPSAttribMakerz714_2">NL3D::CPSAttribMaker&lt; float &gt;::make()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06682.html#l00115">NLMISC::CVector::norm()</a>, <a class="el" href="a05701.html#l00125">NLMISC::OptFastFloor()</a>, <a class="el" href="a05701.html#l00123">NLMISC::OptFastFloorBegin()</a>, <a class="el" href="a05701.html#l00124">NLMISC::OptFastFloorEnd()</a>, <a class="el" href="a06152.html#l00060">PARTICLES_CHECK_MEM</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera52">NL3D::IDriver::renderOrientedQuads()</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera54">NL3D::IDriver::renderQuads()</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="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="a06262.html#l00520">NL3D::CPSQuad::updateMatBeforeRendering()</a>, <a class="el" href="a06262.html#l00386">NL3D::CPSQuad::updateVbColNUVForRender()</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>.
<p>
<div class="fragment"><pre>00380         {
00381                 <span class="comment">//uint64 startTick = NLMISC::CTime::getPerformanceTime();                                                                       </span>
00382                 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>;    
00383                 <a class="code" href="a04199.html#a6">nlassert</a>(la._Owner);                    
00384                 IDriver *driver = la.getDriver();
00385 
00386                 la.updateMatBeforeRendering(driver);
00387                 
00388                 CVertexBuffer &amp;vb = la.getNeededVB();
00389                 la._Owner-&gt;incrementNbDrawnParticles(size); <span class="comment">// for benchmark purpose    </span>
00390                 la.setupDriverModelMatrix();
00391                 driver-&gt;activeVertexBuffer(vb); 
00392                 <span class="keyword">const</span> CVector I = la.computeI();
00393                 <span class="keyword">const</span> CVector J = la.computeJ();
00394                 <span class="keyword">const</span> CVector K = la.computeK();                
00395                 <span class="keyword">const</span> <span class="keywordtype">float</span> *rotTable = CPSRotated2DParticle::getRotTable();    
00396                 <span class="comment">// for each the particle can be constantly rotated or have an independant rotation for each particle</span>
00397                 <span class="comment">// number of face left, and number of face to process at once</span>
00398                 <a class="code" href="a04558.html#a11">uint32</a> leftToDo = <a class="code" href="a04223.html#a587">size</a>, toProcess;
00399                 <span class="keywordtype">float</span> pSizes[CPSQuad::quadBufSize]; <span class="comment">// the sizes to use </span>
00400                 <span class="keywordtype">float</span> pSecondSizes[CPSQuad::quadBufSize]; <span class="comment">// the second sizes to use</span>
00401                 <span class="keywordtype">float</span> *currentSize; 
00402                 <a class="code" href="a04558.html#a11">uint32</a> currentSizeStep = la._SizeScheme ? 1 : 0;
00403                 <span class="comment">// point the vector part in the current vertex</span>
00404                 <a class="code" href="a04558.html#a7">uint8</a> *ptPos; 
00405                 <span class="comment">// strides to go from one vertex to another one</span>
00406                 <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(), stride2 = <a class="code" href="a04223.html#a582">stride</a> &lt;&lt; 1, stride3 = <a class="code" href="a04223.html#a582">stride</a> + stride2, stride4 = <a class="code" href="a04223.html#a582">stride</a> &lt;&lt; 2;     
00407                 <span class="comment">//PSLookAtRenderTime += NLMISC::CTime::getPerformanceTime() - startTick;                </span>
00408                 <span class="keywordflow">if</span> (!la._Angle2DScheme)
00409                 {
00410                         <span class="comment">// constant rotation case</span>
00411                         <span class="keywordflow">do</span>
00412                         {                       
00413                                 <span class="comment">// restart at the beginning of the vertex buffer</span>
00414                                 ptPos = (<a class="code" href="a04558.html#a7">uint8</a> *) vb.getVertexCoordPointer();
00415                                 toProcess = leftToDo &lt;= CPSQuad::quadBufSize ? leftToDo : CPSQuad::quadBufSize;
00416 
00417                                 <span class="keywordflow">if</span> (la._SizeScheme)
00418                                 {
00419                                         currentSize = (<span class="keywordtype">float</span> *) la._SizeScheme-&gt;make(la._Owner, size- leftToDo, pSizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00420                                 }
00421                                 <span class="keywordflow">else</span>
00422                                 {
00423                                         currentSize = &amp;la._ParticleSize;
00424                                 }
00425                                 
00426                                 la.updateVbColNUVForRender(vb, size - leftToDo, toProcess, srcStep);                                    
00427                                 T endIt = it + toProcess;
00428                                 <span class="keywordflow">if</span> (la._MotionBlurCoeff == 0.f)
00429                                 {
00430                                         <span class="keywordflow">if</span> (!la._IndependantSizes)
00431                                         {                                               
00432                                                 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> tabIndex = (((<a class="code" href="a04558.html#a11">uint32</a>) la._Angle2D) &amp; 0xff) &lt;&lt; 2;
00433                                                 <span class="keyword">const</span> CVector v1 = rotTable[tabIndex] * I + rotTable[tabIndex + 1] * K;
00434                                                 <span class="keyword">const</span> CVector v2 = rotTable[tabIndex + 2] * I + rotTable[tabIndex + 3] * K;
00435                                                 <span class="keywordflow">if</span> (currentSizeStep)
00436                                                 {
00437                                                         <span class="keywordflow">while</span> (it != endIt)
00438                                                         {
00439                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00440                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x;                        
00441                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y;                        
00442                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z;                        
00443                                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00444 
00445                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00446                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v2.x;                        
00447                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v2.y;                        
00448                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v2.z;                        
00449                                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00450 
00451                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00452                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x;                        
00453                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y;                        
00454                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z;                        
00455                                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00456 
00457                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00458                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v2.x;                        
00459                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v2.y;                        
00460                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v2.z;                        
00461                                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;                                                        
00462 
00463                                                                 ++it;
00464                                                                 currentSize += currentSizeStep;                                 
00465                                                         }
00466                                                 }
00467                                                 <span class="keywordflow">else</span>
00468                                                 {
00469                                                         <span class="comment">// constant size</span>
00470                                                         <span class="keyword">const</span> CVector myV1 = *currentSize * v1;
00471                                                         <span class="keyword">const</span> CVector myV2 = *currentSize * v2;
00472 
00473                                                         <span class="keywordflow">while</span> (it != endIt)
00474                                                         {
00475                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00476                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + myV1.x;                     
00477                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + myV1.y;                     
00478                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + myV1.z;                     
00479                                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00480 
00481                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00482                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + myV2.x;                     
00483                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + myV2.y;                     
00484                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + myV2.z;                     
00485                                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00486 
00487                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00488                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - myV1.x;                     
00489                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - myV1.y;                     
00490                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - myV1.z;                     
00491                                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00492 
00493                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00494                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - myV2.x;                     
00495                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - myV2.y;                     
00496                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - myV2.z;                     
00497                                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;                                                        
00498                                                                 ++it;                                                                                   
00499                                                         }
00500                                                 }
00501                                         }
00502                                         <span class="keywordflow">else</span> <span class="comment">// independant sizes</span>
00503                                         {                       
00504                                                 <span class="keyword">const</span> CVector v1 = CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) la._Angle2D) * I  + CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) la._Angle2D) * K;
00505                                                 <span class="keyword">const</span> CVector v2 = - CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) la._Angle2D) * I + CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) la._Angle2D) * K;
00506 
00507                                                 <span class="keywordtype">float</span> *currentSize2;
00508                                                 <span class="keywordtype">float</span> secondSize;
00509                                                 <a class="code" href="a04558.html#a11">uint32</a> currentSizeStep2;
00510                                                 <span class="keywordflow">if</span> (la._SecondSize.getSizeScheme())
00511                                                 {
00512                                                         currentSize2 = (<span class="keywordtype">float</span> *) la._SecondSize.getSizeScheme()-&gt;make(la._Owner, size- leftToDo, pSecondSizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00513                                                         currentSizeStep2 = 1;
00514                                                 }
00515                                                 <span class="keywordflow">else</span>
00516                                                 {       
00517                                                         secondSize = la._SecondSize.getSize();
00518                                                         currentSize2 = &amp;secondSize;
00519                                                         currentSizeStep2 = 0;
00520                                                 }
00521                                                  
00522 
00523                                                 <span class="keywordflow">while</span> (it != endIt)
00524                                                 {
00525                                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00526                                                         ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x + *currentSize2 * v2.x;                         
00527                                                         ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y + *currentSize2 * v2.y;                         
00528                                                         ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z + *currentSize2 * v2.z;
00529                                                         ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00530 
00531                                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00532                                                         ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x + *currentSize2 * v2.x;                         
00533                                                         ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y + *currentSize2 * v2.y;                         
00534                                                         ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z + *currentSize2 * v2.z;
00535                                                         ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00536 
00537                                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00538                                                         ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x - *currentSize2 * v2.x;                         
00539                                                         ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y - *currentSize2 * v2.y;                         
00540                                                         ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z - *currentSize2 * v2.z;
00541                                                         ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00542 
00543                                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00544                                                         ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x - *currentSize2 * v2.x;                         
00545                                                         ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y - *currentSize2 * v2.y;                         
00546                                                         ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z - *currentSize2 * v2.z;
00547                                                         ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00548                                                         ++it;
00549                                                         currentSize += currentSizeStep;
00550                                                         currentSize2 += currentSizeStep2;
00551                                                 }                                       
00552                                         }               
00553                                         <span class="comment">//tmp</span>
00554                                         <span class="comment">//uint64 startTick = NLMISC::CTime::getPerformanceTime();                                       </span>
00555                                         driver-&gt;renderQuads(la._Mat, 0, toProcess);                                     
00556                                         <span class="comment">//PSLookAtRenderTime += NLMISC::CTime::getPerformanceTime() - startTick;</span>
00557                                 }
00558                                 <span class="keywordflow">else</span>
00559                                 {
00560                                         <span class="comment">// perform motion, blur, we need an iterator on speed</span>
00561                                         <span class="comment">// independant sizes and rotation not supported for now with motion blur                                </span>
00562                                         <span class="keyword">const</span> CVector v1 = I + K;
00563                                         <span class="keyword">const</span> CVector v2 = K - I;                                                               
00564                                         CVector startV, endV, mbv1, mbv1n, mbv12, mbv2;
00565                                         <span class="comment">// norme of the v1 vect</span>
00566                                         <span class="keywordtype">float</span> n;
00567                                         <span class="keyword">const</span> <span class="keywordtype">float</span> epsilon  = 10E-5f;
00568                                         <span class="keyword">const</span> <span class="keywordtype">float</span> normEpsilon  = 10E-6f;
00569                                         
00570                                         CMatrix tMat = la.getViewMat()  *  la._Owner-&gt;getLocalToWorldMatrix();                                                          
00571                         
00572                                         <span class="keywordflow">while</span> (it != endIt)
00573                                         {
00574                                                 <span class="comment">// project the speed in the projection plane</span>
00575                                                 <span class="comment">// this give us the v1 vect</span>
00576                                                 startV = tMat * *it ;                                           
00577                                                 endV = tMat * (*it + *speedIt);                                                                                                 
00578                                                 <span class="keywordflow">if</span> (startV.y &gt; epsilon || endV.y &gt; epsilon)                                                                                                                                                                                                                                                                             
00579                                                 {       
00580                                                         <span class="keywordflow">if</span> (startV.y &lt; epsilon)
00581                                                         {
00582                                                                 <span class="keywordflow">if</span> (fabsf(endV.y - startV.y) &gt; normEpsilon)
00583                                                                 {
00584                                                                         startV = endV + (endV.y - epsilon) / (endV.y - startV.y) * (startV - endV);
00585                                                                 }
00586                                                                 startV.y = epsilon;
00587                                                         }
00588                                                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (endV.y &lt; epsilon)
00589                                                         {       
00590                                                                 <span class="keywordflow">if</span> (fabsf(endV.y - startV.y) &gt; normEpsilon)
00591                                                                 {
00592                                                                         endV = startV + (startV.y - epsilon) / (startV.y - endV.y) * (endV - startV);
00593                                                                 }
00594                                                                 endV.y = epsilon;
00595                                                         }                                                                                                               
00596 
00597                                                         mbv1 = (startV.x / startV.y - endV.x / endV.y) * I
00598                                                                                         + (startV.z / startV.y - endV.z / endV.y) * K ;                                         
00599                                                 
00600                                                         n = mbv1.norm();
00601                                                         <span class="keywordflow">if</span> (n &gt; la._Threshold)
00602                                                         {
00603                                                                 mbv1 *= la._Threshold / n;
00604                                                                 n = la._Threshold;                                                              
00605                                                         }                                                                                                                                                                                                               
00606                                                         <span class="keywordflow">if</span> (n &gt; normEpsilon)                                                                                            
00607                                                         {                                                                                                                                                                                       
00608                                                                 mbv1n = mbv1 / n;                                                                                                               
00609                                                                 mbv2 = *currentSize * (J ^ mbv1n);
00610                                                                 mbv12 = -*currentSize * mbv1n;                                                  
00611                                                                 mbv1 *= *currentSize * (1 + la._MotionBlurCoeff * n * n) / n;
00612                                                         
00613                                                                 *(CVector *) ptPos = *it - mbv2;                                                                                                
00614                                                                 *(CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>) = *it  + mbv1;                    
00615                                                                 *(CVector *) (ptPos + stride2) = *it + mbv2;    
00616                                                                 *(CVector *) (ptPos + stride3) = *it + mbv12;
00617                                                         
00618                                                         
00619                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00620                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - mbv2.x;                     
00621                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - mbv2.y;
00622                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - mbv2.z;
00623                                                                 
00624                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride);
00625                                                                 ((CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>))-&gt;x = (*it).x  + mbv1.x;                          
00626                                                                 ((CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>))-&gt;y = (*it).y  + mbv1.y;                          
00627                                                                 ((CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>))-&gt;z = (*it).z  + mbv1.z;                          
00628 
00629                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride2);
00630                                                                 ((CVector *) (ptPos + stride2))-&gt;x = (*it).x  + mbv2.x;                         
00631                                                                 ((CVector *) (ptPos + stride2))-&gt;y = (*it).y  + mbv2.y;                         
00632                                                                 ((CVector *) (ptPos + stride2))-&gt;z = (*it).z  + mbv2.z;                         
00633 
00634 
00635                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride3);
00636                                                                 ((CVector *) (ptPos + stride3))-&gt;x = (*it).x  + mbv12.x;                        
00637                                                                 ((CVector *) (ptPos + stride3))-&gt;y = (*it).y  + mbv12.y;                        
00638                                                                 ((CVector *) (ptPos + stride3))-&gt;z = (*it).z  + mbv12.z;                                                                                                
00639                                                                 
00640                                                         }
00641                                                         <span class="keywordflow">else</span> <span class="comment">// speed too small, we must avoid imprecision</span>
00642                                                         {
00643                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00644                                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v2.x;                        
00645                                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v2.y;                        
00646                                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v2.z;                        
00647                                                                 
00648                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride);
00649                                                                 ((CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>))-&gt;x = (*it).x  + *currentSize * v1.x;                     
00650                                                                 ((CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>))-&gt;y = (*it).y  + *currentSize * v1.y;                     
00651                                                                 ((CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>))-&gt;z = (*it).z  + *currentSize * v1.z;                     
00652 
00653                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride2);
00654                                                                 ((CVector *) (ptPos + stride2))-&gt;x = (*it).x  + *currentSize * v2.x;                    
00655                                                                 ((CVector *) (ptPos + stride2))-&gt;y = (*it).y  + *currentSize * v2.y;                    
00656                                                                 ((CVector *) (ptPos + stride2))-&gt;z = (*it).z  + *currentSize * v2.z;                    
00657 
00658 
00659                                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride3);
00660                                                                 ((CVector *) (ptPos + stride3))-&gt;x = (*it).x  - *currentSize * v1.x;                    
00661                                                                 ((CVector *) (ptPos + stride3))-&gt;y = (*it).y  - *currentSize * v1.y;                    
00662                                                                 ((CVector *) (ptPos + stride3))-&gt;z = (*it).z  - *currentSize * v1.z;                                                    
00663                                                         }
00664                                                 }
00665                                                 <span class="keywordflow">else</span>
00666                                                 {
00667 
00668                                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00669                                                         ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v2.x;                        
00670                                                         ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v2.y;                        
00671                                                         ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v2.z;                        
00672                                                         
00673                                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride);
00674                                                         ((CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>))-&gt;x = (*it).x  + *currentSize * v1.x;                     
00675                                                         ((CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>))-&gt;y = (*it).y  + *currentSize * v1.y;                     
00676                                                         ((CVector *) (ptPos + <a class="code" href="a04223.html#a582">stride</a>))-&gt;z = (*it).z  + *currentSize * v1.z;                     
00677 
00678                                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride2);
00679                                                         ((CVector *) (ptPos + stride2))-&gt;x = (*it).x  + *currentSize * v2.x;                    
00680                                                         ((CVector *) (ptPos + stride2))-&gt;y = (*it).y  + *currentSize * v2.y;                    
00681                                                         ((CVector *) (ptPos + stride2))-&gt;z = (*it).z  + *currentSize * v2.z;                    
00682 
00683 
00684                                                         <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride3);
00685                                                         ((CVector *) (ptPos + stride3))-&gt;x = (*it).x  - *currentSize * v1.x;                    
00686                                                         ((CVector *) (ptPos + stride3))-&gt;y = (*it).y  - *currentSize * v1.y;                    
00687                                                         ((CVector *) (ptPos + stride3))-&gt;z = (*it).z  - *currentSize * v1.z;                                                                                                    
00688                                                 }
00689                                         
00690                                                 ptPos += stride4;
00691                                                 ++it;
00692                                                 ++speedIt;
00693                                                 currentSize += currentSizeStep;                                 
00694                                         }
00695                                         <span class="comment">//uint64 startTick = NLMISC::CTime::getPerformanceTime();                                       </span>
00696                                         driver-&gt;renderOrientedQuads(la._Mat, 0, toProcess);
00697                                         <span class="comment">//PSLookAtRenderTime += NLMISC::CTime::getPerformanceTime() - startTick;</span>
00698                                 }                                                       
00699                                 leftToDo -= toProcess;                          
00700                         }
00701                         <span class="keywordflow">while</span> (leftToDo);
00702                 }
00703                 <span class="keywordflow">else</span>
00704                 {               
00705                         <span class="keywordtype">float</span> pAngles[CPSQuad::quadBufSize]; <span class="comment">// the angles to use</span>
00706                         <span class="keywordtype">float</span> *currentAngle;            
00707                         <span class="keywordflow">do</span>
00708                         {                       
00709                                 <span class="comment">// restart at the beginning of the vertex buffer</span>
00710                                 ptPos = (<a class="code" href="a04558.html#a7">uint8</a> *) vb.getVertexCoordPointer();
00711                                 toProcess = leftToDo &lt;= CPSQuad::quadBufSize ? leftToDo : CPSQuad::quadBufSize;
00712                                 <span class="keywordflow">if</span> (la._SizeScheme)
00713                                 {
00714                                         currentSize = (<span class="keywordtype">float</span> *) la._SizeScheme-&gt;make(la._Owner, size - leftToDo, pSizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00715                                 }
00716                                 <span class="keywordflow">else</span>
00717                                 {
00718                                         currentSize = &amp;la._ParticleSize;
00719                                 }
00720                                 currentAngle = (<span class="keywordtype">float</span> *) la._Angle2DScheme-&gt;make(la._Owner, size - leftToDo, pAngles, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00721                                 la.updateVbColNUVForRender(vb, size - leftToDo, toProcess, srcStep);                                    
00722                                 T endIt = it + toProcess;
00723                                 CVector v1, v2;
00724                                 <a class="code" href="a05378.html#a395">NLMISC::OptFastFloorBegin</a>();
00725                                 <span class="keywordflow">if</span> (!la._IndependantSizes)
00726                                 {                               
00727                                         <span class="keywordflow">while</span> (it != endIt)
00728                                         {
00729                                                 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> tabIndex = ((<a class="code" href="a05378.html#a397">NLMISC::OptFastFloor</a>(*currentAngle)) &amp; 0xff) &lt;&lt; 2;                    
00730                                                 <span class="comment">// lets avoid some ctor calls</span>
00731                                                 v1.x = *currentSize * (rotTable[tabIndex] * I.x + rotTable[tabIndex + 1] * K.x);
00732                                                 v1.y = *currentSize * (rotTable[tabIndex] * I.y + rotTable[tabIndex + 1] * K.y);
00733                                                 v1.z = *currentSize * (rotTable[tabIndex] * I.z + rotTable[tabIndex + 1] * K.z);
00734 
00735                                                 v2.x = *currentSize * (rotTable[tabIndex + 2] * I.x + rotTable[tabIndex + 3] * K.x);
00736                                                 v2.y = *currentSize * (rotTable[tabIndex + 2] * I.y + rotTable[tabIndex + 3] * K.y);
00737                                                 v2.z = *currentSize * (rotTable[tabIndex + 2] * I.z + rotTable[tabIndex + 3] * K.z);
00738                                                 
00739                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00740                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride);
00741                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride2);
00742                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride3);                               
00743                                         
00744                                                 ((CVector *) ptPos)-&gt;x  = (*it).x  + v1.x;              
00745                                                 ((CVector *) ptPos)-&gt;y  = (*it).y  + v1.y;
00746                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + v1.z;                       
00747                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00748 
00749                                                 ((CVector *) ptPos)-&gt;x  = (*it).x  + v2.x;              
00750                                                 ((CVector *) ptPos)-&gt;y  = (*it).y  + v2.y;
00751                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + v2.z;                       
00752                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00753 
00754                                                 ((CVector *) ptPos)-&gt;x  = (*it).x  - v1.x;              
00755                                                 ((CVector *) ptPos)-&gt;y  = (*it).y  - v1.y;
00756                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - v1.z;                       
00757                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00758 
00759                                                 ((CVector *) ptPos)-&gt;x  = (*it).x  - v2.x;              
00760                                                 ((CVector *) ptPos)-&gt;y  = (*it).y  - v2.y;
00761                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - v2.z;                                       
00762                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00763                                                 
00764                                                 ++it;
00765                                                 currentSize += currentSizeStep;
00766                                                 ++currentAngle;                                 
00767                                         }
00768                                 }
00769                                 <span class="keywordflow">else</span> <span class="comment">// independant size, and non-constant rotation</span>
00770                                 {
00771                                         
00772                                         <span class="keywordtype">float</span> *currentSize2;
00773                                         <span class="keywordtype">float</span> secondSize;
00774                                         <a class="code" href="a04558.html#a11">uint32</a> currentSizeStep2;
00775                                         <span class="keywordflow">if</span> (la._SecondSize.getSizeScheme())
00776                                         {
00777                                                 currentSize2 = (<span class="keywordtype">float</span> *) la._SecondSize.getSizeScheme()-&gt;make(la._Owner, size- leftToDo, pSecondSizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00778                                                 currentSizeStep2 = 1;
00779                                         }
00780                                         <span class="keywordflow">else</span>
00781                                         {       
00782                                                 secondSize = la._SecondSize.getSize();
00783                                                 currentSize2 = &amp;secondSize;
00784                                                 currentSizeStep2 = 0;
00785                                         }
00786 
00787                                         <span class="keywordtype">float</span> cosAngle, sinAngle;
00788                                         <span class="keywordflow">while</span> (it != endIt)
00789                                         {
00790                                                 cosAngle = CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) *currentAngle);
00791                                                 sinAngle = CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) *currentAngle);
00792                                                 v1 = cosAngle * I  + sinAngle * K;
00793                                                 v2 = - sinAngle * I + cosAngle * K;
00794 
00795                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00796                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x + *currentSize2 * v2.x;                         
00797                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y + *currentSize2 * v2.y;                         
00798                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z + *currentSize2 * v2.z;
00799                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00800 
00801                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00802                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x + *currentSize2 * v2.x;                         
00803                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y + *currentSize2 * v2.y;                         
00804                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z + *currentSize2 * v2.z;
00805                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00806 
00807                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00808                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x - *currentSize2 * v2.x;                         
00809                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y - *currentSize2 * v2.y;                         
00810                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z - *currentSize2 * v2.z;
00811                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00812 
00813                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00814                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x - *currentSize2 * v2.x;                         
00815                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y - *currentSize2 * v2.y;                         
00816                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z - *currentSize2 * v2.z;
00817                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00818                                                 ++it;
00819                                                 ++currentAngle;
00820                                                 currentSize  += currentSizeStep;
00821                                                 currentSize2 += currentSizeStep2;                       
00822                                         }
00823                                 }                               
00824                                 <a class="code" href="a05378.html#a396">NLMISC::OptFastFloorEnd</a>();                                                                                      
00825                                 <span class="comment">//tmp</span>
00826                                 <span class="comment">// uint64 startTick = NLMISC::CTime::getPerformanceTime();                              </span>
00827                                 driver-&gt;renderQuads(la._Mat, 0, toProcess);                             
00828                                 <span class="comment">//PSLookAtRenderTime += NLMISC::CTime::getPerformanceTime() - startTick;*/</span>
00829                                 leftToDo -= toProcess;
00830                         }
00831                         <span class="keywordflow">while</span> (leftToDo);
00832                 }
00833                 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>;
00834         }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CPSFaceLookAtHelpere2" doxytag="NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion" ></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&lt;class T&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">T&nbsp;</td>
          <td class="mdname" nowrap> <em>it</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>T&nbsp;</td>
          <td class="mdname" nowrap> <em>speedIt</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03191.html">CPSFaceLookAt</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>la</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>&nbsp;</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>&nbsp;</td>
          <td class="mdname" nowrap> <em>srcStep</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</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>
      &nbsp;
    </td>
    <td>

<p>
Draw look at and align them on motion
<p>
Definition at line <a class="el" href="a06233.html#l00089">89</a> of file <a class="el" href="a06233.html">ps_face_look_at.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="a06234.html#l00124">NL3D::CPSFaceLookAt::_IndependantSizes</a>, <a class="el" href="a06258.html#l00844">NL3D::CPSMaterial::_Mat</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="a03191.html#NL3D_1_1CPSFaceLookAtp19">NL3D::CPSFaceLookAt::_SecondSize</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="a06233.html#l00068">computeOrientationVectors()</a>, <a class="el" href="a06247.html#l00890">NL3D::CPSLocatedBindable::getDriver()</a>, <a class="el" href="a06262.html#l00146">NL3D::CPSQuad::getNeededVB()</a>, <a class="el" href="a06258.html#l00274">NL3D::CPSSizedParticle::getSize()</a>, <a class="el" href="a06258.html#l00265">NL3D::CPSSizedParticle::getSizeScheme()</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="a06233.html#l00044">NL3D::CLookAtAlign::I</a>, <a class="el" href="a06246.html#l00500">NL3D::CPSLocated::incrementNbDrawnParticles()</a>, <a class="el" href="a06233.html#l00045">NL3D::CLookAtAlign::K</a>, <a class="el" href="a03136.html#NL3D_1_1CPSAttribMakerz714_2">NL3D::CPSAttribMaker&lt; float &gt;::make()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05701.html#l00125">NLMISC::OptFastFloor()</a>, <a class="el" href="a05701.html#l00123">NLMISC::OptFastFloorBegin()</a>, <a class="el" href="a05701.html#l00124">NLMISC::OptFastFloorEnd()</a>, <a class="el" href="a06152.html#l00060">PARTICLES_CHECK_MEM</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera54">NL3D::IDriver::renderQuads()</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="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="a06262.html#l00520">NL3D::CPSQuad::updateMatBeforeRendering()</a>, <a class="el" href="a06262.html#l00386">NL3D::CPSQuad::updateVbColNUVForRender()</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>.
<p>
<div class="fragment"><pre>00090         {
00091                 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>;    
00092                 <a class="code" href="a04199.html#a6">nlassert</a>(la._Owner);                    
00093                 IDriver *driver = la.getDriver();
00094 
00095                 la.updateMatBeforeRendering(driver);
00096                 
00097                 CVertexBuffer &amp;vb = la.getNeededVB();
00098                 la._Owner-&gt;incrementNbDrawnParticles(size); <span class="comment">// for benchmark purpose    </span>
00099                 la.setupDriverModelMatrix();
00100                 driver-&gt;activeVertexBuffer(vb); 
00101                 <span class="keyword">const</span> CVector I = la.computeI();                
00102                 <span class="keyword">const</span> CVector K = la.computeK();                
00103                 <span class="keyword">const</span> <span class="keywordtype">float</span> *rotTable = CPSRotated2DParticle::getRotTable();    
00104                 <span class="comment">// for each the particle can be constantly rotated or have an independant rotation for each particle</span>
00105                 <span class="comment">// number of face left, and number of face to process at once</span>
00106                 <a class="code" href="a04558.html#a11">uint32</a> leftToDo = <a class="code" href="a04223.html#a587">size</a>, toProcess;
00107                 <span class="keywordtype">float</span> pSizes[CPSQuad::quadBufSize]; <span class="comment">// the sizes to use </span>
00108                 <span class="keywordtype">float</span> pSecondSizes[CPSQuad::quadBufSize]; <span class="comment">// the second sizes to use</span>
00109                 <a class="code" href="a04558.html#a7">uint8</a> laAlignRaw[<span class="keyword">sizeof</span>(CLookAtAlign) * CPSQuad::quadBufSize]; <span class="comment">// orientation computed from motion for each particle</span>
00110                 CLookAtAlign *laAlign = (CLookAtAlign *) laAlignRaw; <span class="comment">// cast to avoid unilined ctor calls</span>
00111                 <span class="keywordtype">float</span> *currentSize; 
00112                 <a class="code" href="a04558.html#a11">uint32</a> currentSizeStep = la._SizeScheme ? 1 : 0;
00113                 <span class="comment">// point the vector part in the current vertex</span>
00114                 <a class="code" href="a04558.html#a7">uint8</a> *ptPos;
00115                 <span class="comment">// strides to go from one vertex to another one</span>
00116                 <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(), stride2 = <a class="code" href="a04223.html#a582">stride</a> &lt;&lt; 1, stride3 = <a class="code" href="a04223.html#a582">stride</a> + stride2, stride4 = <a class="code" href="a04223.html#a582">stride</a> &lt;&lt; 2;     
00117                 <span class="keywordflow">if</span> (!la._Angle2DScheme)
00118                 {
00119                         <span class="comment">// constant rotation case</span>
00120                         <span class="keywordflow">do</span>
00121                         {                       
00122                                 <span class="comment">// restart at the beginning of the vertex buffer</span>
00123                                 ptPos = (<a class="code" href="a04558.html#a7">uint8</a> *) vb.getVertexCoordPointer();
00124                                 toProcess = leftToDo &lt;= CPSQuad::quadBufSize ? leftToDo : CPSQuad::quadBufSize;
00125 
00126                                 <span class="keywordflow">if</span> (la._SizeScheme)
00127                                 {
00128                                         currentSize = (<span class="keywordtype">float</span> *) la._SizeScheme-&gt;make(la._Owner, size- leftToDo, pSizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00129                                 }
00130                                 <span class="keywordflow">else</span>
00131                                 {
00132                                         currentSize = &amp;la._ParticleSize;
00133                                 }
00134                                 <a class="code" href="a03193.html#NL3D_1_1CPSFaceLookAtHelpere0">computeOrientationVectors</a>(speedIt, I, K, laAlign, toProcess);
00135                                 speedIt = speedIt + toProcess;
00136                                 <span class="keyword">const</span> CLookAtAlign *currAlign = laAlign;
00137 
00138                                 la.updateVbColNUVForRender(vb, size - leftToDo, toProcess, srcStep);                                    
00139                                 T endIt = it + toProcess;                               
00140                                 <span class="keywordflow">if</span> (!la._IndependantSizes)
00141                                 {                                               
00142                                         <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> tabIndex = (((<a class="code" href="a04558.html#a11">uint32</a>) la._Angle2D) &amp; 0xff) &lt;&lt; 2;
00143                                         CVector v1; 
00144                                         CVector v2;
00145                                         <span class="comment">// TODO : optimize if necessary</span>
00146                                         <span class="keywordflow">while</span> (it != endIt)
00147                                         {
00148                                                 v1 = rotTable[tabIndex] * currAlign-&gt;I + rotTable[tabIndex + 1] * currAlign-&gt;K;
00149                                                 v2 = rotTable[tabIndex + 2] * currAlign-&gt;I + rotTable[tabIndex + 3] * currAlign-&gt;K;
00150                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00151                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x;                        
00152                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y;                        
00153                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z;                        
00154                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00155 
00156                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00157                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v2.x;                        
00158                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v2.y;                        
00159                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v2.z;                        
00160                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00161 
00162                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00163                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x;                        
00164                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y;                        
00165                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z;                        
00166                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00167 
00168                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00169                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v2.x;                        
00170                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v2.y;                        
00171                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v2.z;                        
00172                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;                                                        
00173 
00174                                                 ++it;
00175                                                 ++currAlign;
00176                                                 currentSize += currentSizeStep;                                 
00177                                         }                                       
00178                                 }
00179                                 <span class="keywordflow">else</span> <span class="comment">// independant sizes</span>
00180                                 {                                                               
00181                                         <span class="keywordtype">float</span> *currentSize2;
00182                                         <span class="keywordtype">float</span> secondSize;
00183                                         <a class="code" href="a04558.html#a11">uint32</a> currentSizeStep2;
00184                                         <span class="keywordflow">if</span> (la._SecondSize.getSizeScheme())
00185                                         {
00186                                                 currentSize2 = (<span class="keywordtype">float</span> *) la._SecondSize.getSizeScheme()-&gt;make(la._Owner, size- leftToDo, pSecondSizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00187                                                 currentSizeStep2 = 1;
00188                                         }
00189                                         <span class="keywordflow">else</span>
00190                                         {       
00191                                                 secondSize = la._SecondSize.getSize();
00192                                                 currentSize2 = &amp;secondSize;
00193                                                 currentSizeStep2 = 0;
00194                                         }       
00195                                         CVector v1;
00196                                         CVector v2;
00197                                         <span class="comment">// TODO : optimize if necessary</span>
00198                                         <span class="keywordflow">while</span> (it != endIt)
00199                                         {
00200                                                 v1 = CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) la._Angle2D) * currAlign-&gt;I  + CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) la._Angle2D) * currAlign-&gt;K;
00201                                                 v2 = - CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) la._Angle2D) * currAlign-&gt;I + CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) la._Angle2D) * currAlign-&gt;K;
00202                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00203                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x + *currentSize2 * v2.x;                         
00204                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y + *currentSize2 * v2.y;                         
00205                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z + *currentSize2 * v2.z;
00206                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00207 
00208                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00209                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x + *currentSize2 * v2.x;                         
00210                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y + *currentSize2 * v2.y;                         
00211                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z + *currentSize2 * v2.z;
00212                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00213 
00214                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00215                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x - *currentSize2 * v2.x;                         
00216                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y - *currentSize2 * v2.y;                         
00217                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z - *currentSize2 * v2.z;
00218                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00219 
00220                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00221                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x - *currentSize2 * v2.x;                         
00222                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y - *currentSize2 * v2.y;                         
00223                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z - *currentSize2 * v2.z;
00224                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00225                                                 ++it;
00226                                                 ++currAlign;
00227                                                 currentSize += currentSizeStep;
00228                                                 currentSize2 += currentSizeStep2;
00229                                         }                                       
00230                                 }                               
00231                                 <span class="comment">// uint64 startTick = NLMISC::CTime::getPerformanceTime();                              </span>
00232                                 driver-&gt;renderQuads(la._Mat, 0, toProcess);                             
00233                                 <span class="comment">// PSLookAtRenderTime += NLMISC::CTime::getPerformanceTime() - startTick;</span>
00234                                 leftToDo -= toProcess;                          
00235                         }
00236                         <span class="keywordflow">while</span> (leftToDo);
00237                 }
00238                 <span class="keywordflow">else</span>
00239                 {               
00240                         <span class="keywordtype">float</span> pAngles[CPSQuad::quadBufSize]; <span class="comment">// the angles to use</span>
00241                         <span class="keywordtype">float</span> *currentAngle;            
00242                         <span class="keywordflow">do</span>
00243                         {                       
00244                                 <span class="comment">// restart at the beginning of the vertex buffer</span>
00245                                 ptPos = (<a class="code" href="a04558.html#a7">uint8</a> *) vb.getVertexCoordPointer();
00246                                 toProcess = leftToDo &lt;= CPSQuad::quadBufSize ? leftToDo : CPSQuad::quadBufSize;
00247                                 <span class="keywordflow">if</span> (la._SizeScheme)
00248                                 {
00249                                         currentSize = (<span class="keywordtype">float</span> *) la._SizeScheme-&gt;make(la._Owner, size - leftToDo, pSizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00250                                 }
00251                                 <span class="keywordflow">else</span>
00252                                 {
00253                                         currentSize = &amp;la._ParticleSize;
00254                                 }
00255                                 <a class="code" href="a03193.html#NL3D_1_1CPSFaceLookAtHelpere0">computeOrientationVectors</a>(speedIt, I, K, laAlign, toProcess);
00256                                 speedIt = speedIt + toProcess;
00257                                 <span class="keyword">const</span> CLookAtAlign *currAlign = laAlign;
00258                                 currentAngle = (<span class="keywordtype">float</span> *) la._Angle2DScheme-&gt;make(la._Owner, size - leftToDo, pAngles, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00259                                 la.updateVbColNUVForRender(vb, size - leftToDo, toProcess, srcStep);                                    
00260                                 T endIt = it + toProcess;
00261                                 CVector v1, v2;
00262                                 <a class="code" href="a05378.html#a395">NLMISC::OptFastFloorBegin</a>();
00263                                 <span class="keywordflow">if</span> (!la._IndependantSizes)
00264                                 {                               
00265                                         <span class="keywordflow">while</span> (it != endIt)
00266                                         {
00267                                                 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a> tabIndex = ((<a class="code" href="a05378.html#a397">NLMISC::OptFastFloor</a>(*currentAngle)) &amp; 0xff) &lt;&lt; 2;                    
00268                                                 <span class="comment">// lets avoid some ctor calls</span>
00269                                                 v1.x = *currentSize * (rotTable[tabIndex] * currAlign-&gt;I.x + rotTable[tabIndex + 1] * currAlign-&gt;K.x);
00270                                                 v1.y = *currentSize * (rotTable[tabIndex] * currAlign-&gt;I.y + rotTable[tabIndex + 1] * currAlign-&gt;K.y);
00271                                                 v1.z = *currentSize * (rotTable[tabIndex] * currAlign-&gt;I.z + rotTable[tabIndex + 1] * currAlign-&gt;K.z);
00272 
00273                                                 v2.x = *currentSize * (rotTable[tabIndex + 2] * currAlign-&gt;I.x + rotTable[tabIndex + 3] * currAlign-&gt;K.x);
00274                                                 v2.y = *currentSize * (rotTable[tabIndex + 2] * currAlign-&gt;I.y + rotTable[tabIndex + 3] * currAlign-&gt;K.y);
00275                                                 v2.z = *currentSize * (rotTable[tabIndex + 2] * currAlign-&gt;I.z + rotTable[tabIndex + 3] * currAlign-&gt;K.z);
00276                                                 
00277                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00278                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride);
00279                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride2);
00280                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos + stride3);                               
00281                                         
00282                                                 ((CVector *) ptPos)-&gt;x  = (*it).x  + v1.x;              
00283                                                 ((CVector *) ptPos)-&gt;y  = (*it).y  + v1.y;
00284                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + v1.z;                       
00285                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00286 
00287                                                 ((CVector *) ptPos)-&gt;x  = (*it).x  + v2.x;              
00288                                                 ((CVector *) ptPos)-&gt;y  = (*it).y  + v2.y;
00289                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + v2.z;                       
00290                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00291 
00292                                                 ((CVector *) ptPos)-&gt;x  = (*it).x  - v1.x;              
00293                                                 ((CVector *) ptPos)-&gt;y  = (*it).y  - v1.y;
00294                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - v1.z;                       
00295                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00296 
00297                                                 ((CVector *) ptPos)-&gt;x  = (*it).x  - v2.x;              
00298                                                 ((CVector *) ptPos)-&gt;y  = (*it).y  - v2.y;
00299                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - v2.z;                                       
00300                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00301                                                 
00302                                                 ++it;
00303                                                 ++ currAlign;
00304                                                 currentSize += currentSizeStep;
00305                                                 ++currentAngle;                                 
00306                                         }
00307                                 }
00308                                 <span class="keywordflow">else</span> <span class="comment">// independant size, and non-constant rotation</span>
00309                                 {
00310                                         
00311                                         <span class="keywordtype">float</span> *currentSize2;
00312                                         <span class="keywordtype">float</span> secondSize;
00313                                         <a class="code" href="a04558.html#a11">uint32</a> currentSizeStep2;
00314                                         <span class="keywordflow">if</span> (la._SecondSize.getSizeScheme())
00315                                         {
00316                                                 currentSize2 = (<span class="keywordtype">float</span> *) la._SecondSize.getSizeScheme()-&gt;make(la._Owner, size- leftToDo, pSecondSizes, <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
00317                                                 currentSizeStep2 = 1;
00318                                         }
00319                                         <span class="keywordflow">else</span>
00320                                         {       
00321                                                 secondSize = la._SecondSize.getSize();
00322                                                 currentSize2 = &amp;secondSize;
00323                                                 currentSizeStep2 = 0;
00324                                         }
00325 
00326                                         <span class="keywordtype">float</span> cosAngle, sinAngle;
00327                                         <span class="keywordflow">while</span> (it != endIt)
00328                                         {
00329                                                 cosAngle = CPSUtil::getCos((<a class="code" href="a04558.html#a10">sint32</a>) *currentAngle);
00330                                                 sinAngle = CPSUtil::getSin((<a class="code" href="a04558.html#a10">sint32</a>) *currentAngle);
00331                                                 v1 = cosAngle * currAlign-&gt;I  + sinAngle * currAlign-&gt;K;
00332                                                 v2 = - sinAngle * currAlign-&gt;I + cosAngle * currAlign-&gt;K;
00333 
00334                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00335                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x + *currentSize2 * v2.x;                         
00336                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y + *currentSize2 * v2.y;                         
00337                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z + *currentSize2 * v2.z;
00338                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00339 
00340                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00341                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x + *currentSize2 * v2.x;                         
00342                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y + *currentSize2 * v2.y;                         
00343                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z + *currentSize2 * v2.z;
00344                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00345 
00346                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00347                                                 ((CVector *) ptPos)-&gt;x = (*it).x  + *currentSize * v1.x - *currentSize2 * v2.x;                         
00348                                                 ((CVector *) ptPos)-&gt;y = (*it).y  + *currentSize * v1.y - *currentSize2 * v2.y;                         
00349                                                 ((CVector *) ptPos)-&gt;z = (*it).z  + *currentSize * v1.z - *currentSize2 * v2.z;
00350                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00351 
00352                                                 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(vb, ptPos);
00353                                                 ((CVector *) ptPos)-&gt;x = (*it).x  - *currentSize * v1.x - *currentSize2 * v2.x;                         
00354                                                 ((CVector *) ptPos)-&gt;y = (*it).y  - *currentSize * v1.y - *currentSize2 * v2.y;                         
00355                                                 ((CVector *) ptPos)-&gt;z = (*it).z  - *currentSize * v1.z - *currentSize2 * v2.z;
00356                                                 ptPos += <a class="code" href="a04223.html#a582">stride</a>;
00357                                                 ++it;
00358                                                 ++currentAngle;
00359                                                 ++ currAlign;
00360                                                 currentSize  += currentSizeStep;
00361                                                 currentSize2 += currentSizeStep2;                       
00362                                         }
00363                                 }                               
00364                                 <a class="code" href="a05378.html#a396">NLMISC::OptFastFloorEnd</a>();                              
00365                                 <span class="comment">//tmp</span>
00366                                 <span class="comment">// uint64 startTick = NLMISC::CTime::getPerformanceTime();                              </span>
00367                                 driver-&gt;renderQuads(la._Mat, 0, toProcess);                             
00368                                 <span class="comment">// PSLookAtRenderTime += NLMISC::CTime::getPerformanceTime() - startTick;</span>
00369                                 leftToDo -= toProcess;
00370                         }
00371                         <span class="keywordflow">while</span> (leftToDo);
00372                 }
00373                 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>;
00374         }
</pre></div>    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="a06233.html">ps_face_look_at.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 07:12:22 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>