aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/water__shape_8cpp-source.html
blob: 961b83b6515639ba1afdc3488e90df4480acbc7e (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
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG  SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

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

<!-- title -->
<TABLE  background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>water_shape.cpp</h1><a href="water__shape_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2000, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
00027 
00028 <font class="preprocessor">#include "<a class="code" href="water__shape_8h.html">3d/water_shape.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="water__model_8h.html">3d/water_model.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="vertex__buffer_8h.html">3d/vertex_buffer.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="texture__bump_8h.html">3d/texture_bump.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="texture__blend_8h.html">3d/texture_blend.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font>
00034 <font class="preprocessor">#include "<a class="code" href="water__pool__manager_8h.html">3d/water_pool_manager.h</a>"</font>
00035 <font class="preprocessor">#include "<a class="code" href="water__height__map_8h.html">3d/water_height_map.h</a>"</font>
00036 <font class="preprocessor">#include &lt;memory&gt;</font>
00037 
00038 
00039 <font class="keyword">namespace </font>NL3D {
00040 
00041 
00042 
00043 
00044 <font class="comment">// globals</font>
00045 
00046 
00047 
00048 <font class="comment">// common start for Water vertex programs</font>
00061 <font class="comment"></font><font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="namespaceNL3D.html#a301">WaterVPStartCode</a> =
00062 <font class="stringliteral">"!!VP1.0\n\</font>
00063 <font class="stringliteral">        ADD R1, c[7], -v[0];                    #r1 = eye - vertex                                                      \n\</font>
00064 <font class="stringliteral">        DP3 R2, R1, R1;                             #r1 = eye - vertex, r2 = (eye - vertex)�    \n\</font>
00065 <font class="stringliteral">        MAX R2, R2, c[16];              # avoid imprecision around 0                            \n\</font>
00066 <font class="stringliteral">        RSQ R2, R2.x;                                   #r1 = eye - vertex, r2 = 1/d(eye, vertex)       \n\</font>
00067 <font class="stringliteral">        RCP R3, R2.x;                                                                                                                           \n\</font>
00068 <font class="stringliteral">        MAD R3, c[6].xxxx, -R3, c[6].yyyy;                                                                                      \n\</font>
00069 <font class="stringliteral">        MAX R3, c[5],   R3;                                                                                                                     \n\</font>
00070 <font class="stringliteral">        MUL R0, R3, v[8];                       #attenuate normal with distance                                 \n\</font>
00071 <font class="stringliteral">        MUL R4.z,   R3, v[0];                   #attenuate height with distance                         \n\</font>
00072 <font class="stringliteral">        MOV R4.xyw, v[0];                                                                                                                       \n\</font>
00073 <font class="stringliteral">        MOV R0.z,  c[4].x;                      #set normal z to 1                                                              \n\</font>
00074 <font class="stringliteral">        DP3 R3.x, R0, R0;                                                                                                                       \n\</font>
00075 <font class="stringliteral">        RSQ R3.x,  R3.x;                                #normalize normal in R3                                         \n\</font>
00076 <font class="stringliteral">        MUL R0,  R0, R3.x;                                                                                                                      \n\</font>
00077 <font class="stringliteral">        DP4 o[HPOS].x, c[0], R4;        #transform vertex in view space                             \n\</font>
00078 <font class="stringliteral">        DP4 o[HPOS].y, c[1], R4;                                                                                                    \n\</font>
00079 <font class="stringliteral">        DP4 o[HPOS].z, c[2], R4;                                                                                                    \n\</font>
00080 <font class="stringliteral">        DP4 o[HPOS].w, c[3], R4;                                                                                                    \n\</font>
00081 <font class="stringliteral">        MUL R1, R1, R2.x;                       #normalize r1, r1 = (eye - vertex).normed   \n\</font>
00082 <font class="stringliteral">        DP4 o[FOGC].x, c[2], R4;            #setup fog                                                              \n\</font>
00083 <font class="stringliteral">"</font>;
00084 
00085 <font class="comment">/*</font>
00086 <font class="comment">const char *WaterVPStartCode =</font>
00087 <font class="comment">"!!VP1.0\n\</font>
00088 <font class="comment">        ADD R1, c[7], -v[0];                    #r1 = eye - vertex                                                      \n\</font>
00089 <font class="comment">        DP3 R2, R1, R1;                             #r1 = eye - vertex, r2 = (eye - vertex)�    \n\</font>
00090 <font class="comment">        MAX R2, R2, c[16];              # avoid imprecision around 0                            \n\</font>
00091 <font class="comment">        RSQ R2, R2.x;                                   #r1 = eye - vertex, r2 = 1/d(eye, vertex)       \n\</font>
00092 <font class="comment">        RCP R3, R2.x;                                                                                                                           \n\</font>
00093 <font class="comment">        MUL R3, c[6], R3;                                                           \n\</font>
00094 <font class="comment">        ADD R3, c[15], -R3;                                                         \n\</font>
00095 <font class="comment">        MAX R3, c[5],   R3;                                                                                                                     \n\</font>
00096 <font class="comment">        MUL R0, R3, v[8];                       #attenuate normal with distance                                 \n\</font>
00097 <font class="comment">        MUL R4.z,   R3, v[0];                   #attenuate height with distance                         \n\</font>
00098 <font class="comment">        MOV R4.xyw, v[0];                                                                                                                       \n\</font>
00099 <font class="comment">        MOV R0.z,  c[4].x;                      #set normal z to 1                                                              \n\</font>
00100 <font class="comment">        DP3 R3.x, R0, R0;                                                                                                                       \n\</font>
00101 <font class="comment">        RSQ R3.x,  R3.x;                                #normalize normal in R3                                         \n\</font>
00102 <font class="comment">        MUL R0,  R0, R3.x;                                                                                                                      \n\</font>
00103 <font class="comment">        DP4 o[HPOS].x, c[0], R4;        #transform vertex in view space                             \n\</font>
00104 <font class="comment">        DP4 o[HPOS].y, c[1], R4;                                                                                                    \n\</font>
00105 <font class="comment">        DP4 o[HPOS].z, c[2], R4;                                                                                                    \n\</font>
00106 <font class="comment">        DP4 o[HPOS].w, c[3], R4;                                                                                                    \n\</font>
00107 <font class="comment">        MUL R1, R1, R2.x;                       #normalize r1, r1 = (eye - vertex).normed   \n\</font>
00108 <font class="comment">        DP4 o[FOGC].x, c[2], -R4;           #setup fog                                                              \n\</font>
00109 <font class="comment">";</font>
00110 <font class="comment">*/</font>
00111 
00114 <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="namespaceNL3D.html#a302">WaterVpBump2LayersCode</a> = <font class="stringliteral">"MUL R3, v[0], c[10];                      #compute bump 0 uv's                    \n\</font>
00115 <font class="stringliteral">                                                   ADD o[TEX0].xy, R3, c[9];                                                                                            \n\</font>
00116 <font class="stringliteral">                                                   MUL R3, v[0], c[12];                 #compute bump 1 uv's                                            \n\</font>
00117 <font class="stringliteral">                                                   ADD o[TEX1].xy, R3, c[11];                                                                                           \n\</font>
00118 <font class="stringliteral">                                                   DP3 R2.x, R1, R0;                                                                                                            \n\</font>
00119 <font class="stringliteral">                                                   MUL R0, R0, R2.x;                                                                                                            \n\</font>
00120 <font class="stringliteral">                                                   ADD R2, R0, R0;                                                                                                                      \n\</font>
00121 <font class="stringliteral">                                                   ADD R0, R2, -R1;                             #compute reflection vector                                      \n\</font>
00122 <font class="stringliteral">                                                   MAD o[TEX2].xy, R0, c[8], c[8];                                                                                      \n\</font>
00123 <font class="stringliteral">                                                   "</font>;
00124 
00127 <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="namespaceNL3D.html#a303">WaterVpBump1LayersCode</a> = <font class="stringliteral">"MUL R3, v[0], c[12];                      #compute bump 1 uv's                            \n\</font>
00128 <font class="stringliteral">                                                                          ADD o[TEX0].xy, R3, c[11];                                                                            \n\</font>
00129 <font class="stringliteral">                                                                          DP3 R2.x, R1, R0;                                                                                                     \n\</font>
00130 <font class="stringliteral">                                                                          MUL R0, R0, R2.x;                                                                                                     \n\</font>
00131 <font class="stringliteral">                                                                          ADD R2, R0, R0;                                                                                                       \n\</font>
00132 <font class="stringliteral">                                                                          ADD R0, R2, -R1;                              #compute reflection vector                      \n\</font>
00133 <font class="stringliteral">                                                                          MAD o[TEX1].xy, R0, c[8], c[8];                                                                       \n\</font>
00134 <font class="stringliteral">                                                                          "</font>;
00135 
00138 <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="namespaceNL3D.html#a304">WaterVpDiffuseMapStage3Code</a> = <font class="stringliteral">"DP4 o[TEX3].x, R4, c[13]; #compute uv for diffuse texture                                    \n\</font>
00139 <font class="stringliteral">                                                                               DP4 o[TEX3].y, R4, c[14];                                                                                                        \n\</font>
00140 <font class="stringliteral">                                                                          "</font>;
00141 
00144 <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="namespaceNL3D.html#a305">WaterVpDiffuseMapStage2Code</a> = <font class="stringliteral">"DP4 o[TEX2].x, R4, c[13]; #compute uv for diffuse texture                                    \n\</font>
00145 <font class="stringliteral">                                                                               DP4 o[TEX2].y, R4, c[14];                                                                                                        \n\</font>
00146 <font class="stringliteral">                                                                          "</font>;
00147 
00150 <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="namespaceNL3D.html#a306">WaterVpDiffuseMapStage1Code</a> = <font class="stringliteral">"DP4 o[TEX1].x, R4, c[13]; #compute uv for diffuse texture                                    \n\</font>
00151 <font class="stringliteral">                                                                               DP4 o[TEX1].y, R4, c[14];                                                                                                        \n\</font>
00152 <font class="stringliteral">                                                                          "</font>;
00153 
00154 
00155 
00156 <font class="comment">// Envmap is setup in texture 0, no bump is used</font>
00157 <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="namespaceNL3D.html#a307">WaterVpNoBumpCode</a> = <font class="stringliteral">"  DP3 R2.x, R1, R0;                            #project view vector on normal for symetry      \n\</font>
00158 <font class="stringliteral">                                                                                  MUL R0, R0, R2.x;                                                                                                                     \n\</font>
00159 <font class="stringliteral">                                                                                  ADD R2, R0, R0;                                                                                                                       \n\</font>
00160 <font class="stringliteral">                                                                                  ADD R0, R2, -R1;                              #compute reflection vector                                      \n\</font>
00161 <font class="stringliteral">                                                                                  MAD o[TEX0].xy, R0, c[8], c[8];                                                                                       \n\</font>
00162 <font class="stringliteral">                                                                                  DP4 o[FOGC].x, c[2], -R4;     #setup fog                                                                          \n\</font>
00163 <font class="stringliteral">                                                                                  "</font>;
00164 
00165 
00166 <font class="comment">// static members</font>
00167 
<a name="l00168"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r0">00168</a> uint32                                                                  CWaterShape::_XScreenGridSize = 40;
<a name="l00169"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r1">00169</a> uint32                                                                  CWaterShape::_YScreenGridSize = 40;
<a name="l00170"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r3">00170</a> uint32                                                                  CWaterShape::_XGridBorder = 4;
<a name="l00171"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r4">00171</a> uint32                                                                  CWaterShape::_YGridBorder = 4;
<a name="l00172"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r2">00172</a> uint32                                                                  CWaterShape::_MaxGridSize;
<a name="l00173"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r5">00173</a> CVertexBuffer                                                   CWaterShape::_VB;
<a name="l00174"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r6">00174</a> std::vector&lt;uint32&gt;                                             CWaterShape::_IBUpDown;
<a name="l00175"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r7">00175</a> std::vector&lt;uint32&gt;                                             CWaterShape::_IBDownUp;
00176 <font class="comment">//NLMISC::CSmartPtr&lt;IDriver&gt;                            CWaterShape::_Driver;</font>
<a name="l00177"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r8">00177</a> <font class="keywordtype">bool</font>                                                                    CWaterShape::_GridSizeTouched = <font class="keyword">true</font>;
<a name="l00178"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r9">00178</a> std::auto_ptr&lt;CVertexProgram&gt;                   CWaterShape::_VertexProgramBump1;
<a name="l00179"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r10">00179</a> std::auto_ptr&lt;CVertexProgram&gt;                   CWaterShape::_VertexProgramBump2;
<a name="l00180"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r11">00180</a> std::auto_ptr&lt;CVertexProgram&gt;                   CWaterShape::_VertexProgramBump1Diffuse;
<a name="l00181"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r12">00181</a> std::auto_ptr&lt;CVertexProgram&gt;                   CWaterShape::_VertexProgramBump2Diffuse;
<a name="l00182"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r13">00182</a> std::auto_ptr&lt;CVertexProgram&gt;                   CWaterShape::_VertexProgramNoBump;
<a name="l00183"></a><a class="code" href="classNL3D_1_1CWaterShape.html#r14">00183</a> std::auto_ptr&lt;CVertexProgram&gt;                   CWaterShape::_VertexProgramNoBumpDiffuse;
00184 
00185 
00188 <font class="keyword">static</font> CVertexProgram *<a class="code" href="namespaceNL3D.html#a481">BuildWaterVP</a>(<font class="keywordtype">bool</font> diffuseMap, <font class="keywordtype">bool</font> bumpMap, <font class="keywordtype">bool</font> use2BumpMap)
00189 {
00190         std::string vp = <a class="code" href="namespaceNL3D.html#a301">WaterVPStartCode</a>;
00191         <font class="keywordflow">if</font> (bumpMap &amp;&amp; use2BumpMap)
00192         { 
00193                 vp += <a class="code" href="namespaceNL3D.html#a302">WaterVpBump2LayersCode</a>;
00194                 <font class="keywordflow">if</font> (diffuseMap) vp += <a class="code" href="namespaceNL3D.html#a304">WaterVpDiffuseMapStage3Code</a>;
00195         }
00196         <font class="keywordflow">else</font>
00197         <font class="keywordflow">if</font> (bumpMap)
00198         {
00199                 vp += <a class="code" href="namespaceNL3D.html#a302">WaterVpBump2LayersCode</a>;
00200                 <font class="keywordflow">if</font> (diffuseMap) vp += <a class="code" href="namespaceNL3D.html#a305">WaterVpDiffuseMapStage2Code</a>;
00201         }
00202         <font class="keywordflow">else</font>
00203         {
00204                 vp += <a class="code" href="namespaceNL3D.html#a307">WaterVpNoBumpCode</a>;
00205                 <font class="keywordflow">if</font> (diffuseMap) vp += <a class="code" href="namespaceNL3D.html#a306">WaterVpDiffuseMapStage1Code</a>;
00206         }
00207 
00208         vp += <font class="stringliteral">"\nEND"</font>;
00209         <font class="keywordflow">return</font> <font class="keyword">new</font> CVertexProgram(vp.c_str());
00210 }
00211 
00212 
00213 
00214 <font class="comment">//============================================</font>
00215 <font class="comment">/*</font>
00216 <font class="comment"> * Constructor</font>
00217 <font class="comment"> */</font>
<a name="l00218"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z912_0">00218</a> CWaterShape::CWaterShape() :  _WaterPoolID(0), _TransitionRatio(0.6f), _WaveHeightFactor(3), _ComputeLightmap(false)
00219 {
00220         <a class="code" href="classNL3D_1_1CWaterShape.html#o11">_DefaultPos</a>.setValue(<a class="code" href="classNLMISC_1_1CVector.html#p0">NLMISC::CVector::Null</a>);
00221         <a class="code" href="classNL3D_1_1CWaterShape.html#o12">_DefaultScale</a>.setValue(<a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(1, 1, 1));
00222         <a class="code" href="classNL3D_1_1CWaterShape.html#o13">_DefaultRotQuat</a>.setValue(CQuat::Identity);
00223 
00224         <font class="keywordflow">for</font> (sint k = 0; k &lt; 2; ++k)
00225         {
00226                 <a class="code" href="classNL3D_1_1CWaterShape.html#o6">_HeightMapScale</a>[k].<a class="code" href="classNLMISC_1_1CVector2f.html#z340_0">set</a>(1, 1);
00227                 <a class="code" href="classNL3D_1_1CWaterShape.html#o7">_HeightMapSpeed</a>[k].<a class="code" href="classNLMISC_1_1CVector2f.html#z340_0">set</a>(0, 0);
00228                 <a class="code" href="classNL3D_1_1CWaterShape.html#o17">_HeightMapTouch</a>[k] = <font class="keyword">true</font>;
00229         }
00230         <a class="code" href="classNL3D_1_1CWaterShape.html#o8">_ColorMapMatColumn0</a>.<a class="code" href="classNLMISC_1_1CVector2f.html#z340_0">set</a>(1, 0);
00231         <a class="code" href="classNL3D_1_1CWaterShape.html#o9">_ColorMapMatColumn1</a>.<a class="code" href="classNLMISC_1_1CVector2f.html#z340_0">set</a>(0, 1);
00232         <a class="code" href="classNL3D_1_1CWaterShape.html#o10">_ColorMapMatPos</a>.<a class="code" href="classNLMISC_1_1CVector2f.html#z340_0">set</a>(0, 0);
00233 }
00234 
00235 <font class="comment">//============================================</font>
00236 
<a name="l00237"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z912_1">00237</a> CWaterShape::~CWaterShape()
00238 {
00239         <font class="keywordflow">if</font> (
00240                 (<a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[0] &amp;&amp; dynamic_cast&lt;CTextureBlend *&gt;((ITexture *) <a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[0]))
00241                 || (<a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[1] &amp;&amp; dynamic_cast&lt;CTextureBlend *&gt;((ITexture *) <a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[1]))
00242                 )
00243         {
00244                 <a class="code" href="namespaceNL3D.html#a480">GetWaterPoolManager</a>().unRegisterWaterShape(<font class="keyword">this</font>);               
00245         }
00246 }
00247 
00248 <font class="comment">//============================================</font>
00249 
<a name="l00250"></a><a class="code" href="classNL3D_1_1CWaterShape.html#f0">00250</a> <font class="keywordtype">void</font> CWaterShape::initVertexProgram()
00251 {       
00252         <font class="keyword">static</font> <font class="keywordtype">bool</font> created = <font class="keyword">false</font>;
00253         <font class="keywordflow">if</font> (!created)
00254         {
00255 
00256                 <a class="code" href="classNL3D_1_1CWaterShape.html#r9">_VertexProgramBump1</a> = std::auto_ptr&lt;CVertexProgram&gt;(<a class="code" href="namespaceNL3D.html#a481">BuildWaterVP</a>(<font class="keyword">false</font>, <font class="keyword">true</font>, <font class="keyword">false</font>));
00257                 <a class="code" href="classNL3D_1_1CWaterShape.html#r10">_VertexProgramBump2</a> = std::auto_ptr&lt;CVertexProgram&gt;(<a class="code" href="namespaceNL3D.html#a481">BuildWaterVP</a>(<font class="keyword">false</font>, <font class="keyword">true</font>, <font class="keyword">true</font>));
00258 
00259                 <a class="code" href="classNL3D_1_1CWaterShape.html#r11">_VertexProgramBump1Diffuse</a> = std::auto_ptr&lt;CVertexProgram&gt;(<a class="code" href="namespaceNL3D.html#a481">BuildWaterVP</a>(<font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">false</font>));
00260                 <a class="code" href="classNL3D_1_1CWaterShape.html#r12">_VertexProgramBump2Diffuse</a> = std::auto_ptr&lt;CVertexProgram&gt;(<a class="code" href="namespaceNL3D.html#a481">BuildWaterVP</a>(<font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>));
00261 
00262                 <a class="code" href="classNL3D_1_1CWaterShape.html#r13">_VertexProgramNoBump</a> = std::auto_ptr&lt;CVertexProgram&gt;(<a class="code" href="namespaceNL3D.html#a481">BuildWaterVP</a>(<font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>));
00263                 <a class="code" href="classNL3D_1_1CWaterShape.html#r14">_VertexProgramNoBumpDiffuse</a> = std::auto_ptr&lt;CVertexProgram&gt;(<a class="code" href="namespaceNL3D.html#a481">BuildWaterVP</a>(<font class="keyword">true</font>, <font class="keyword">false</font>, <font class="keyword">false</font>));
00264                 created = <font class="keyword">true</font>;
00265         }
00266 }
00267 
00268 
00269 <font class="comment">//============================================</font>
00270 
<a name="l00271"></a><a class="code" href="classNL3D_1_1CWaterShape.html#f1">00271</a> <font class="keywordtype">void</font> CWaterShape::setupVertexBuffer()
00272 {
00273         <font class="keyword">const</font> uint rotLength = (uint) ::ceilf(::sqrtf((float) ((<a class="code" href="classNL3D_1_1CWaterShape.html#r0">_XScreenGridSize</a> &gt;&gt; 1) * (<a class="code" href="classNL3D_1_1CWaterShape.html#r0">_XScreenGridSize</a> &gt;&gt; 1)
00274                                                                   + (<a class="code" href="classNL3D_1_1CWaterShape.html#r1">_YScreenGridSize</a> &gt;&gt; 1) * (<a class="code" href="classNL3D_1_1CWaterShape.html#r1">_YScreenGridSize</a> &gt;&gt; 1))));
00275         <a class="code" href="classNL3D_1_1CWaterShape.html#r2">_MaxGridSize</a> = 2 * rotLength;
00276         <font class="keyword">const</font> uint <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> =  <a class="code" href="classNL3D_1_1CWaterShape.html#r2">_MaxGridSize</a> + 2 * <a class="code" href="classNL3D_1_1CWaterShape.html#r3">_XGridBorder</a>;
00277 
00278         <a class="code" href="classNL3D_1_1CWaterShape.html#r5">_VB</a>.clearValueEx();
00279         <a class="code" href="classNL3D_1_1CWaterShape.html#r5">_VB</a>.addValueEx (<a class="code" href="namespaceNL3D.html#a308">WATER_VB_POS</a>, CVertexBuffer::Float3);
00280         <a class="code" href="classNL3D_1_1CWaterShape.html#r5">_VB</a>.addValueEx (<a class="code" href="namespaceNL3D.html#a309">WATER_VB_DX</a>, CVertexBuffer::Float2);    
00281 
00282         <a class="code" href="classNL3D_1_1CWaterShape.html#r5">_VB</a>.initEx();
00283         <a class="code" href="classNL3D_1_1CWaterShape.html#r5">_VB</a>.setNumVertices((<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> + 1) * 2);
00284         
00285 
00286         
00287         uint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
00288 
00289         <font class="comment">// setup each index buffer</font>
00290         <font class="comment">// We need 2 vb, because, each time 2 lines of the vertex buffer are filled, we start at the beginning again</font>
00291         <font class="comment">// So we need 1 vb for triangle drawn up to down, and one other for triangle drawn down to top  </font>
00292 
00293         <a class="code" href="classNL3D_1_1CWaterShape.html#r6">_IBUpDown</a>.resize(6 * <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>);        
00294         <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = 0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &lt; <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>; ++<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)
00295         {
00296                 <a class="code" href="classNL3D_1_1CWaterShape.html#r6">_IBUpDown</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>      ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
00297                 <a class="code" href="classNL3D_1_1CWaterShape.html#r6">_IBUpDown</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 1 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> + 1 + (<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> + 1);
00298                 <a class="code" href="classNL3D_1_1CWaterShape.html#r6">_IBUpDown</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 2 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> + 1;
00299 
00300                 <a class="code" href="classNL3D_1_1CWaterShape.html#r6">_IBUpDown</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 3 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
00301                 <a class="code" href="classNL3D_1_1CWaterShape.html#r6">_IBUpDown</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 4 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> + 1 + (<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> + 1);
00302                 <a class="code" href="classNL3D_1_1CWaterShape.html#r6">_IBUpDown</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 5 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>     + (<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> + 1);
00303 
00304         }
00305 
00306         <a class="code" href="classNL3D_1_1CWaterShape.html#r7">_IBDownUp</a>.resize(6 * <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>);
00307         <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = 0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &lt; <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>; ++<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)
00308         {
00309                 <a class="code" href="classNL3D_1_1CWaterShape.html#r7">_IBDownUp</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>      ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
00310                 <a class="code" href="classNL3D_1_1CWaterShape.html#r7">_IBDownUp</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 1 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> + 1;
00311                 <a class="code" href="classNL3D_1_1CWaterShape.html#r7">_IBDownUp</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 2 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> + 1 + (<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> + 1);
00312 
00313                 <a class="code" href="classNL3D_1_1CWaterShape.html#r7">_IBDownUp</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 3 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
00314                 <a class="code" href="classNL3D_1_1CWaterShape.html#r7">_IBDownUp</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 4 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>     + (<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> + 1);
00315                 <a class="code" href="classNL3D_1_1CWaterShape.html#r7">_IBDownUp</a> [ 6 * <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>  + 5 ] = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> + 1 + (<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> + 1);
00316 
00317         }
00318 
00319         <a class="code" href="classNL3D_1_1CWaterShape.html#r8">_GridSizeTouched</a> = <font class="keyword">false</font>;
00320 }
00321 
00322 <font class="comment">//============================================</font>
00323 
<a name="l00324"></a><a class="code" href="classNL3D_1_1CWaterShape.html#a1">00324</a> CTransformShape         *CWaterShape::createInstance(CScene &amp;scene)
00325 {
00326         <a class="code" href="classNL3D_1_1CWaterShape.html#l0">CWaterModel</a> *wm = NLMISC::safe_cast&lt;CWaterModel *&gt;(scene.createModel(<a class="code" href="namespaceNL3D.html#a310">WaterModelClassId</a>) );
00327         wm-&gt;Shape = <font class="keyword">this</font>;
00328         <font class="comment">// set default pos &amp; scale</font>
00329         wm-&gt;ITransformable::setPos( ((<a class="code" href="namespaceNL3D.html#a14">CAnimatedValueVector</a>&amp;)<a class="code" href="classNL3D_1_1CWaterShape.html#o11">_DefaultPos</a>.getValue()).Value  );
00330         wm-&gt;ITransformable::setScale( ((<a class="code" href="namespaceNL3D.html#a14">CAnimatedValueVector</a>&amp;)<a class="code" href="classNL3D_1_1CWaterShape.html#o12">_DefaultScale</a>.getValue()).Value  );
00331         wm-&gt;ITransformable::setRotQuat( ((<a class="code" href="namespaceNL3D.html#a16">CAnimatedValueQuat</a>&amp;)<a class="code" href="classNL3D_1_1CWaterShape.html#o13">_DefaultRotQuat</a>.getValue()).Value  );
00332         wm-&gt;_Scene = &amp;scene;
00333         <font class="keywordflow">return</font> wm;
00334 }
00335 
00336 <font class="comment">//============================================</font>
00337 
<a name="l00338"></a><a class="code" href="classNL3D_1_1CWaterShape.html#a5">00338</a> <font class="keywordtype">float</font> CWaterShape::getNumTriangles (<font class="keywordtype">float</font> distance)
00339 {
00340         <font class="comment">// TODO</font>
00341         <font class="keywordflow">return</font> 0;
00342 }
00343 
00344 <font class="comment">//============================================</font>
00345 
<a name="l00346"></a><a class="code" href="classNL3D_1_1CWaterShape.html#a6">00346</a> <font class="keywordtype">void</font> CWaterShape::flushTextures (IDriver &amp;driver)
00347 {
00348         <font class="comment">// Test if bump maps are supported by driver before to flush them.      </font>
00349         <font class="keywordflow">if</font> (
00350                 (driver.supportTextureShaders() &amp;&amp; driver.isTextureAddrModeSupported(CMaterial::OffsetTexture))
00351                 || driver.supportEMBM()
00352            )
00353         {
00354                 <font class="keywordflow">for</font> (uint k = 0; k &lt; 2; ++k)
00355                 {
00356                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k] != NULL)
00357                                 driver.setupTexture(*<a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k]);
00358                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[k] != NULL)
00359                                 driver.setupTexture(*<a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[k]);               
00360                 }
00361         }
00362         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CWaterShape.html#o5">_ColorMap</a> != NULL)
00363                 driver.setupTexture(*<a class="code" href="classNL3D_1_1CWaterShape.html#o5">_ColorMap</a>);
00364 }
00365 
00366 <font class="comment">//============================================</font>
00367 
<a name="l00368"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z913_7">00368</a> <font class="keywordtype">void</font>    CWaterShape::setScreenGridSize(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>)
00369 {
00370         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &gt; 0 &amp;&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> &gt; 0);
00371         <a class="code" href="classNL3D_1_1CWaterShape.html#r0">_XScreenGridSize</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;   
00372         <a class="code" href="classNL3D_1_1CWaterShape.html#r1">_YScreenGridSize</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
00373         <a class="code" href="classNL3D_1_1CWaterShape.html#r8">_GridSizeTouched</a> = <font class="keyword">true</font>;
00374 }
00375 
00376 <font class="comment">//============================================</font>
00377 
<a name="l00378"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z913_8">00378</a> <font class="keywordtype">void</font>            CWaterShape::setGridBorderSize(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>)
00379 {
00380         <a class="code" href="classNL3D_1_1CWaterShape.html#r3">_XGridBorder</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
00381         <a class="code" href="classNL3D_1_1CWaterShape.html#r4">_YGridBorder</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
00382         <a class="code" href="classNL3D_1_1CWaterShape.html#r8">_GridSizeTouched</a> = <font class="keyword">true</font>;
00383 }
00384 
00385 <font class="comment">//============================================</font>
00386 
<a name="l00387"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z913_2">00387</a> <font class="keywordtype">void</font> CWaterShape::setShape(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CPolygon2D.html">NLMISC::CPolygon2D</a> &amp;poly)
00388 {
00389         <a class="code" href="debug_8h.html#a6">nlassert</a>(poly.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>.size() != 0); <font class="comment">// empty poly not allowed</font>
00390         <a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a> = poly;
00391         <a class="code" href="classNL3D_1_1CWaterShape.html#c0">computeBBox</a>();
00392 }
00393 
00394 <font class="comment">//============================================</font>
00395 
<a name="l00396"></a><a class="code" href="classNL3D_1_1CWaterShape.html#c0">00396</a> <font class="keywordtype">void</font> CWaterShape::computeBBox()
00397 {
00398         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a>.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>.size() != 0);
00399         <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> <a class="code" href="bit__set_8cpp.html#a0">min</a>, max;
00400         min = max = <a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a>.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>[0];
00401         <font class="keywordflow">for</font> (uint k = 1; k &lt; <a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a>.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>.size(); ++k)
00402         {
00403                 min.<a class="code" href="classNLMISC_1_1CVector2f.html#z340_4">minof</a>(min, <a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a>.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>[k]);
00404                 max.<a class="code" href="classNLMISC_1_1CVector2f.html#z340_5">maxof</a>(max, <a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a>.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>[k]);
00405         }
00406         <a class="code" href="classNL3D_1_1CWaterShape.html#o0">_BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_3">setMinMax</a>(CVector(min.<a class="code" href="classNLMISC_1_1CVector2f.html#m0">x</a>, min.<a class="code" href="classNLMISC_1_1CVector2f.html#m1">y</a>, 0), CVector(max.<a class="code" href="classNLMISC_1_1CVector2f.html#m0">x</a>, max.<a class="code" href="classNLMISC_1_1CVector2f.html#m1">y</a>, 0));
00407         <font class="comment">/* nlinfo("center x = %f, y = %f, z = %f", _BBox.getCenter().x, _BBox.getCenter().y, _BBox.getCenter().z);</font>
00408 <font class="comment">        nlinfo("halsize x = %f, y = %f, z = %f", _BBox.getHalfSize().x, _BBox.getHalfSize().y, _BBox.getHalfSize().z); */</font>
00409 }
00410 
00411 <font class="comment">//============================================</font>
00412 
<a name="l00413"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_3">00413</a> <font class="keywordtype">void</font>                            CWaterShape::setHeightMap(uint k, ITexture *hm)
00414 {
00415         <a class="code" href="debug_8h.html#a6">nlassert</a>(k &lt; 2);        
00416         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k])
00417         {
00418                 <a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k] = <font class="keyword">new</font> CTextureBump;
00419         }
00420         static_cast&lt;CTextureBump *&gt;( (ITexture *) <a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k])-&gt;forceNormalize(<font class="keyword">true</font>);
00421         static_cast&lt;CTextureBump *&gt;( (ITexture *) <a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k])-&gt;setHeightMap(hm);
00422         <a class="code" href="classNL3D_1_1CWaterShape.html#o17">_HeightMapTouch</a>[k] = <font class="keyword">true</font>; <font class="comment">// must recompute normalization factor</font>
00423 }
00424 
00425 <font class="comment">//============================================</font>
00426 
<a name="l00427"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_4">00427</a> ITexture                        *CWaterShape::getHeightMap(uint k)
00428 {
00429         <a class="code" href="debug_8h.html#a6">nlassert</a>(k &lt; 2);
00430         <font class="keywordflow">return</font> ((CTextureBump *) (ITexture *) <a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k] )-&gt;getHeightMap();
00431 }
00432 
00433 <font class="comment">//============================================</font>
00434 
<a name="l00435"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_5">00435</a> <font class="keyword">const</font> ITexture          *CWaterShape::getHeightMap(uint k)<font class="keyword"> const</font>
00436 <font class="keyword"></font>{
00437         <a class="code" href="debug_8h.html#a6">nlassert</a>(k &lt; 2);
00438         <font class="keywordflow">return</font> ((CTextureBump *) (ITexture *) <a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k] )-&gt;getHeightMap();
00439 }
00440 
00441 <font class="comment">//============================================</font>
00442 
<a name="l00443"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z912_2">00443</a> <font class="keywordtype">void</font> CWaterShape::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
00444 {
00445         sint ver = f.serialVersion(2);
00446         <font class="comment">// serial 'shape' </font>
00447         f.serial(_Poly);
00448         <font class="comment">// serial heightMap identifier</font>
00449         f.serial(_WaterPoolID);
00450         <font class="comment">//serial maps</font>
00451         ITexture *map = NULL;   
00452         <font class="keywordflow">if</font> (f.isReading())
00453         {
00454                 f.serialPolyPtr(map); _EnvMap[0] = map;
00455                 f.serialPolyPtr(map); _EnvMap[1] = map;
00456                 f.serialPolyPtr(map); _BumpMap[0] = map;
00457                 f.serialPolyPtr(map); _BumpMap[1] = map;
00458                 f.serialPolyPtr(map); _ColorMap = map;
00459                 computeBBox();
00460         }
00461         <font class="keywordflow">else</font>
00462         {
00463                 map = _EnvMap[0]; f.serialPolyPtr(map);
00464                 map = _EnvMap[1]; f.serialPolyPtr(map);
00465                 map = _BumpMap[0]; f.serialPolyPtr(map);
00466                 map = _BumpMap[1]; f.serialPolyPtr(map);
00467                 map = _ColorMap; f.serialPolyPtr(map);  
00468         }
00469 
00470         f.serial(_HeightMapScale[0], _HeightMapScale[1],
00471                          _HeightMapSpeed[0], _HeightMapSpeed[1]);
00472 
00473         f.serial(_ColorMapMatColumn0, _ColorMapMatColumn1, _ColorMapMatPos);    
00474 
00475         <font class="comment">// serial default tracks</font>
00476         f.serial(_DefaultPos);
00477         f.serial(_DefaultScale);
00478         f.serial(_DefaultRotQuat);
00479 
00480         f.serial(_TransitionRatio);     
00481 
00482         f.serial(_WaveHeightFactor);
00483 
00484         <font class="keywordflow">if</font> (ver &gt;= 1)
00485                 f.serial (_ComputeLightmap);
00486 
00487         <font class="keywordflow">if</font> (ver &gt;= 2)
00488                 f.serial (_DistMax);
00489 }
00490 
00491 <font class="comment">//============================================</font>
00492 
<a name="l00493"></a><a class="code" href="classNL3D_1_1CWaterShape.html#a2">00493</a> <font class="keywordtype">bool</font> CWaterShape::clip(<font class="keyword">const</font> std::vector&lt;CPlane&gt;        &amp;pyramid, <font class="keyword">const</font> CMatrix &amp;worldMatrix)
00494 {       
00495         <font class="keywordflow">for</font> (uint k = 0; k &lt; pyramid.size(); ++k)
00496         {
00497                 <font class="keywordflow">if</font> (! <a class="code" href="classNL3D_1_1CWaterShape.html#o0">_BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z265_1">clipBack</a>(pyramid[k] * worldMatrix)) <font class="keywordflow">return</font> <font class="keyword">false</font>;
00498         }
00499         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00500 }
00501 
00502 <font class="comment">//============================================</font>
00503 
<a name="l00504"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_6">00504</a> <font class="keywordtype">void</font>                            CWaterShape::setHeightMapScale(uint k, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> &amp;scale)
00505 {
00506         <a class="code" href="debug_8h.html#a6">nlassert</a>(k &lt; 2);
00507         <a class="code" href="classNL3D_1_1CWaterShape.html#o6">_HeightMapScale</a>[k] = scale;
00508 }
00509 
00510 <font class="comment">//============================================</font>
00511 
<a name="l00512"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_7">00512</a> <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a>       CWaterShape::getHeightMapScale(uint k)<font class="keyword"> const</font>
00513 <font class="keyword"></font>{
00514         <a class="code" href="debug_8h.html#a6">nlassert</a>(k &lt; 2);
00515         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CWaterShape.html#o6">_HeightMapScale</a>[k];
00516 }
00517 
00518 <font class="comment">//============================================</font>
00519 
<a name="l00520"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_8">00520</a> <font class="keywordtype">void</font>                        CWaterShape::setHeightMapSpeed(uint k, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> &amp;speed)
00521 {
00522         <a class="code" href="debug_8h.html#a6">nlassert</a>(k &lt; 2);
00523         <a class="code" href="classNL3D_1_1CWaterShape.html#o7">_HeightMapSpeed</a>[k] = speed;
00524 }
00525 
00526 <font class="comment">//============================================</font>
00527 
<a name="l00528"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_9">00528</a> <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a>   CWaterShape::getHeightMapSpeed(uint k)<font class="keyword"> const</font>
00529 <font class="keyword"></font>{
00530         <a class="code" href="debug_8h.html#a6">nlassert</a>(k &lt; 2);
00531         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CWaterShape.html#o7">_HeightMapSpeed</a>[k];
00532 }
00533 
00534 <font class="comment">//============================================</font>
00535 
<a name="l00536"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_13">00536</a> <font class="keywordtype">void</font>    CWaterShape::setColorMapMat(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> &amp;column0, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> &amp;column1, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> &amp;pos)
00537 {
00538         <a class="code" href="classNL3D_1_1CWaterShape.html#o8">_ColorMapMatColumn0</a> = column0;
00539         <a class="code" href="classNL3D_1_1CWaterShape.html#o9">_ColorMapMatColumn1</a> = column1;
00540         <a class="code" href="classNL3D_1_1CWaterShape.html#o10">_ColorMapMatPos</a>  = pos;
00541 }
00542 
00543 <font class="comment">//============================================</font>
00544 
<a name="l00545"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_14">00545</a> <font class="keywordtype">void</font>    CWaterShape::getColorMapMat(<a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> &amp;column0, <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> &amp;column1, <a class="code" href="classNLMISC_1_1CVector2f.html">NLMISC::CVector2f</a> &amp;pos)
00546 {
00547         column0 = <a class="code" href="classNL3D_1_1CWaterShape.html#o8">_ColorMapMatColumn0</a>;
00548         column1 = <a class="code" href="classNL3D_1_1CWaterShape.html#o9">_ColorMapMatColumn1</a>;
00549         pos  = <a class="code" href="classNL3D_1_1CWaterShape.html#o10">_ColorMapMatPos</a>;
00550 }
00551 
00552 <font class="comment">//============================================</font>
00553 
<a name="l00554"></a><a class="code" href="classNL3D_1_1CWaterShape.html#c1">00554</a> <font class="keywordtype">void</font> CWaterShape::envMapUpdate()
00555 {
00556         <font class="comment">// if the color map is a blend texture, we MUST be registered to the water pool manager, so that, the</font>
00557         <font class="comment">// setBlend message will be routed to this texture.</font>
00558         <font class="keywordflow">if</font> (
00559                 (<a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[0] &amp;&amp; dynamic_cast&lt;CTextureBlend *&gt;((ITexture *) <a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[0]))
00560                 || (<a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[1] &amp;&amp; dynamic_cast&lt;CTextureBlend *&gt;((ITexture *) <a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[1]))
00561                 )
00562         {
00563                 <font class="keywordflow">if</font> (!<a class="code" href="namespaceNL3D.html#a480">GetWaterPoolManager</a>().isWaterShapeObserver(<font class="keyword">this</font>))
00564                 {
00565                         <a class="code" href="namespaceNL3D.html#a480">GetWaterPoolManager</a>().registerWaterShape(<font class="keyword">this</font>);
00566                 }
00567         }
00568         <font class="keywordflow">else</font>
00569         {
00570                 <font class="keywordflow">if</font> (<a class="code" href="namespaceNL3D.html#a480">GetWaterPoolManager</a>().isWaterShapeObserver(<font class="keyword">this</font>))
00571                 {
00572                         <a class="code" href="namespaceNL3D.html#a480">GetWaterPoolManager</a>().unRegisterWaterShape(<font class="keyword">this</font>);
00573                 }
00574         }
00575 }
00576 
00577 <font class="comment">//============================================</font>
00578 
<a name="l00579"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_10">00579</a> <font class="keywordtype">void</font> CWaterShape::setColorMap(ITexture *map)
00580 { 
00581         <a class="code" href="classNL3D_1_1CWaterShape.html#o5">_ColorMap</a> = map; 
00582         <font class="comment">//colorMapUpdate();</font>
00583 }
00584 
00585 <font class="comment">//============================================</font>
00586 
<a name="l00587"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z914_0">00587</a> <font class="keywordtype">void</font> CWaterShape::setEnvMap(uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>, ITexture *envMap)
00588 {
00589         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; 2);
00590         <a class="code" href="classNL3D_1_1CWaterShape.html#o3">_EnvMap</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = envMap;        
00591 }
00592 
00593 <font class="comment">//============================================</font>
00594 
<a name="l00595"></a><a class="code" href="classNL3D_1_1CWaterShape.html#z913_4">00595</a> <font class="keywordtype">void</font> CWaterShape::getShapeInWorldSpace(<a class="code" href="classNLMISC_1_1CPolygon.html">NLMISC::CPolygon</a> &amp;poly)<font class="keyword"> const</font>
00596 <font class="keyword"></font>{
00597         poly.<a class="code" href="classNLMISC_1_1CPolygon.html#m0">Vertices</a>.resize(<a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a>.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>.size());
00598         <font class="comment">// compute the matrix of the object in world space, by using the default tracks</font>
00599         <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> objMat;
00600         objMat.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_0">identity</a>();              
00601         objMat.<a class="code" href="classNLMISC_1_1CMatrix.html#z292_0">translate</a>(((<a class="code" href="namespaceNL3D.html#a14">CAnimatedValueVector</a> *) &amp;<a class="code" href="classNL3D_1_1CWaterShape.html#o11">_DefaultPos</a>.getValue())-&gt;Value);
00602         objMat.<a class="code" href="classNLMISC_1_1CMatrix.html#z292_4">rotate</a>(((<a class="code" href="namespaceNL3D.html#a16">CAnimatedValueQuat</a> *) &amp;<a class="code" href="classNL3D_1_1CWaterShape.html#o13">_DefaultRotQuat</a>.getValue())-&gt;Value);
00603         objMat.<a class="code" href="classNLMISC_1_1CMatrix.html#z292_6">scale</a>(((<a class="code" href="namespaceNL3D.html#a14">CAnimatedValueVector</a> *) &amp;<a class="code" href="classNL3D_1_1CWaterShape.html#o12">_DefaultScale</a>.getValue())-&gt;Value);
00604         
00605         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a>.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>.size(); ++k)
00606         {
00607                 poly.<a class="code" href="classNLMISC_1_1CPolygon.html#m0">Vertices</a>[k] = objMat * <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(<a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a>.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>[k].x, <a class="code" href="classNL3D_1_1CWaterShape.html#o1">_Poly</a>.<a class="code" href="classNLMISC_1_1CPolygon2D.html#m0">Vertices</a>[k].y, 0);
00608         }
00609 }
00610 
00611 
00612 <font class="comment">//============================================</font>
<a name="l00613"></a><a class="code" href="classNL3D_1_1CWaterShape.html#c2">00613</a> <font class="keywordtype">void</font>  CWaterShape::updateHeightMapNormalizationFactors()
00614 {
00615         <font class="keywordflow">for</font> (uint k = 0; k &lt; 2; ++k)
00616         {
00617                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CWaterShape.html#o17">_HeightMapTouch</a>[k])
00618                 {
00619                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k] != NULL)
00620                         {
00621                                 <a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k]-&gt;generate();
00622                                 <a class="code" href="classNL3D_1_1CWaterShape.html#o18">_HeightMapNormalizationFactor</a>[k] = NLMISC::safe_cast&lt;CTextureBump *&gt;((ITexture *)<a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k])-&gt;getNormalizationFactor();
00623                                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k]-&gt;getReleasable())
00624                                 {
00625                                         <a class="code" href="classNL3D_1_1CWaterShape.html#o4">_BumpMap</a>[k]-&gt;release();
00626                                 }
00627                         }
00628                         <font class="keywordflow">else</font>
00629                         {
00630                                 <a class="code" href="classNL3D_1_1CWaterShape.html#o18">_HeightMapNormalizationFactor</a>[k] = 1.f;
00631                         }
00632                         <a class="code" href="classNL3D_1_1CWaterShape.html#o17">_HeightMapTouch</a>[k] = <font class="keyword">false</font>;
00633                 }
00634         }
00635 }
00636 
00637 
00638 
00639 <font class="comment">//======================================================//</font>
00640 <font class="comment">//                                              WaveMakerShape                                  //</font>
00641 <font class="comment">//======================================================//</font>
00642 
00643 
00644 <font class="comment">//============================================</font>
00645 
<a name="l00646"></a><a class="code" href="classNL3D_1_1CWaveMakerShape.html#z918_0">00646</a> CWaveMakerShape::CWaveMakerShape() : _Period(1),
00647                                      _Radius(3),
00648                                      _PoolID(0),
00649                                      _Intensity(1),
00650                                      _ImpulsionMode(true)
00651 {
00652 }
00653 
00654 <font class="comment">//============================================</font>
00655 
<a name="l00656"></a><a class="code" href="classNL3D_1_1CWaveMakerShape.html#z918_1">00656</a> CWaveMakerShape::~CWaveMakerShape()
00657 {
00658 }
00659 
00660 <font class="comment">//============================================</font>
00661 
<a name="l00662"></a><a class="code" href="classNL3D_1_1CWaveMakerShape.html#z918_2">00662</a> <font class="keywordtype">void</font> CWaveMakerShape::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
00663 {
00664         f.serialVersion(0);
00665         f.serial(_Period, _Radius, _Intensity, _PoolID, _ImpulsionMode);
00666 }
00667 
00668 <font class="comment">//============================================</font>
00669 
<a name="l00670"></a><a class="code" href="classNL3D_1_1CWaveMakerShape.html#a1">00670</a> CTransformShape         *CWaveMakerShape::createInstance(CScene &amp;scene)
00671 {
00672         CWaveMakerModel *wmm = NLMISC::safe_cast&lt;CWaveMakerModel *&gt;(scene.createModel(<a class="code" href="namespaceNL3D.html#a311">WaveMakerModelClassId</a>) );
00673         wmm-&gt;Shape = <font class="keyword">this</font>;
00674         <font class="comment">// set default pos &amp; scale</font>
00675         wmm-&gt;ITransformable::setPos( ((<a class="code" href="namespaceNL3D.html#a14">CAnimatedValueVector</a>&amp;)<a class="code" href="classNL3D_1_1CWaveMakerShape.html#o5">_DefaultPos</a>.getValue()).Value  );          
00676         wmm-&gt;_Scene = &amp;scene;
00677         <font class="keywordflow">return</font> wmm;
00678 }
00679 
00680 <font class="comment">//============================================</font>
00681 
<a name="l00682"></a><a class="code" href="classNL3D_1_1CWaveMakerShape.html#a2">00682</a> <font class="keywordtype">bool</font>    CWaveMakerShape::clip(<font class="keyword">const</font> std::vector&lt;CPlane&gt; &amp;pyramid, <font class="keyword">const</font> CMatrix &amp;worldMatrix)
00683 {
00684         <font class="comment">// we just test if not too far</font>
00685         <font class="keyword">const</font> CWaterHeightMap &amp;whm = <a class="code" href="namespaceNL3D.html#a480">GetWaterPoolManager</a>().getPoolByID(<a class="code" href="classNL3D_1_1CWaveMakerShape.html#o2">_PoolID</a>);
00686         <font class="keyword">const</font> <font class="keywordtype">float</font> maxDist = 0.5f * whm.getUnitSize() * whm.getSize(); 
00687         <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> pos = worldMatrix.getPos();
00688         <font class="keywordflow">for</font> (std::vector&lt;NLMISC::CPlane&gt;::const_iterator it = pyramid.begin(); it != pyramid.end(); ++it)
00689         {
00690                 <font class="keywordflow">if</font> ((*it) * pos &gt; maxDist) <font class="keywordflow">return</font> <font class="keyword">false</font>;
00691         }
00692         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00693 
00694 }
00695 
00696 <font class="comment">//============================================</font>
<a name="l00697"></a><a class="code" href="classNL3D_1_1CWaveMakerShape.html#a4">00697</a> <font class="keywordtype">void</font>    CWaveMakerShape::getAABBox(<a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> &amp;bbox)<font class="keyword"> const</font>
00698 <font class="keyword"></font>{       
00699         <font class="comment">// its just a point</font>
00700         bbox.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_0">setCenter</a>(<a class="code" href="classNLMISC_1_1CVector.html#p0">NLMISC::CVector::Null</a>);
00701         bbox.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_1">setHalfSize</a>(<a class="code" href="classNLMISC_1_1CVector.html#p0">NLMISC::CVector::Null</a>);
00702 }
00703 
00704 } <font class="comment">// NL3D</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>