aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/cloud__scape_8cpp-source.html
blob: 1653c344d8131066512f0e1d667ec97d6e107a1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=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="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

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

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

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

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

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>cloud_scape.cpp</h1><a href="cloud__scape_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2002 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 <font class="preprocessor">#include "<a class="code" href="cloud__scape_8h.html">cloud_scape.h</a>"</font>
00028 <font class="preprocessor">#include "<a class="code" href="driver_8h.html">3d/driver.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="scissor_8h.html">nel/3d/scissor.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="viewport_8h.html">nel/3d/viewport.h</a>"</font>
00031 
00032 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
00033 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00034 
00035 <font class="keyword">namespace </font>NL3D
00036 {
00037 
00038 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00039"></a><a class="code" href="cloud__scape_8cpp.html#a0">00039</a> <font class="preprocessor">#define SQR(x) (x)*(x)</font>
00040 <font class="preprocessor"></font>
<a name="l00041"></a><a class="code" href="cloud__scape_8cpp.html#a1">00041</a> <font class="preprocessor">#define MAX_DIST        400.0f</font>
<a name="l00042"></a><a class="code" href="cloud__scape_8cpp.html#a2">00042</a> <font class="preprocessor"></font><font class="preprocessor">#define MAX_CLOUDS      256</font>
00043 <font class="preprocessor"></font><font class="comment">// QUEUE_SIZE must be at least 2*MAX_CLOUDS</font>
<a name="l00044"></a><a class="code" href="cloud__scape_8cpp.html#a3">00044</a> <font class="preprocessor">#define QUEUE_SIZE      512 </font>
00045 <font class="preprocessor"></font>
00046 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
00047 <font class="comment">// SCloudTexture3D</font>
00048 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
00049 
00050 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00051"></a><a class="code" href="structNL3D_1_1SCloudTexture3D.html#a0">00051</a> SCloudTexture3D::SCloudTexture3D ()
00052 {
00053         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m5">Mem</a> = NULL;
00054         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z551_0">initUnlit</a>();
00055         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#a0">setShader</a> (CMaterial::Normal);
00056         <font class="comment">//ToLight.setTexture (0, Tex);</font>
00057         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_0">setZFunc</a> (CMaterial::always);
00058         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_1">setZWrite</a> (<font class="keyword">false</font>);
00059         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_0">texEnvOpRGB</a> (0, CMaterial::Replace);
00060         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_1">texEnvArg0RGB</a> (0, CMaterial::Diffuse, CMaterial::SrcColor);
00061         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_3">texEnvOpAlpha</a> (0, CMaterial::Replace);
00062         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_4">texEnvArg0Alpha</a> (0, CMaterial::Texture, CMaterial::InvSrcAlpha);
00063         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z542_0">setBlend</a> (<font class="keyword">true</font>);
00064         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z542_1">setBlendFunc</a> (CMaterial::invsrcalpha, CMaterial::srcalpha);
00065         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z547_0">setColor</a> (CRGBA(0,0,0,255));
00066 
00067         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z551_0">initUnlit</a>();
00068         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_0">setZFunc</a> (CMaterial::always);
00069         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_1">setZWrite</a> (<font class="keyword">false</font>);
00070         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z544_0">setDoubleSided</a>(<font class="keyword">true</font>);
00071 
00072         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_0">texEnvOpRGB</a> (0, CMaterial::Add);
00073         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_1">texEnvArg0RGB</a> (0, CMaterial::Texture, CMaterial::SrcColor);
00074         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_2">texEnvArg1RGB</a> (0, CMaterial::Diffuse, CMaterial::SrcColor);
00075         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z547_0">setColor</a> (CRGBA(80,80,80,255));
00076 
00077         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_3">texEnvOpAlpha</a> (0, CMaterial::Replace);
00078         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_4">texEnvArg0Alpha</a> (0, CMaterial::Texture, CMaterial::SrcAlpha);
00079 
00080         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_0">texEnvOpRGB</a> (1, CMaterial::Modulate);
00081         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_1">texEnvArg0RGB</a> (1, CMaterial::Previous, CMaterial::SrcColor);
00082         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_2">texEnvArg1RGB</a> (1, CMaterial::Previous, CMaterial::SrcAlpha);
00083         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_3">texEnvOpAlpha</a> (1, CMaterial::Replace);
00084         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_4">texEnvArg0Alpha</a> (1, CMaterial::Previous, CMaterial::SrcAlpha);
00085 
00086         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z542_1">setBlendFunc</a> (CMaterial::one, CMaterial::invsrcalpha);
00087         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z542_0">setBlend</a> (<font class="keyword">true</font>);
00088 }
00089 
00090 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00091"></a><a class="code" href="structNL3D_1_1SCloudTexture3D.html#a1">00091</a> <font class="keywordtype">void</font> SCloudTexture3D::init (uint32 nWidth, uint32 nHeight, uint32 nDepth)
00092 {
00093         <font class="keywordflow">if</font> (<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m5">Mem</a> != NULL)
00094                 <font class="keywordflow">return</font>;
00095 
00096         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m0">Width</a> = <a class="code" href="namespaceNLMISC.html#a223">raiseToNextPowerOf2</a> (nWidth);
00097         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m1">Height</a> = <a class="code" href="namespaceNLMISC.html#a223">raiseToNextPowerOf2</a> (nHeight);
00098         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m2">Depth</a> = <a class="code" href="namespaceNLMISC.html#a223">raiseToNextPowerOf2</a> (nDepth);
00099         uint32 vdpo2 = <a class="code" href="namespaceNLMISC.html#a224">getPowerOf2</a>(<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m2">Depth</a>);
00100         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m3">NbW</a> = 1 &lt;&lt; (vdpo2 / 2);
00101         <font class="keywordflow">if</font> ((vdpo2 &amp; 1) != 0)
00102                 <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m4">NbH</a> = 2 &lt;&lt; (vdpo2 / 2);
00103         <font class="keywordflow">else</font>
00104                 <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m4">NbH</a> = 1 &lt;&lt; (vdpo2 / 2);
00105 
00106         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m5">Mem</a> = <font class="keyword">new</font> uint8[4*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m3">NbW</a>*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m0">Width</a>*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m4">NbH</a>*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m1">Height</a>];
00107         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m6">Tex</a> = <font class="keyword">new</font> CTextureMem (<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m5">Mem</a>, 4*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m3">NbW</a>*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m0">Width</a>*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m4">NbH</a>*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m1">Height</a>, <font class="keyword">true</font>, <font class="keyword">false</font>, <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m3">NbW</a>*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m0">Width</a>, <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m4">NbH</a>*<a class="code" href="structNL3D_1_1SCloudTexture3D.html#m1">Height</a>, CBitmap::RGBA);
00108 
00109         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m6">Tex</a>-&gt;setWrapS (ITexture::Clamp);
00110         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m6">Tex</a>-&gt;setWrapT (ITexture::Clamp);
00111         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m6">Tex</a>-&gt;setFilterMode (ITexture::Linear, ITexture::LinearMipMapOff);
00112         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m6">Tex</a>-&gt;setReleasable (<font class="keyword">false</font>);
00113         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m6">Tex</a>-&gt;generate ();
00114 
00115         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m7">ToLight</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z541_0">setTexture</a> (0, <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m6">Tex</a>);
00116 
00117         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z541_0">setTexture</a>(0, <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m6">Tex</a>);
00118         <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m8">ToBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z541_0">setTexture</a>(1, <a class="code" href="structNL3D_1_1SCloudTexture3D.html#m6">Tex</a>);
00119 }
00120 
00121 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
00122 <font class="comment">// SCloudTextureClamp</font>
00123 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
00124 
00125 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00126"></a><a class="code" href="structNL3D_1_1SCloudTextureClamp.html#a0">00126</a> SCloudTextureClamp::SCloudTextureClamp ()
00127 {
00128         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m5">Mem</a> = NULL;
00129         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z551_0">initUnlit</a>();
00130         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#a0">setShader</a> (CMaterial::Normal);
00131         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_3">texEnvOpAlpha</a> (0, CMaterial::Add);
00132         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_4">texEnvArg0Alpha</a> (0, CMaterial::Texture, CMaterial::SrcAlpha);
00133         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_5">texEnvArg1Alpha</a> (0, CMaterial::Diffuse, CMaterial::SrcAlpha);
00134         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z547_0">setColor</a> (CRGBA(255,255,255,255));
00135         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z542_0">setBlend</a> (<font class="keyword">true</font>);
00136         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z542_1">setBlendFunc</a> (CMaterial::one, CMaterial::one);
00137         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_0">setZFunc</a> (CMaterial::always);
00138         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_1">setZWrite</a> (<font class="keyword">false</font>);
00139 
00140 }
00141 
00142 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00143"></a><a class="code" href="structNL3D_1_1SCloudTextureClamp.html#a1">00143</a> <font class="keywordtype">void</font> SCloudTextureClamp::init (uint32 nWidth, uint32 nHeight, uint32 nDepth, <font class="keyword">const</font> std::string &amp;filename)
00144 {
00145         <font class="keywordflow">if</font> (<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m5">Mem</a> != NULL)
00146                 <font class="keywordflow">return</font>;
00147         
00148         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a> = <a class="code" href="namespaceNLMISC.html#a223">raiseToNextPowerOf2</a> (nWidth);
00149         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m1">Height</a> = <a class="code" href="namespaceNLMISC.html#a223">raiseToNextPowerOf2</a> (nHeight);
00150         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m2">Depth</a> = <a class="code" href="namespaceNLMISC.html#a223">raiseToNextPowerOf2</a> (nDepth);
00151         uint32 vdpo2 = <a class="code" href="namespaceNLMISC.html#a224">getPowerOf2</a>(<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m2">Depth</a>);
00152         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m3">NbW</a> = 1 &lt;&lt; (vdpo2 / 2);
00153         <font class="keywordflow">if</font> ((vdpo2 &amp; 1) != 0)
00154                 <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m4">NbH</a> = 2 &lt;&lt; (vdpo2 / 2);
00155         <font class="keywordflow">else</font>
00156                 <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m4">NbH</a> = 1 &lt;&lt; (vdpo2 / 2);
00157 
00158         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m5">Mem</a> = <font class="keyword">new</font> uint8[<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m3">NbW</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m4">NbH</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m1">Height</a>];
00159         uint32 i, j;
00160 
00161         <font class="keywordflow">if</font> (filename == <font class="stringliteral">""</font>)
00162         {
00163                 <font class="comment">// No filename so init with default</font>
00164                 <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m3">NbW</a>; ++i)
00165                 {
00166                         <font class="keywordflow">for</font> (j = 0; j &lt; <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m4">NbH</a>; ++j)
00167                         {
00168                                 uint32 d = i+j*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m3">NbW</a>;
00169                                 uint32 k, <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>;
00170                                 <font class="keywordflow">for</font> (k = 0; k &lt; <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a>; ++k)
00171                                 <font class="keywordflow">for</font> (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m1">Height</a>; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00172                                 {
00173                                         <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = k+0.5f;
00174                                         <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> = <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>+0.5f;
00175                                         <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a366">z</a> = d+0.5f;
00176                                         <font class="keywordtype">float</font> xc = <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a>/2.0f;
00177                                         <font class="keywordtype">float</font> yc = <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m1">Height</a>/2.0f;
00178                                         <font class="keywordtype">float</font> zc = <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m2">Depth</a>/2.0f;
00179 
00180                                         <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> = (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>-xc)*(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>-xc)/(<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a>/4.0f) + (<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>-yc)*(<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>-yc)/(<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m1">Height</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m1">Height</a>/4.0f) 
00181                                                         + (<a class="code" href="driver__opengl__extension__def_8h.html#a366">z</a>-zc)*(<a class="code" href="driver__opengl__extension__def_8h.html#a366">z</a>-zc)/(<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m2">Depth</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m2">Depth</a>/4.0f);
00182 
00183                                         uint8 col = 255;
00184                                         <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> &lt; 1.0f)
00185                                         {
00186                                                 col = (uint8)((r)*223+32);
00187                                         }
00188                                         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m5">Mem</a>[i*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a>+k + (j*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m1">Height</a>+<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m3">NbW</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a>] = col;
00189                                 }
00190                         }
00191                 }
00192         }
00193         <font class="keywordflow">else</font>
00194         {
00195                 <font class="comment">// Load file TODO !</font>
00196         }
00197 
00198         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m6">Tex</a> = <font class="keyword">new</font> CTextureMem (<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m5">Mem</a>, <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m3">NbW</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m4">NbH</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m1">Height</a>, <font class="keyword">true</font>, <font class="keyword">false</font>, <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m3">NbW</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m0">Width</a>, <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m4">NbH</a>*<a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m1">Height</a>, CBitmap::Alpha);
00199         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m6">Tex</a>-&gt;setWrapS (ITexture::Repeat);
00200         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m6">Tex</a>-&gt;setWrapT (ITexture::Repeat);
00201         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m6">Tex</a>-&gt;setFilterMode (ITexture::Linear, ITexture::LinearMipMapOff);
00202 
00203         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m6">Tex</a>-&gt;touch();
00204         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m6">Tex</a>-&gt;setReleasable (<font class="keyword">false</font>);
00205         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m6">Tex</a>-&gt;generate();
00206 
00207         <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m7">ToClamp</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z541_0">setTexture</a>(0, <a class="code" href="structNL3D_1_1SCloudTextureClamp.html#m6">Tex</a>);
00208 
00209 }
00210 
00211 
00212 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
00213 <font class="comment">// CCloudScape</font>
00214 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
00215 
00216 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00217"></a><a class="code" href="classNL3D_1_1CCloudScape.html#a0">00217</a> CCloudScape::CCloudScape (<a class="code" href="classNL3D_1_1IDriver.html">NL3D::IDriver</a> *pDriver) : _Noise3D (pDriver)
00218 {
00219         <a class="code" href="classNL3D_1_1CCloudScape.html#o26">_Driver</a> = pDriver;
00220         <font class="comment">// Misc purpose VB</font>
00221         <a class="code" href="classNL3D_1_1CCloudScape.html#o27">_VertexBuffer</a>.<a class="code" href="classNL3D_1_1CVertexBuffer.html#z899_0">setVertexFormat</a> (CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag | CVertexBuffer::TexCoord1Flag);
00222         <a class="code" href="classNL3D_1_1CCloudScape.html#o27">_VertexBuffer</a>.<a class="code" href="classNL3D_1_1CVertexBuffer.html#a4">setNumVertices</a> (4);
00223 
00224         <font class="comment">// Material used for cleaning</font>
00225         <a class="code" href="classNL3D_1_1CCloudScape.html#o28">_MatClear</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z551_0">initUnlit</a>();
00226         <a class="code" href="classNL3D_1_1CCloudScape.html#o28">_MatClear</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z544_0">setDoubleSided</a> (<font class="keyword">true</font>);
00227         <a class="code" href="classNL3D_1_1CCloudScape.html#o28">_MatClear</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_0">setZFunc</a> (CMaterial::always);
00228         <a class="code" href="classNL3D_1_1CCloudScape.html#o28">_MatClear</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_1">setZWrite</a> (<font class="keyword">false</font>);
00229         <a class="code" href="classNL3D_1_1CCloudScape.html#o28">_MatClear</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z542_0">setBlend</a> (<font class="keyword">false</font>);
00230 
00231         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z551_0">initUnlit</a>();
00232         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#a0">setShader</a> (CMaterial::Normal); <font class="comment">// not needed</font>
00233 
00234         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_0">texEnvOpRGB</a> (0, CMaterial::Replace);
00235         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_1">texEnvArg0RGB</a> (0, CMaterial::Texture, CMaterial::SrcColor);
00236 
00237         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_3">texEnvOpAlpha</a> (0, CMaterial::Replace);
00238         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_4">texEnvArg0Alpha</a> (0, CMaterial::Texture, CMaterial::SrcAlpha);
00239 
00240         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_0">texEnvOpRGB</a> (1, CMaterial::InterpolateDiffuse);
00241         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_1">texEnvArg0RGB</a> (1, CMaterial::Texture, CMaterial::SrcColor);
00242         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_2">texEnvArg1RGB</a> (1, CMaterial::Previous, CMaterial::SrcColor);
00243 
00244         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_3">texEnvOpAlpha</a> (1, CMaterial::InterpolateDiffuse);
00245         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_4">texEnvArg0Alpha</a> (1, CMaterial::Texture, CMaterial::SrcAlpha);
00246         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z548_5">texEnvArg1Alpha</a> (1, CMaterial::Previous, CMaterial::SrcAlpha);
00247 
00248         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z542_0">setBlend</a> (<font class="keyword">true</font>);
00249         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z542_1">setBlendFunc</a>(CMaterial::one, CMaterial::invsrcalpha);
00250         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_0">setZFunc</a> (CMaterial::always);
00251         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z546_1">setZWrite</a> (<font class="keyword">false</font>);
00252         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z544_0">setDoubleSided</a> (<font class="keyword">true</font>);
00253         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z545_0">setAlphaTest</a>(<font class="keyword">true</font>);
00254         <a class="code" href="classNL3D_1_1CCloudScape.html#o29">_MatBill</a>.<a class="code" href="classNL3D_1_1CMaterial.html#z545_2">setAlphaTestThreshold</a>(2.0f/256.0f);
00255 
00256         <a class="code" href="classNL3D_1_1CCloudScape.html#o24">_LODQualityThreshold</a> = 160.0f;
00257         <a class="code" href="classNL3D_1_1CCloudScape.html#o14">_IsIncomingCSS</a> = <font class="keyword">false</font>;
00258         <a class="code" href="classNL3D_1_1CCloudScape.html#o25">_DebugQuad</a> = <font class="keyword">false</font>;
00259         <a class="code" href="classNL3D_1_1CCloudScape.html#o0">_NbHalfCloudToUpdate</a> = 1;
00260 }
00261 
00262 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00263"></a><a class="code" href="classNL3D_1_1CCloudScape.html#a1">00263</a> CCloudScape::~CCloudScape ()
00264 {
00265 }
00266 
00267 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00268"></a><a class="code" href="classNL3D_1_1CCloudScape.html#a2">00268</a> <font class="keywordtype">void</font> CCloudScape::init (SCloudScapeSetup *pCSS, <a class="code" href="classNL3D_1_1CCamera.html">NL3D::CCamera</a> *pCamera)
00269 {
00270         <a class="code" href="classNL3D_1_1CCloudScape.html#o30">_ViewerCam</a> = pCamera;
00271         
00272         <a class="code" href="classNL3D_1_1CCloudScape.html#o16">_Noise3D</a>.init();
00273 
00274         <a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>.resize (<a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>, <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a>(<font class="keyword">this</font>));
00275         <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>.resize (<a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>);
00276         <a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>.resize (<a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>);
00277 
00278         <font class="comment">// For the moment only one clamp texture (generated)</font>
00279         <a class="code" href="classNL3D_1_1CCloudScape.html#o31">Tex3DTemp</a>.init (64, 32, 32);
00280         <a class="code" href="classNL3D_1_1CCloudScape.html#o32">TexClamp</a>.init (64, 32, 32,<font class="stringliteral">""</font>);
00281 
00282         <font class="keywordflow">if</font> (pCSS != NULL)
00283         {
00284                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a> = *pCSS;
00285                 <a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a> = *pCSS;
00286                 <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a> = *pCSS;
00287         }
00288         <a class="code" href="classNL3D_1_1CCloudScape.html#o14">_IsIncomingCSS</a> = <font class="keyword">false</font>;
00289         <a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a> = 60.0*60.0;
00290 
00291         uint32 i;
00292         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>; ++i)
00293         {
00294                 <font class="keywordtype">float</font> newX, newY, newZ, newSizeX, newSizeY, newSizeZ;
00295 
00296                 <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> &amp;c = <a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>[i];
00297 
00298                 c.setTex3DTemp (<a class="code" href="classNL3D_1_1CCloudScape.html#o31">Tex3DTemp</a>);
00299                 c.setTexClamp (<a class="code" href="classNL3D_1_1CCloudScape.html#o32">TexClamp</a>);
00300 
00301                 <font class="keywordflow">while</font> (true)
00302                 {
00303                         <font class="keywordtype">bool</font> bRecalc = <font class="keyword">false</font>;
00304                         newX = <a class="code" href="cloud__scape_8cpp.html#a1">MAX_DIST</a>*(1.0f-2.0f*(((float)rand())/RAND_MAX));
00305                         newY = <a class="code" href="cloud__scape_8cpp.html#a1">MAX_DIST</a>*(1.0f-2.0f*(((float)rand())/RAND_MAX));
00306                         newZ = 85.0f+40.0f*(1.0f-2.0f*(((float)rand())/RAND_MAX));
00307 
00308                         newSizeX = 60.0f+10.0f*(1.0f-2.0f*(((float)rand())/RAND_MAX));
00309                         newSizeY = 30.0f+10.0f*(1.0f-2.0f*(((float)rand())/RAND_MAX));
00310                         newSizeZ = 30.0f+10.0f*(1.0f-2.0f*(((float)rand())/RAND_MAX));
00311                         <font class="keywordtype">float</font> f = 0.7f+0.3f*((float)rand())/RAND_MAX;
00312                         newSizeX *= 1.5f*f;
00313                         newSizeY *= 1.5f*f;
00314                         newSizeZ *= 1.5f*f;
00315 
00316                         <font class="keywordtype">float</font> d = sqrtf(<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(newX)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(newY));
00317                         <font class="keywordflow">if</font> (d &gt; <a class="code" href="cloud__scape_8cpp.html#a1">MAX_DIST</a>) bRecalc = <font class="keyword">true</font>;
00318 
00319                         <font class="keywordtype">float</font> r1 = sqrtf(<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(newSizeX/2)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(newSizeY/2)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(newSizeZ/2));
00320                         <font class="keywordflow">for</font> (uint32 k = 0;k &lt; i; ++k)
00321                         {
00322                                 <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> &amp;c2 = <a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>[k];
00323 
00324                                 <font class="keywordflow">if</font> ((fabs(newX-c2.getX()) &lt; (newSizeX/2+c2.getSizeX()/2)) &amp;&amp; 
00325                                         (fabs(newY-c2.getY()) &lt; (newSizeY/2+c2.getSizeY()/2)) &amp;&amp; 
00326                                         (fabs(newZ-c2.getZ()) &lt; (newSizeZ/2+c2.getSizeZ()/2)))
00327                                         bRecalc = <font class="keyword">true</font>;
00328                         }
00329                         <font class="keywordflow">if</font> (!bRecalc) <font class="keywordflow">break</font>;
00330                 }
00331 
00332                 c.init (64, 32, 32, 0.122f, 4);
00333                 c.setX (newX-newSizeX/2);
00334                 c.setY (newY-newSizeY/2);
00335                 c.setZ (newZ-newSizeZ/2);
00336 
00337                 c.setSizeX (newSizeX);
00338                 c.setSizeY (newSizeY);
00339                 c.setSizeZ (newSizeZ);
00340 
00341                 c.Time = 0;
00342                 c.FuturTime = <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud * 2 * (0.04/<a class="code" href="classNL3D_1_1CCloudScape.html#o0">_NbHalfCloudToUpdate</a>);
00343                 <font class="keywordflow">if</font> (i &lt; <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud)
00344                 {
00345                         <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[i] = 255;
00346                         <a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>[i] = <font class="keyword">true</font>;
00347                 }
00348                 <font class="keywordflow">else</font>
00349                 {
00350                         <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[i] = 0;
00351                         <a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>[i] = <font class="keyword">false</font>;
00352                 }
00353         }
00354 
00355         <a class="code" href="classNL3D_1_1CCloudScape.html#o23">_SortedClouds</a>.resize (<a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>);
00356 
00357         <a class="code" href="classNL3D_1_1CCloudScape.html#o19">_CloudSchedulerSize</a> = <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud;
00358         <a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>.resize (<a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>);
00359         <a class="code" href="classNL3D_1_1CCloudScape.html#o21">_FrameCounter</a> = 0;
00360         <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.clear();
00361         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>; ++i)
00362                 <a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[i].ValidPos = <font class="keyword">false</font>;
00363 
00364         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a3">QUEUE_SIZE</a>; ++i)
00365         {
00366                 sint32 nCloudNb = i%<a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud;
00367                 SCloudSchedulerEntry cse;
00368                 cse.CloudIndex = nCloudNb;
00369                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[nCloudNb].ValidPos == <font class="keyword">true</font>)
00370                 {
00371                         SCloudSchedulerEntry &amp;lastCSE = *<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[nCloudNb].Pos;
00372                         sint32 delta = <a class="code" href="classNL3D_1_1CCloudScape.html#o21">_FrameCounter</a> - lastCSE.Frame;
00373                         lastCSE.DeltaNextCalc = delta;
00374                 }
00375                 cse.Frame = <a class="code" href="classNL3D_1_1CCloudScape.html#o21">_FrameCounter</a>;
00376                 cse.Ambient = <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Ambient;
00377                 cse.Diffuse = <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Diffuse;
00378                 cse.Power = <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[cse.CloudIndex];
00379                 <a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[nCloudNb].Pos = <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.insert(<a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.end(), cse);
00380                 <a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[nCloudNb].ValidPos = <font class="keyword">true</font>;
00381 <font class="comment">//              _CloudSchedulerLastAdded[nCloudNb].Pos = _CloudScheduler.end()-1;</font>
00382                 ++<a class="code" href="classNL3D_1_1CCloudScape.html#o21">_FrameCounter</a>;
00383         }
00384         <a class="code" href="classNL3D_1_1CCloudScape.html#o1">_GlobalTime</a> = 0.0f;
00385         <a class="code" href="classNL3D_1_1CCloudScape.html#o3">_DTRest</a> = 0.0f;
00386         <a class="code" href="classNL3D_1_1CCloudScape.html#o5">_Generate</a> = <font class="keyword">true</font>;
00387         <a class="code" href="classNL3D_1_1CCloudScape.html#o4">_AverageFrameRate</a>.<a class="code" href="classNLMISC_1_1CValueSmoother.html#a1">init</a>(16);
00388         <font class="keywordflow">for</font> (i = 0; i &lt; 16; ++i)
00389                 <a class="code" href="classNL3D_1_1CCloudScape.html#o4">_AverageFrameRate</a>.<a class="code" href="classNLMISC_1_1CValueSmoother.html#a3">addValue</a> (40.0f/1000.0f);
00390 
00391         <a class="code" href="classNL3D_1_1CCloudScape.html#o22">_ExtrapolatedPriorities</a>.resize (<a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>);
00392 
00393         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a3">QUEUE_SIZE</a>; ++i)
00394                 <a class="code" href="classNL3D_1_1CCloudScape.html#a4">anim</a> (41.0/1000.0, <a class="code" href="classNL3D_1_1CCloudScape.html#o30">_ViewerCam</a>);
00395 }
00396 
00397 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00398"></a><a class="code" href="classNL3D_1_1CCloudScape.html#a3">00398</a> <font class="keywordtype">void</font> CCloudScape::set (SCloudScapeSetup &amp;css)
00399 {
00400         <a class="code" href="classNL3D_1_1CCloudScape.html#o15">_IncomingCSS</a> = css;
00401         <a class="code" href="classNL3D_1_1CCloudScape.html#o14">_IsIncomingCSS</a> = <font class="keyword">true</font>;
00402 }
00403 
00404 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00405"></a><a class="code" href="classNL3D_1_1CCloudScape.html#a4">00405</a> <font class="keywordtype">void</font> CCloudScape::anim (<font class="keywordtype">double</font> dt, <a class="code" href="classNL3D_1_1CCamera.html">NL3D::CCamera</a> *pCamera)
00406 {
00407         sint32 i;
00408 
00409         <a class="code" href="classNL3D_1_1CCloudScape.html#o30">_ViewerCam</a> = pCamera;
00410 
00411         <font class="comment">// 10 fps -&gt; 200 fps</font>
00412         <font class="keywordflow">if</font> (dt &gt; 0.1) dt = 0.1;
00413         <font class="keywordflow">if</font> (dt &lt; 0.005) dt = 0.005;
00414 
00415         <a class="code" href="classNL3D_1_1CCloudScape.html#o2">_DeltaTime</a> = dt;
00416         <a class="code" href="classNL3D_1_1CCloudScape.html#o1">_GlobalTime</a> += <a class="code" href="classNL3D_1_1CCloudScape.html#o2">_DeltaTime</a>;
00417         <a class="code" href="classNL3D_1_1CCloudScape.html#o4">_AverageFrameRate</a>.<a class="code" href="classNLMISC_1_1CValueSmoother.html#a3">addValue</a> ((<font class="keywordtype">float</font>)<a class="code" href="classNL3D_1_1CCloudScape.html#o2">_DeltaTime</a>);
00418 
00419         <font class="comment">// Animate the CSS</font>
00420         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a> &gt; <a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.TimeToChange)
00421         {
00422                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a> = <a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>;
00423                 <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a> = <a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>;
00424                 <font class="keywordflow">if</font> (_IsIncomingCSS)
00425                 {
00426                         <a class="code" href="classNL3D_1_1CCloudScape.html#o14">_IsIncomingCSS</a> = <font class="keyword">false</font>;
00427                         <a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a> = <a class="code" href="classNL3D_1_1CCloudScape.html#o15">_IncomingCSS</a>;
00428                         <a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a> = 0;
00429                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.NbCloud &gt; <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud)
00430                         <font class="keywordflow">for</font> (i = 0; i &lt; (sint32)(<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.NbCloud-<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud); ++i)
00431                         {
00432                                 <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> &amp;c = <a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>[<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud+i];
00433                                 c.CloudPower = 0;
00434                                 <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud+i] = 0;
00435                         }
00436                 }
00437         }
00438         <font class="keywordflow">else</font>
00439         {
00440                 <font class="keywordtype">float</font> inter = (float)(<a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a> / <a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.TimeToChange);
00441                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.WindSpeed = (<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.WindSpeed - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.WindSpeed)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.WindSpeed;
00442                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.CloudSpeed = (<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.CloudSpeed - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.CloudSpeed)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.CloudSpeed;
00443 
00444                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Ambient.R = (uint8)((<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.Ambient.R - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Ambient.R)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Ambient.R);
00445                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Ambient.G = (uint8)((<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.Ambient.G - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Ambient.G)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Ambient.G);
00446                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Ambient.B = (uint8)((<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.Ambient.B - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Ambient.B)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Ambient.B);
00447                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Ambient.A = (uint8)((<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.Ambient.A - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Ambient.A)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Ambient.A);
00448 
00449                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Diffuse.R = (uint8)((<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.Diffuse.R - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Diffuse.R)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Diffuse.R);
00450                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Diffuse.G = (uint8)((<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.Diffuse.G - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Diffuse.G)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Diffuse.G);
00451                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Diffuse.B = (uint8)((<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.Diffuse.B - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Diffuse.B)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Diffuse.B);
00452                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Diffuse.A = (uint8)((<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.Diffuse.A - <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Diffuse.A)*inter + <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.Diffuse.A);
00453 
00454                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.NbCloud &gt; <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud)
00455                 {
00456                         <font class="comment">// Add some clouds</font>
00457                         <font class="keywordtype">float</font> slice = (<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.TimeToChange/4) / (<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.NbCloud-<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud);
00458                         sint32 diffCloud = <a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.NbCloud-<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud;
00459 
00460                         <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud = <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud + (1+(uint32)(<a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a>/slice));
00461                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud &gt; <a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.NbCloud)
00462                                 <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud = <a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.NbCloud;
00463 
00464                         <font class="keywordflow">for</font> (i = 0; i &lt; diffCloud; ++i)
00465                         {
00466                                 <a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>[<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud+i] = <font class="keyword">true</font>;
00467                                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a> &lt; i*slice)
00468                                         <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud+i] = 1;
00469                                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a> &gt; (i*slice+3*<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.TimeToChange/4))
00470                                         <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud+i] = 255;
00471                                 <font class="keywordflow">else</font>
00472                                         <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud+i] = (uint8)(255*(<a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a>-i*slice)/(3*<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.TimeToChange/4));
00473                         }
00474                 }
00475                 <font class="keywordflow">else</font>
00476                 {
00477                         <font class="comment">// Remove some clouds</font>
00478                         <font class="keywordtype">float</font> slice = (<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.TimeToChange/4) / (<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud-<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.NbCloud);
00479                         sint32 diffCloud = <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud-<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.NbCloud;
00480 
00481                         <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud = <a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud;
00482 
00483                         <font class="keywordflow">for</font> (i = 0; i &lt; diffCloud; ++i)
00484                         {
00485                                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a> &lt; i*slice)
00486                                         <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud-i-1] = 255;
00487                                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a> &gt; (i*slice+3*<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.TimeToChange/4))
00488                                         <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud-i-1] = 0;
00489                                 <font class="keywordflow">else</font>
00490                                         <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[<a class="code" href="classNL3D_1_1CCloudScape.html#o12">_OldCSS</a>.NbCloud-i-1] = (uint8)(255-255*(<a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a>-i*slice)/(3*<a class="code" href="classNL3D_1_1CCloudScape.html#o11">_NewCSS</a>.TimeToChange/4));
00491                         }
00492                 }
00493         }
00494 
00495         <font class="comment">// Make the right number of half cloud</font>
00496         <a class="code" href="classNL3D_1_1CCloudScape.html#o3">_DTRest</a> += dt;
00497 
00498         <font class="keywordflow">while</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o3">_DTRest</a> &gt; (0.04/<a class="code" href="classNL3D_1_1CCloudScape.html#o0">_NbHalfCloudToUpdate</a>))
00499         {
00500                 <a class="code" href="classNL3D_1_1CCloudScape.html#c0">makeHalfCloud</a> ();
00501                 <a class="code" href="classNL3D_1_1CCloudScape.html#o3">_DTRest</a> -= 0.04/<a class="code" href="classNL3D_1_1CCloudScape.html#o0">_NbHalfCloudToUpdate</a>;
00502 
00503                 <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>; ++i)
00504                 {
00505                         <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> &amp;c = <a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>[i];
00506                         c.Time += 0.04/<a class="code" href="classNL3D_1_1CCloudScape.html#o0">_NbHalfCloudToUpdate</a>;
00507                 }
00508 
00509                 <a class="code" href="classNL3D_1_1CCloudScape.html#o13">_TimeNewCSS</a> += 0.04/<a class="code" href="classNL3D_1_1CCloudScape.html#o0">_NbHalfCloudToUpdate</a>;
00510         }
00511 }
00512 
00513 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00514"></a><a class="code" href="classNL3D_1_1CCloudScape.html#c0">00514</a> <font class="keywordtype">void</font> CCloudScape::makeHalfCloud ()
00515 {
00516         CVector Viewer = CVector(0,0,0); <font class="comment">//_ViewerCam-&gt;getMatrix().getPos();</font>
00517 
00518         <font class="keywordflow">if</font> (_Generate)
00519         {
00520                 <font class="comment">// Find the next cloud in the list</font>
00521                 SCloudSchedulerEntry FrontCSE;
00522 
00523                 FrontCSE = <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.front();
00524 
00525                 <font class="comment">// Is the cloud do not have another reference in the list add it now because it should be processed</font>
00526                 sint32 CloudIndexToAdd = -1;
00527                 <font class="keywordflow">if</font> ((<a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>[FrontCSE.CloudIndex] == <font class="keyword">true</font>) &amp;&amp; 
00528                         (       (<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[FrontCSE.CloudIndex].ValidPos == <font class="keyword">false</font>) ||
00529                                 ((<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[FrontCSE.CloudIndex].ValidPos == <font class="keyword">true</font>) &amp;&amp;
00530                                 (<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[FrontCSE.CloudIndex].Pos == <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.begin()))
00531                         ))
00532                 {
00533                         <font class="comment">// It should be added now !</font>
00534                         CloudIndexToAdd = FrontCSE.CloudIndex;
00535                         FrontCSE.DeltaNextCalc = <a class="code" href="cloud__scape_8cpp.html#a3">QUEUE_SIZE</a>;
00536                 }
00537                 <font class="keywordflow">else</font>
00538                 {
00539                         <font class="comment">// Choose a Cloud Index To Add at the end of the list</font>
00540                         uint32 nPeriodeMax = <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud+<a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.NbCloud/10;
00541                         sint32 Priority = -10000;
00542                         uint32 i;
00543 
00544                         <font class="keywordtype">float</font> sumPrior = 0.0f;
00545                         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>; ++i)
00546                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>[i])
00547                         {
00548                                 <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> &amp;rC = <a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>[i];
00549                                 <font class="keywordtype">float</font> ExtrapolatedTime = ((0.04f/<a class="code" href="classNL3D_1_1CCloudScape.html#o0">_NbHalfCloudToUpdate</a>) * <a class="code" href="cloud__scape_8cpp.html#a3">QUEUE_SIZE</a> * 2);
00550                                 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = rC.getLastX () + ExtrapolatedTime * <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.WindSpeed;
00551                                 <font class="comment">//float d = sqrtf(SQR(x+rC.getSizeX()/2-Viewer.x)+SQR(rC.getY()+rC.getSizeY()/2-Viewer.y)+</font>
00552                                 <font class="comment">//              SQR(rC.getZ()+rC.getSizeZ()/2-Viewer.z));</font>
00553                                 <font class="keywordtype">float</font> d = <a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>+rC.getSizeX()/2-Viewer.x)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(rC.getY()+rC.getSizeY()/2-Viewer.y)+
00554                                                 <a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(rC.getZ()+rC.getSizeZ()/2-Viewer.z);
00555                                 <font class="keywordtype">float</font> d05 = sqrtf(d);
00556                                 <font class="keywordtype">float</font> d025 = sqrtf(d05);
00557                                 <font class="keywordtype">float</font> d075 = d05*d025;
00558 
00559                                 <a class="code" href="classNL3D_1_1CCloudScape.html#o22">_ExtrapolatedPriorities</a>[i] = 1.0f / d075;
00560                                 sumPrior += <a class="code" href="classNL3D_1_1CCloudScape.html#o22">_ExtrapolatedPriorities</a>[i];
00561                         }
00562 
00563                         sint32 sumJeton = 0;
00564                         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>; ++i)
00565                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>[i])
00566                         {
00567                                 <font class="comment">// Normalize priorities</font>
00568                                 <font class="keywordtype">float</font> factor = ((float)<a class="code" href="cloud__scape_8cpp.html#a3">QUEUE_SIZE</a>) / sumPrior;
00569                                 sint32 nbJeton = (sint32)(0.5f+(factor * <a class="code" href="classNL3D_1_1CCloudScape.html#o22">_ExtrapolatedPriorities</a>[i]));
00570 
00571                                 <font class="keywordflow">if</font> (nbJeton &lt; 1)
00572                                         nbJeton = 1;
00573 
00574                                 <a class="code" href="classNL3D_1_1CCloudScape.html#o22">_ExtrapolatedPriorities</a>[i] = (float)nbJeton;
00575                                 sumJeton += nbJeton;
00576                         }
00577 
00578                         <font class="keywordflow">if</font> (sumJeton &gt; <a class="code" href="cloud__scape_8cpp.html#a3">QUEUE_SIZE</a>)
00579                         {
00580                                 <font class="keywordflow">do</font>
00581                                 {
00582                                         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>; ++i)
00583                                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>[i])
00584                                         {
00585                                                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o22">_ExtrapolatedPriorities</a>[i] &gt; 1)
00586                                                 {
00587                                                         <a class="code" href="classNL3D_1_1CCloudScape.html#o22">_ExtrapolatedPriorities</a>[i] -= 1;
00588                                                         --sumJeton;
00589                                                         <font class="keywordflow">if</font> (sumJeton == <a class="code" href="cloud__scape_8cpp.html#a3">QUEUE_SIZE</a>) <font class="keywordflow">break</font>;
00590                                                 }
00591                                         }
00592                                 }
00593                                 <font class="keywordflow">while</font> (sumJeton &gt; <a class="code" href="cloud__scape_8cpp.html#a3">QUEUE_SIZE</a>);
00594                         }
00595 
00596                         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>; ++i)
00597                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>[i])
00598                         {                               
00599                                 <font class="comment">// Cloud Period</font>
00600                                 sint32 newPriority = nPeriodeMax;
00601                                 <font class="comment">// Is there a last entry in array ?</font>
00602                                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[i].ValidPos == <font class="keyword">true</font>)
00603                                 {
00604                                         SCloudSchedulerEntry &amp;rLastCSE = *<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[i].Pos;
00605                                         newPriority = (sint32)(<a class="code" href="cloud__scape_8cpp.html#a3">QUEUE_SIZE</a>/<a class="code" href="classNL3D_1_1CCloudScape.html#o22">_ExtrapolatedPriorities</a>[i]);
00606                                         newPriority = (<a class="code" href="classNL3D_1_1CCloudScape.html#o21">_FrameCounter</a> -  rLastCSE.Frame) - newPriority;
00607                                 }
00608                                 <font class="keywordflow">else</font>
00609                                 {
00610                                         newPriority = 10000;
00611                                 }
00612                                 <font class="keywordflow">if</font> (newPriority &gt; Priority)
00613                                 {
00614                                         Priority = newPriority;
00615                                         CloudIndexToAdd = i;
00616                                 }
00617                         }
00618                         <a class="code" href="debug_8h.html#a6">nlassert</a> (CloudIndexToAdd != -1);
00619                 }
00620 
00621                 <font class="comment">// Ok now we have a good cloud index to add so make the new cloud entry</font>
00622                 SCloudSchedulerEntry newCSE;
00623 
00624                 newCSE.CloudIndex = CloudIndexToAdd;
00625                 newCSE.Frame = <a class="code" href="classNL3D_1_1CCloudScape.html#o21">_FrameCounter</a>;
00626                 newCSE.Ambient = <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Ambient;
00627                 newCSE.Diffuse = <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.Diffuse;
00628                 newCSE.Power = <a class="code" href="classNL3D_1_1CCloudScape.html#o8">_CloudPower</a>[CloudIndexToAdd];
00629 
00630                 <font class="comment">// If the cloud where added previously to the list</font>
00631                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[CloudIndexToAdd].ValidPos == <font class="keyword">true</font>)
00632                 {
00633                         <font class="comment">// This means that the cloud were added from a long time ago</font>
00634                         SCloudSchedulerEntry &amp;lastCSE = *<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[CloudIndexToAdd].Pos;
00635                         sint32 delta = <a class="code" href="classNL3D_1_1CCloudScape.html#o21">_FrameCounter</a> - lastCSE.Frame;                   
00636                         lastCSE.DeltaNextCalc = delta;
00637 
00638                         <font class="comment">// But the cloud can be removed (if so we have to not process it anymore)</font>
00639                         <font class="keywordflow">if</font> (newCSE.Power == 0)
00640                                 <a class="code" href="classNL3D_1_1CCloudScape.html#o9">_ShouldProcessCloud</a>[CloudIndexToAdd] = <font class="keyword">false</font>;
00641                 }
00642                 <font class="keywordflow">else</font>
00643                 {
00644                         <font class="comment">// No the cloud do not appear previously in the list... So its a new one</font>
00645                         <a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>[CloudIndexToAdd].reset (<a class="code" href="classNL3D_1_1CCloudScape.html#o30">_ViewerCam</a>);
00646                 }
00647 
00648                 <font class="comment">// If the last cloud occurence of the cloud appear at beginning so no more occurence in list</font>
00649                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[FrontCSE.CloudIndex].Pos == <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.begin())
00650                         <a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[FrontCSE.CloudIndex].ValidPos = <font class="keyword">false</font>;
00651 
00652                 <a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[CloudIndexToAdd].Pos = <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.insert(<a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.end(), newCSE);
00653                 <a class="code" href="classNL3D_1_1CCloudScape.html#o20">_CloudSchedulerLastAdded</a>[CloudIndexToAdd].ValidPos = <font class="keyword">true</font>;
00654 <font class="comment">//              _CloudSchedulerLastAdded[CloudIndexToAdd].Pos = _CloudScheduler.end()-1;</font>
00655                 <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.pop_front ();
00656                 ++<a class="code" href="classNL3D_1_1CCloudScape.html#o21">_FrameCounter</a>;
00657                 <font class="comment">// End of scheduling</font>
00658 
00659                 <font class="comment">// Get the cloud to process (this must be the next occurence of front cloud)</font>
00660                 <a class="code" href="classstd_1_1list.html">std::list&lt;SCloudSchedulerEntry&gt;</a>::iterator it = <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.begin();
00661                 <font class="keywordflow">while</font> (it != <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.end())
00662                 {
00663                         SCloudSchedulerEntry &amp;rCSE = *it;
00664                         <font class="keywordflow">if</font> (rCSE.CloudIndex == FrontCSE.CloudIndex)
00665                                 <font class="keywordflow">break</font>;
00666                         ++it;
00667                 }
00668 
00669                 SCloudSchedulerEntry CSEToCalc;
00670                 <font class="comment">// The cloud is no more present in the list</font>
00671                 <font class="keywordflow">if</font> (it == <a class="code" href="classNL3D_1_1CCloudScape.html#o18">_CloudScheduler</a>.end())
00672                 {
00673                         FrontCSE.DeltaNextCalc = 1;
00674                         CSEToCalc = FrontCSE;
00675                 }
00676                 <font class="keywordflow">else</font>
00677                 {
00678                         CSEToCalc = *it;
00679                 }
00680 
00681                 <a class="code" href="classNL3D_1_1CCloudScape.html#o6">_CurrentCloudInProcess</a> = &amp;<a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>[CSEToCalc.CloudIndex];
00682                 <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> &amp;c = *<a class="code" href="classNL3D_1_1CCloudScape.html#o6">_CurrentCloudInProcess</a>;
00683 
00684                 <font class="comment">// To go from Front cloud to CSEToCalc cloud we should take the front DeltaNextCalc</font>
00685 
00686                 <a class="code" href="classNL3D_1_1CCloudScape.html#o7">_CurrentCloudInProcessFuturTime</a> = ((0.04/<a class="code" href="classNL3D_1_1CCloudScape.html#o0">_NbHalfCloudToUpdate</a>) * FrontCSE.DeltaNextCalc * 2);
00687                 c.setX ((<font class="keywordtype">float</font>)(c.getLastX() +  <a class="code" href="classNL3D_1_1CCloudScape.html#o7">_CurrentCloudInProcessFuturTime</a> * <a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.WindSpeed));
00688 
00689                 <font class="keywordtype">float</font> d2D = sqrtf(<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getX()+c.getSizeX()/2-Viewer.x)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getY()+c.getSizeY()/2-Viewer.y));
00690 
00691                 <font class="keywordflow">if</font> (d2D &gt; <a class="code" href="cloud__scape_8cpp.html#a1">MAX_DIST</a>)
00692                         c.CloudDistAtt = 255;
00693                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (d2D &gt; (<a class="code" href="cloud__scape_8cpp.html#a1">MAX_DIST</a>-100.0f))
00694                         c.CloudDistAtt = (uint8)(255*((d2D-(<a class="code" href="cloud__scape_8cpp.html#a1">MAX_DIST</a>-100.0f))/100.0f));
00695                 <font class="keywordflow">else</font>
00696                         c.CloudDistAtt = 0;
00697 
00698                 c.LastCloudPower = c.CloudPower;
00699                 c.CloudPower = CSEToCalc.Power;
00700                 c.CloudDiffuse = CSEToCalc.Diffuse;
00701                 c.CloudAmbient = CSEToCalc.Ambient;
00702 
00703                 c.anim (<a class="code" href="classNL3D_1_1CCloudScape.html#o7">_CurrentCloudInProcessFuturTime</a>*<a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.CloudSpeed, 
00704                                 <a class="code" href="classNL3D_1_1CCloudScape.html#o7">_CurrentCloudInProcessFuturTime</a>*<a class="code" href="classNL3D_1_1CCloudScape.html#o10">_CurrentCSS</a>.WindSpeed);
00705 
00706                 c.generate (<a class="code" href="classNL3D_1_1CCloudScape.html#o16">_Noise3D</a>);
00707 
00708         }
00709         <font class="keywordflow">else</font>
00710         {
00711                 <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> &amp;c = *<a class="code" href="classNL3D_1_1CCloudScape.html#o6">_CurrentCloudInProcess</a>;
00712 
00713                 c.Time = 0;
00714                 c.FuturTime = <a class="code" href="classNL3D_1_1CCloudScape.html#o7">_CurrentCloudInProcessFuturTime</a>;
00715                 c.light();
00716 
00717                 <font class="keywordflow">if</font> (c.getX() &gt; <a class="code" href="cloud__scape_8cpp.html#a1">MAX_DIST</a>)
00718                 {
00719                         c.setX (c.getX() - (2 * <a class="code" href="cloud__scape_8cpp.html#a1">MAX_DIST</a>));
00720                         c.setLooping ();
00721                 }
00722                 
00723                 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a> = sqrtf(<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getSizeX()/2)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getSizeY()/2)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getSizeZ()/2));
00724                 <font class="keywordtype">float</font> d2D = sqrtf(<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getX()+c.getSizeX()/2-Viewer.x)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getY()+c.getSizeY()/2-Viewer.y));
00725                 <font class="keywordtype">float</font> d = sqrtf(<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getX()+c.getSizeX()/2-Viewer.x)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getY()+c.getSizeY()/2-Viewer.y)+
00726                                                 <a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getZ()+c.getSizeZ()/2-Viewer.z));
00727                 uint32 lookAtSize = (uint32)(<a class="code" href="classNL3D_1_1CCloudScape.html#o24">_LODQualityThreshold</a>*<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>/d);
00728                 lookAtSize = <a class="code" href="namespaceNLMISC.html#a223">raiseToNextPowerOf2</a> (lookAtSize);
00729                 <font class="keywordflow">if</font> (lookAtSize &gt; 128) lookAtSize = 128;
00730 
00731                 c.genBill (<a class="code" href="classNL3D_1_1CCloudScape.html#o30">_ViewerCam</a>, lookAtSize);
00732         }
00733         <a class="code" href="classNL3D_1_1CCloudScape.html#o5">_Generate</a> = !<a class="code" href="classNL3D_1_1CCloudScape.html#o5">_Generate</a>;
00734 }
00735 
00736 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00737"></a><a class="code" href="classNL3D_1_1CCloudScape.html#a5">00737</a> <font class="keywordtype">void</font> CCloudScape::render ()
00738 {
00739         uint32 i, j;
00740         
00741         CVector Viewer = CVector (0,0,0);
00742 
00743         CMatrix viewMat;
00744         viewMat = <a class="code" href="classNL3D_1_1CCloudScape.html#o30">_ViewerCam</a>-&gt;<a class="code" href="classNL3D_1_1ITransformable.html#a2">getMatrix</a> ();
00745         viewMat.setPos(CVector(0,0,0));
00746         viewMat.invert ();
00747         CScissor <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>;
00748         <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.initFullScreen ();
00749         <a class="code" href="classNL3D_1_1CCloudScape.html#o26">_Driver</a>-&gt;<a class="code" href="classNL3D_1_1IDriver.html#a52">setupScissor</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>);
00750         CViewport <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>;
00751         <a class="code" href="classNL3D_1_1CCloudScape.html#o26">_Driver</a>-&gt;<a class="code" href="classNL3D_1_1IDriver.html#a51">setupViewport</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>);
00752         CFrustum f = <a class="code" href="classNL3D_1_1CCloudScape.html#o30">_ViewerCam</a>-&gt;<a class="code" href="classNL3D_1_1CCamera.html#a1">getFrustum</a>();
00753         <a class="code" href="classNL3D_1_1CCloudScape.html#o26">_Driver</a>-&gt;<a class="code" href="classNL3D_1_1IDriver.html#a23">setFrustum</a> (f.Left, f.Right, f.Bottom, f.Top, f.Near, f.Far, f.Perspective);
00754         <a class="code" href="classNL3D_1_1CCloudScape.html#o26">_Driver</a>-&gt;<a class="code" href="classNL3D_1_1IDriver.html#a24">setupViewMatrix</a> (viewMat);
00755         <a class="code" href="classNL3D_1_1CCloudScape.html#o26">_Driver</a>-&gt;<a class="code" href="classNL3D_1_1IDriver.html#a26">setupModelMatrix</a> (CMatrix::Identity);
00756 
00757         uint32 nNbCloudToRender = 0;
00758 
00759         <font class="keywordflow">for</font> (i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>; ++i)
00760         {
00761                 <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> &amp;c = <a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>[i];
00762                 SSortedCloudEntry &amp;sce = <a class="code" href="classNL3D_1_1CCloudScape.html#o23">_SortedClouds</a>[nNbCloudToRender];
00763                 sce.Cloud = &amp;c;
00764                 sce.Distance = sqrtf(<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getX()+c.getSizeX()/2-Viewer.x)+<a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getY()+c.getSizeY()/2-Viewer.y)+
00765                                                 <a class="code" href="cloud__scape_8cpp.html#a0">SQR</a>(c.getZ()+c.getSizeZ()/2-Viewer.z));
00766                 nNbCloudToRender++;
00767         }
00768 
00769         <font class="keywordflow">for</font> (i = 0; i &lt; nNbCloudToRender-1; ++i)
00770         <font class="keywordflow">for</font> (j = i+1; j &lt; nNbCloudToRender; ++j)
00771         {
00772                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CCloudScape.html#o23">_SortedClouds</a>[i].Distance &lt; <a class="code" href="classNL3D_1_1CCloudScape.html#o23">_SortedClouds</a>[j].Distance)
00773                 {
00774                         SSortedCloudEntry sceTmp = <a class="code" href="classNL3D_1_1CCloudScape.html#o23">_SortedClouds</a>[i];
00775                         <a class="code" href="classNL3D_1_1CCloudScape.html#o23">_SortedClouds</a>[i] = <a class="code" href="classNL3D_1_1CCloudScape.html#o23">_SortedClouds</a>[j];
00776                         <a class="code" href="classNL3D_1_1CCloudScape.html#o23">_SortedClouds</a>[j] = sceTmp;
00777                 }
00778         }
00779 
00780         <font class="keywordflow">for</font> (i = 0; i &lt; nNbCloudToRender; ++i)
00781         {
00782                 <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> *pC = <a class="code" href="classNL3D_1_1CCloudScape.html#o23">_SortedClouds</a>[i].Cloud;
00783                 <font class="keywordflow">if</font> ((pC-&gt;CloudPower &gt; 0) || (pC-&gt;LastCloudPower &gt; 0))
00784                         pC-&gt;dispBill (<a class="code" href="classNL3D_1_1CCloudScape.html#o30">_ViewerCam</a>);
00785         }
00786 }
00787 
00788 <font class="comment">// ------------------------------------------------------------------------------------------------</font>
<a name="l00789"></a><a class="code" href="classNL3D_1_1CCloudScape.html#a6">00789</a> uint32 CCloudScape::getMemSize()
00790 {
00791         uint32 nMemSize = 0;
00792         <font class="keywordflow">for</font> (uint32 i = 0; i &lt; <a class="code" href="cloud__scape_8cpp.html#a2">MAX_CLOUDS</a>; ++i)
00793         {
00794                 <a class="code" href="classNL3D_1_1CCloudScape.html#l0">CCloud</a> &amp;c = <a class="code" href="classNL3D_1_1CCloudScape.html#o17">_AllClouds</a>[i];
00795                 nMemSize += c.getMemSize();
00796         }
00797         <font class="keywordflow">return</font> nMemSize;
00798 }
00799 
00800 } <font class="comment">// namespace NL3D</font>
00801 
</pre></div>

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