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
|
<!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::CShadowPolyReceiver class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"> <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CShadowPolyReceiver Class Reference</h1><code>#include <<a class="el" href="a06375.html">shadow_poly_receiver.h</a>></code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A class used to append/remove triangles that will be rendered for ShadowMap Additionally it can be used also for Camera collision for instance. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2003 </dd></dl>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00057">57</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera0">addTriangle</a> (const <a class="el" href="a03616.html">NLMISC::CTriangle</a> &tri)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Append a triangle to the poly receiver. <a href="#NL3D_1_1CShadowPolyReceivera0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera1">CShadowPolyReceiver</a> (<a class="el" href="a04558.html#a15">uint</a> quadGridSize=32, float quadGridCellSize=4.f)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NL3D_1_1CShadowPolyReceivera1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera2">getCameraCollision</a> (const <a class="el" href="a03128.html">CVector</a> &start, const <a class="el" href="a03128.html">CVector</a> &end, float radius, bool cone)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera3">removeTriangle</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a564">id</a>)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">remove a triangle from the poly receiver. <a href="#NL3D_1_1CShadowPolyReceivera3"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivera4">render</a> (<a class="el" href="a02434.html">IDriver</a> *drv, <a class="el" href="a02839.html">CMaterial</a> &shadowMat, const <a class="el" href="a03370.html">CShadowMap</a> *shadowMap, const <a class="el" href="a03128.html">CVector</a> &casterPos, const <a class="el" href="a03128.html">CVector</a> &vertDelta)</td></tr>
<tr><td colspan=2><br><h2>Private Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="a03273.html">CQuadGrid</a>< <a class="el" href="a03374.html">CTriangleId</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery0">TTriangleGrid</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< <a class="el" href="a03128.html">CVector</a>,<br>
<a class="el" href="a04558.html#a15">uint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery1">TVertexMap</a></td></tr>
<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverd0">allocateVertex</a> (const <a class="el" href="a03128.html">CVector</a> &<a class="el" href="a04223.html#a576">v</a>)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverd1">incVertexRefCount</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a564">id</a>)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverd2">releaseVertex</a> (<a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a564">id</a>)</td></tr>
<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a15">uint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a15">uint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a11">uint32</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr2">_RenderTriangles</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03273.html">TTriangleGrid</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< TTriangleGrid::CIterator > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03692.html">CVertexBuffer</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">_VB</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery1">TVertexMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03375.html">CVectorId</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a></td></tr>
</table>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="NL3D_1_1CShadowPolyReceivery0" doxytag="NL3D::CShadowPolyReceiver::TTriangleGrid" ></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" nowrap valign="top"> typedef <a class="el" href="a03273.html">CQuadGrid</a><<a class="el" href="a03374.html">CTriangleId</a>> <a class="el" href="a03273.html">NL3D::CShadowPolyReceiver::TTriangleGrid</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00105">105</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceivery1" doxytag="NL3D::CShadowPolyReceiver::TVertexMap" ></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" nowrap valign="top"> typedef std::map<<a class="el" href="a03128.html">CVector</a>, <a class="el" href="a04558.html#a15">uint</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery1">NL3D::CShadowPolyReceiver::TVertexMap</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00097">97</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td>
</tr>
</table>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="NL3D_1_1CShadowPolyReceivera1" doxytag="NL3D::CShadowPolyReceiver::CShadowPolyReceiver" ></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" nowrap valign="top"> NL3D::CShadowPolyReceiver::CShadowPolyReceiver </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname" nowrap> <em>quadGridSize</em> = 32, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>float </td>
<td class="mdname" nowrap> <em>quadGridCellSize</em> = 4.f</td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Constructor.
<p>
<p>
Definition at line <a class="el" href="a06374.html#l00043">43</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>.
<p>
References <a class="el" href="a06375.html#l00108">_FreeTriangles</a>, <a class="el" href="a06375.html#l00096">_FreeVertices</a>, <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a06300.html#l00433">NL3D::CQuadGrid< T >::create()</a>, <a class="el" href="a06710.html#l00169">NL3D::CVertexBuffer::setVertexFormat()</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
<div class="fragment"><pre>00044 {
00045 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.reserve(64);
00046 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.reserve(64);
00047 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.reserve(64);
00048 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.reserve(64);
00049
00050 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz772_1">create</a>(quadGridSize, quadGridCellSize);
00051
00052 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">_VB</a>.setVertexFormat(CVertexBuffer::PositionFlag);
00053 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NL3D_1_1CShadowPolyReceivera0" doxytag="NL3D::CShadowPolyReceiver::addTriangle" ></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" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NL3D::CShadowPolyReceiver::addTriangle </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a03616.html">NLMISC::CTriangle</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>tri</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Append a triangle to the poly receiver.
<p>
<p>
Definition at line <a class="el" href="a06374.html#l00057">57</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>.
<p>
References <a class="el" href="a06375.html#l00108">_FreeTriangles</a>, <a class="el" href="a06375.html#l00113">_RenderTriangles</a>, <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a06375.html#l00098">_VertexMap</a>, <a class="el" href="a06374.html#l00134">allocateVertex()</a>, <a class="el" href="a05384.html#l00215">NLMISC::CAABBox::extend()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a06374.html#l00183">incVertexRefCount()</a>, <a class="el" href="a06300.html#l00516">NL3D::CQuadGrid< T >::insert()</a>, <a class="el" href="a05385.html#l00066">NLMISC::CAABBox::setCenter()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05646.html#l00237">v</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V0</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V1</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V2</a>, and <a class="el" href="a06375.html#l00103">NL3D::CShadowPolyReceiver::CTriangleId::Vertex</a>.
<p>
Referenced by <a class="el" href="a05862.html#l03658">NL3D::CLandscape::appendToShadowPolyReceiver()</a>.
<p>
<div class="fragment"><pre>00058 {
00059 <a class="code" href="a04558.html#a15">uint</a> <span class="keywordtype">id</span>;
00060
00061 <span class="comment">// Look for a free triangle entry.</span>
00062 <span class="keywordflow">if</span>(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.empty())
00063 {
00064 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.push_back(TTriangleGrid::CIterator());
00065 <span class="keywordtype">id</span>= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.size()-1;
00066 <span class="comment">// enlarge render size.</span>
00067 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr2">_RenderTriangles</a>.resize(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.size() * 3);
00068 }
00069 <span class="keywordflow">else</span>
00070 {
00071 <span class="keywordtype">id</span>= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.back();
00072 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.pop_back();
00073 }
00074
00075 <span class="comment">// Allocate vertices, reusing same ones.</span>
00076 CTriangleId triId;
00077 CVector <a class="code" href="a04223.html#a576">v</a>[3];
00078 <a class="code" href="a04223.html#a576">v</a>[0]= tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>;
00079 <a class="code" href="a04223.html#a576">v</a>[1]= tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>;
00080 <a class="code" href="a04223.html#a576">v</a>[2]= tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>;
00081 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> i=0;i<3;i++)
00082 {
00083 <span class="comment">// Find the vertex in the map.</span>
00084 TVertexMap::iterator it;
00085 it= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.find(v[i]);
00086 <span class="comment">// if not found, allocate it</span>
00087 <span class="keywordflow">if</span>(it==<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.end())
00088 {
00089 triId.Vertex[i]= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd0">allocateVertex</a>(v[i]);
00090 }
00091 <span class="comment">// else get its id</span>
00092 <span class="keywordflow">else</span>
00093 {
00094 triId.Vertex[i]= it->second;
00095 }
00096
00097 <span class="comment">// increment the reference of this vertex</span>
00098 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd1">incVertexRefCount</a>(triId.Vertex[i]);
00099 }
00100
00101 <span class="comment">// Insert the triangle in the quadGrid.</span>
00102 <a class="code" href="a02156.html">CAABBox</a> bb;
00103 bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1902_1">setCenter</a>(tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>);
00104 bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1902_0">extend</a>(tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>);
00105 bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1902_0">extend</a>(tri.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>);
00106 <span class="comment">// insert in QuadGrid and store iterator for future remove</span>
00107 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>[<span class="keywordtype">id</span>]= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz774_2">insert</a>(bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_5">getMin</a>(), bb.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_3">getMax</a>(), triId);
00108
00109 <span class="keywordflow">return</span> <span class="keywordtype">id</span>;
00110 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverd0" doxytag="NL3D::CShadowPolyReceiver::allocateVertex" ></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" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NL3D::CShadowPolyReceiver::allocateVertex </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a03128.html">CVector</a> & </td>
<td class="mdname1" valign="top" nowrap> <em>v</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06374.html#l00134">134</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>.
<p>
References <a class="el" href="a06375.html#l00096">_FreeVertices</a>, <a class="el" href="a06375.html#l00098">_VertexMap</a>, <a class="el" href="a06710.html#l00409">NL3D::CVertexBuffer::setNumVertices()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05646.html#l00237">v</a>.
<p>
Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>.
<p>
<div class="fragment"><pre>00135 {
00136 <a class="code" href="a04558.html#a15">uint</a> <span class="keywordtype">id</span>;
00137
00138 <span class="comment">// Look for a free vertex entry.</span>
00139 <span class="keywordflow">if</span>(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.empty())
00140 {
00141 <span class="comment">// Add the vertex, and init refCount to 0.</span>
00142 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.push_back(v);
00143 <span class="keywordtype">id</span>= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.size()-1;
00144
00145 <span class="comment">// Resize the VBuffer at max possible</span>
00146 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">_VB</a>.setNumVertices(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.size());
00147 }
00148 <span class="keywordflow">else</span>
00149 {
00150 <span class="keywordtype">id</span>= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.back();
00151 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.pop_back();
00152 <span class="comment">// init entry</span>
00153 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>]= <a class="code" href="a04223.html#a576">v</a>;
00154 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>].RefCount= 0;
00155 }
00156
00157 <span class="comment">// insert in the map (should not be here)</span>
00158 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.insert( make_pair(v, <span class="keywordtype">id</span>) );
00159
00160 <span class="keywordflow">return</span> <span class="keywordtype">id</span>;
00161 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceivera2" doxytag="NL3D::CShadowPolyReceiver::getCameraCollision" ></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" nowrap valign="top"> float NL3D::CShadowPolyReceiver::getCameraCollision </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a03128.html">CVector</a> & </td>
<td class="mdname" nowrap> <em>start</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> & </td>
<td class="mdname" nowrap> <em>end</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>float </td>
<td class="mdname" nowrap> <em>radius</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>bool </td>
<td class="mdname" nowrap> <em>cone</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Use the triangles added for camera 3rd person collision return a [0,1] value. 0 => collision at start. 1 => no collision. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>radius</em> </td><td>is the radius of the 'cylinder' </td></tr>
<tr><td valign=top><em>cone</em> </td><td>if true, the object tested is a cone (radius goes to end)</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a06374.html#l00308">308</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>.
<p>
References <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a05533.html#l00057">NL3D::CCameraCol::BBox</a>, <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a05532.html#l00048">NL3D::CCameraCol::build()</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05532.html#l00131">NL3D::CCameraCol::minimizeDistanceAgainstTri()</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, and <a class="el" href="a06375.html#l00103">NL3D::CShadowPolyReceiver::CTriangleId::Vertex</a>.
<p>
Referenced by <a class="el" href="a05862.html#l03714">NL3D::CLandscape::getCameraCollision()</a>.
<p>
<div class="fragment"><pre>00309 {
00310 <span class="comment">// **** build the camera collision info</span>
00311 CCameraCol camCol;
00312 camCol.build(start, end, radius, cone);
00313
00314 <span class="comment">// select with quadGrid</span>
00315 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(camCol.BBox.getMin(), camCol.BBox.getMax());
00316
00317 <span class="comment">// **** For all triangles, test if intersect the camera collision</span>
00318 TTriangleGrid::CIterator it;
00319 <span class="keywordtype">float</span> sqrMinDist= FLT_MAX;
00320 <span class="keywordflow">for</span>(it=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();it!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();it++)
00321 {
00322 CTriangleId &triId= *it;
00323 camCol.minimizeDistanceAgainstTri(
00324 _Vertices[triId.Vertex[0]],
00325 _Vertices[triId.Vertex[1]],
00326 _Vertices[triId.Vertex[2]],
00327 sqrMinDist);
00328 }
00329
00330 <span class="comment">// **** return the collision found, between [0,1]</span>
00331 <span class="keywordflow">if</span>(sqrMinDist == FLT_MAX)
00332 <span class="keywordflow">return</span> 1;
00333 <span class="keywordflow">else</span>
00334 {
00335 <span class="keywordtype">float</span> f= 1;
00336 <span class="keywordtype">float</span> d= (end-start).norm();
00337 <span class="keywordflow">if</span>(d>0)
00338 {
00339 f= sqrtf(sqrMinDist) / d;
00340 f= <a class="code" href="a04061.html#a0">min</a>(f, 1.f);
00341 }
00342 <span class="keywordflow">return</span> f;
00343 }
00344
00345 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverd1" doxytag="NL3D::CShadowPolyReceiver::incVertexRefCount" ></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" nowrap valign="top"> void NL3D::CShadowPolyReceiver::incVertexRefCount </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>id</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06374.html#l00183">183</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>.
<p>
References <a class="el" href="a06375.html#l00046">NL3D_SPR_MAX_REF_COUNT</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>.
<p>
<div class="fragment"><pre>00184 {
00185 <a class="code" href="a04199.html#a6">nlassert</a>(<span class="keywordtype">id</span><<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.size());
00186 <a class="code" href="a04199.html#a6">nlassert</a>(_Vertices[<span class="keywordtype">id</span>].RefCount < NL3D_SPR_MAX_REF_COUNT);
00187 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>].RefCount++;
00188 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverd2" doxytag="NL3D::CShadowPolyReceiver::releaseVertex" ></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" nowrap valign="top"> void NL3D::CShadowPolyReceiver::releaseVertex </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>id</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [private]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06374.html#l00164">164</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>.
<p>
References <a class="el" href="a06375.html#l00096">_FreeVertices</a>, <a class="el" href="a06375.html#l00098">_VertexMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
Referenced by <a class="el" href="a06374.html#l00113">removeTriangle()</a>.
<p>
<div class="fragment"><pre>00165 {
00166 <a class="code" href="a04199.html#a6">nlassert</a>(<span class="keywordtype">id</span><<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>.size());
00167 <span class="comment">// dec ref</span>
00168 <a class="code" href="a04199.html#a6">nlassert</a>(_Vertices[<span class="keywordtype">id</span>].RefCount>0);
00169 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>].RefCount--;
00170 <span class="comment">// no more used?</span>
00171 <span class="keywordflow">if</span>(<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[<span class="keywordtype">id</span>].RefCount==0)
00172 {
00173 <span class="comment">// Free it.</span>
00174 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">_FreeVertices</a>.push_back(<span class="keywordtype">id</span>);
00175 <span class="comment">// Remove it from map.</span>
00176 TVertexMap::iterator it= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.find(_Vertices[<span class="keywordtype">id</span>]);
00177 <a class="code" href="a04199.html#a6">nlassert</a>(it!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.end());
00178 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">_VertexMap</a>.erase(it);
00179 }
00180 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceivera3" doxytag="NL3D::CShadowPolyReceiver::removeTriangle" ></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" nowrap valign="top"> void NL3D::CShadowPolyReceiver::removeTriangle </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td>
<td class="mdname1" valign="top" nowrap> <em>id</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
remove a triangle from the poly receiver.
<p>
<p>
Definition at line <a class="el" href="a06374.html#l00113">113</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>.
<p>
References <a class="el" href="a06375.html#l00108">_FreeTriangles</a>, <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a06300.html#l00468">NL3D::CQuadGrid< T >::erase()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06374.html#l00164">releaseVertex()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a06375.html#l00103">NL3D::CShadowPolyReceiver::CTriangleId::Vertex</a>.
<p>
Referenced by <a class="el" href="a05862.html#l03669">NL3D::CLandscape::removeFromShadowPolyReceiver()</a>.
<p>
<div class="fragment"><pre>00114 {
00115 <a class="code" href="a04199.html#a6">nlassert</a>(<span class="keywordtype">id</span><<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>.size());
00116 <span class="comment">// Must not be NULL iterator.</span>
00117 <a class="code" href="a04199.html#a6">nlassert</a>(_Triangles[<span class="keywordtype">id</span>]!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>());
00118
00119 <span class="comment">// Release Vertices</span>
00120 <span class="keyword">const</span> CTriangleId &triId= *<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">_Triangles</a>[<span class="keywordtype">id</span>];
00121 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd2">releaseVertex</a>(triId.Vertex[0]);
00122 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd2">releaseVertex</a>(triId.Vertex[1]);
00123 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverd2">releaseVertex</a>(triId.Vertex[2]);
00124
00125 <span class="comment">// Delete Triangle.</span>
00126 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz774_1">erase</a>(_Triangles[<span class="keywordtype">id</span>]);
00127 _Triangles[<span class="keywordtype">id</span>]= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();
00128 <span class="comment">// Append to free list.</span>
00129 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">_FreeTriangles</a>.push_back(<span class="keywordtype">id</span>);
00130 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceivera4" doxytag="NL3D::CShadowPolyReceiver::render" ></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" nowrap valign="top"> void NL3D::CShadowPolyReceiver::render </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02434.html">IDriver</a> * </td>
<td class="mdname" nowrap> <em>drv</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="a02839.html">CMaterial</a> & </td>
<td class="mdname" nowrap> <em>shadowMat</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="a03370.html">CShadowMap</a> * </td>
<td class="mdname" nowrap> <em>shadowMap</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> & </td>
<td class="mdname" nowrap> <em>casterPos</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> & </td>
<td class="mdname" nowrap> <em>vertDelta</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
clip, and render with a shadow map. Matrix setup should be OK. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>vertDelta</em> </td><td>(for landscape). add this value from vertices before rendering.</td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="a06374.html#l00192">192</a> of file <a class="el" href="a06374.html">shadow_poly_receiver.cpp</a>.
<p>
References <a class="el" href="a06375.html#l00113">_RenderTriangles</a>, <a class="el" href="a06375.html#l00106">_TriangleGrid</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera2">NL3D::IDriver::activeVertexBuffer()</a>, <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a05385.html#l00090">NLMISC::CAABBox::getCenter()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a06371.html#l00074">NL3D::CShadowMap::LocalBoundingBox</a>, <a class="el" href="a06371.html#l00069">NL3D::CShadowMap::LocalClipPlanes</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06375.html#l00043">NL3D_SPR_NUM_CLIP_PLANE</a>, <a class="el" href="a06375.html#l00045">NL3D_SPR_NUM_CLIP_PLANE_MASK</a>, <a class="el" href="a06375.html#l00044">NL3D_SPR_NUM_CLIP_PLANE_SHIFT</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera56">NL3D::IDriver::renderTriangles()</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, <a class="el" href="a05385.html#l00066">NLMISC::CAABBox::setCenter()</a>, <a class="el" href="a05972.html#l00267">NLMISC::CMatrix::setPos()</a>, <a class="el" href="a06711.html#l00524">NL3D::CVertexBuffer::setVertexCoord()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a06375.html#l00103">NL3D::CShadowPolyReceiver::CTriangleId::Vertex</a>.
<p>
Referenced by <a class="el" href="a05862.html#l03681">NL3D::CLandscape::receiveShadowMap()</a>.
<p>
<div class="fragment"><pre>00193 {
00194 <a class="code" href="a04558.html#a15">uint</a> i, j;
00195
00196 <span class="comment">// **** Fill Triangles that are hit by the Caster</span>
00197 <span class="comment">// First select with quadGrid</span>
00198 <a class="code" href="a02156.html">CAABBox</a> worldBB;
00199 worldBB= shadowMap->LocalBoundingBox;
00200 worldBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1902_1">setCenter</a>(worldBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_0">getCenter</a>() + casterPos);
00201 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(worldBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_5">getMin</a>(), worldBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_3">getMax</a>());
00202
00203 <span class="comment">// For all triangles, reset vertices flags.</span>
00204 TTriangleGrid::CIterator it;
00205 <span class="keywordflow">for</span>(it=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();it!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();it++)
00206 {
00207 CTriangleId &triId= *it;
00208 <span class="keywordflow">for</span>(i=0;i<3;i++)
00209 {
00210 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[triId.Vertex[i]].Flags= 0;
00211 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[triId.Vertex[i]].VBIdx= -1;
00212 }
00213 }
00214
00215 <span class="comment">// Copute the world Clip Volume</span>
00216 <span class="keyword">static</span> std::vector<CPlane> worldClipPlanes;
00217 CMatrix worldMat;
00218 <span class="comment">// set -casterPos, because to transform a plane, we must do plane * M-1</span>
00219 worldMat.setPos(-casterPos);
00220 <span class="comment">// Allow max bits of planes clip.</span>
00221 worldClipPlanes.resize(<a class="code" href="a04061.html#a0">min</a>((<a class="code" href="a04558.html#a15">uint</a>)shadowMap->LocalClipPlanes.size(), (<a class="code" href="a04558.html#a15">uint</a>)<a class="code" href="a04952.html#a0">NL3D_SPR_NUM_CLIP_PLANE</a>));
00222 <span class="comment">// Transform into world</span>
00223 <span class="keywordflow">for</span>(i=0;i<worldClipPlanes.size();i++)
00224 {
00225 worldClipPlanes[i]= shadowMap->LocalClipPlanes[i] * worldMat;
00226 }
00227
00228 <span class="comment">// For All triangles, clip them.</span>
00229 <a class="code" href="a04558.html#a15">uint</a> currentTriIdx= 0;
00230 <a class="code" href="a04558.html#a15">uint</a> currentVbIdx= 0;
00231 <span class="keywordflow">for</span>(it=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();it!=<a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">_TriangleGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();it++)
00232 {
00233 CTriangleId &triId= *it;
00234 <a class="code" href="a04558.html#a15">uint</a> triFlag= <a class="code" href="a04952.html#a2">NL3D_SPR_NUM_CLIP_PLANE_MASK</a>;
00235
00236 <span class="comment">// for all vertices, clip them</span>
00237 <span class="keywordflow">for</span>(i=0;i<3;i++)
00238 {
00239 <a class="code" href="a04558.html#a15">uint</a> vid= triId.Vertex[i];
00240 <a class="code" href="a04558.html#a15">uint</a> vertexFlags= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[vid].Flags;
00241
00242 <span class="comment">// if this vertex is still not computed</span>
00243 <span class="keywordflow">if</span>(!vertexFlags)
00244 {
00245 <span class="comment">// For all planes of the Clip Volume, clip this vertex.</span>
00246 <span class="keywordflow">for</span>(j=0;j<worldClipPlanes.size();j++)
00247 {
00248 <span class="comment">// out if in front</span>
00249 <span class="keywordtype">bool</span> out= worldClipPlanes[j]*_Vertices[vid] > 0;
00250
00251 vertexFlags|= ((<a class="code" href="a04558.html#a15">uint</a>)out)<<j;
00252 }
00253
00254 <span class="comment">// add the bit flag to say "computed".</span>
00255 vertexFlags|= <a class="code" href="a04952.html#a1">NL3D_SPR_NUM_CLIP_PLANE_SHIFT</a>;
00256
00257 <span class="comment">// store</span>
00258 _Vertices[vid].Flags= vertexFlags;
00259 }
00260
00261 <span class="comment">// And all vertex bits.</span>
00262 triFlag&= vertexFlags;
00263 }
00264
00265 <span class="comment">// if triangle not clipped, add the triangle</span>
00266 <span class="keywordflow">if</span>( (triFlag & <a class="code" href="a04952.html#a2">NL3D_SPR_NUM_CLIP_PLANE_MASK</a>)==0 )
00267 {
00268 <span class="comment">// Add the 3 vertices to the VB, and to the index buffer.</span>
00269 <span class="keywordflow">for</span>(i=0;i<3;i++)
00270 {
00271 <a class="code" href="a04558.html#a15">uint</a> vid= triId.Vertex[i];
00272 <a class="code" href="a04558.html#a14">sint</a> vbId= <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">_Vertices</a>[vid].VBIdx;
00273
00274 <span class="comment">// if not yet inserted in the VB, do it.</span>
00275 <span class="keywordflow">if</span>(vbId==-1)
00276 {
00277 <span class="comment">// allocate a new place in the VBuffer</span>
00278 vbId= currentVbIdx++;
00279 _Vertices[vid].VBIdx= vbId;
00280 <span class="comment">// set the coord</span>
00281 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">_VB</a>.setVertexCoord(vbId, _Vertices[vid]+vertDelta);
00282 }
00283
00284 <span class="comment">// add the index to the tri list.</span>
00285 <a class="code" href="a03373.html#NL3D_1_1CShadowPolyReceiverr2">_RenderTriangles</a>[currentTriIdx++]= vbId;
00286 }
00287 }
00288 }
00289
00290
00291 <span class="comment">// **** Render</span>
00292 drv->activeVertexBuffer(_VB);
00293 drv->renderTriangles(shadowMat, &_RenderTriangles[0], currentTriIdx/3);
00294 <span class="comment">// TestYoyo. Show in Red triangles selected</span>
00295 <span class="comment">/*static CMaterial tam;</span>
00296 <span class="comment"> tam.initUnlit();</span>
00297 <span class="comment"> tam.setColor(CRGBA(255,0,0,128));</span>
00298 <span class="comment"> tam.setZFunc(CMaterial::always);</span>
00299 <span class="comment"> tam.setZWrite(false);</span>
00300 <span class="comment"> tam.setBlend(true);</span>
00301 <span class="comment"> tam.setBlendFunc(CMaterial::srcalpha, CMaterial::invsrcalpha);</span>
00302 <span class="comment"> tam.setDoubleSided(true);</span>
00303 <span class="comment"> drv->renderTriangles(tam, &_RenderTriangles[0], currentTriIdx/3);*/</span>
00304 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr0" doxytag="NL3D::CShadowPolyReceiver::_FreeTriangles" ></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" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a15">uint</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr0">NL3D::CShadowPolyReceiver::_FreeTriangles</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00108">108</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>.
<p>
Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>, <a class="el" href="a06374.html#l00043">CShadowPolyReceiver()</a>, and <a class="el" href="a06374.html#l00113">removeTriangle()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr1" doxytag="NL3D::CShadowPolyReceiver::_FreeVertices" ></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" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a15">uint</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr1">NL3D::CShadowPolyReceiver::_FreeVertices</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00096">96</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>.
<p>
Referenced by <a class="el" href="a06374.html#l00134">allocateVertex()</a>, <a class="el" href="a06374.html#l00043">CShadowPolyReceiver()</a>, and <a class="el" href="a06374.html#l00164">releaseVertex()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr2" doxytag="NL3D::CShadowPolyReceiver::_RenderTriangles" ></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" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a11">uint32</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr2">NL3D::CShadowPolyReceiver::_RenderTriangles</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00113">113</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>.
<p>
Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>, and <a class="el" href="a06374.html#l00192">render()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr3" doxytag="NL3D::CShadowPolyReceiver::_TriangleGrid" ></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" nowrap valign="top"> <a class="el" href="a03273.html">TTriangleGrid</a> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr3">NL3D::CShadowPolyReceiver::_TriangleGrid</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00106">106</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>.
<p>
Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>, <a class="el" href="a06374.html#l00043">CShadowPolyReceiver()</a>, <a class="el" href="a06374.html#l00308">getCameraCollision()</a>, <a class="el" href="a06374.html#l00113">removeTriangle()</a>, and <a class="el" href="a06374.html#l00192">render()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr4" doxytag="NL3D::CShadowPolyReceiver::_Triangles" ></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" nowrap valign="top"> std::vector<TTriangleGrid::CIterator> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr4">NL3D::CShadowPolyReceiver::_Triangles</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00107">107</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr5" doxytag="NL3D::CShadowPolyReceiver::_VB" ></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" nowrap valign="top"> <a class="el" href="a03692.html">CVertexBuffer</a> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr5">NL3D::CShadowPolyReceiver::_VB</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00112">112</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr6" doxytag="NL3D::CShadowPolyReceiver::_VertexMap" ></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" nowrap valign="top"> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceivery1">TVertexMap</a> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr6">NL3D::CShadowPolyReceiver::_VertexMap</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00098">98</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>.
<p>
Referenced by <a class="el" href="a06374.html#l00057">addTriangle()</a>, <a class="el" href="a06374.html#l00134">allocateVertex()</a>, and <a class="el" href="a06374.html#l00164">releaseVertex()</a>. </td>
</tr>
</table>
<a class="anchor" name="NL3D_1_1CShadowPolyReceiverr7" doxytag="NL3D::CShadowPolyReceiver::_Vertices" ></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" nowrap valign="top"> std::vector<<a class="el" href="a03375.html">CVectorId</a>> <a class="el" href="a03373.html#NL3D_1_1CShadowPolyReceiverr7">NL3D::CShadowPolyReceiver::_Vertices</a><code> [private]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a06375.html#l00095">95</a> of file <a class="el" href="a06375.html">shadow_poly_receiver.h</a>. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a06375.html">shadow_poly_receiver.h</a><li><a class="el" href="a06374.html">shadow_poly_receiver.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 07:43:27 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>
|