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

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

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

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

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

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

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

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>landscapevb_allocator.cpp</h1><a href="landscapevb__allocator_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
00027 
00028 <font class="preprocessor">#include "<a class="code" href="landscapevb__allocator_8h.html">3d/landscapevb_allocator.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="driver_8h.html">3d/driver.h</a>"</font>
00030 
00031 
00032 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
00033 
00034 <font class="keyword">namespace </font>NL3D 
00035 {
00036 
00037 <font class="comment">/*</font>
00038 <font class="comment">        Once a reallocation of a VBHard occurs, how many vertices we add to the re-allocation, to avoid </font>
00039 <font class="comment">        as possible reallocations.</font>
00040 <font class="comment">*/</font>
<a name="l00041"></a><a class="code" href="landscapevb__allocator_8cpp.html#a0">00041</a> <font class="preprocessor">#define NL3D_LANDSCAPE_VERTEX_ALLOCATE_SECURITY         1024</font>
00042 <font class="preprocessor"></font><font class="comment">/*</font>
00043 <font class="comment">        The start size of the array.</font>
00044 <font class="comment">*/</font>
<a name="l00045"></a><a class="code" href="landscapevb__allocator_8cpp.html#a1">00045</a> <font class="preprocessor">#define NL3D_LANDSCAPE_VERTEX_ALLOCATE_START            4048</font>
00046 <font class="preprocessor"></font>
00047 
<a name="l00048"></a><a class="code" href="landscapevb__allocator_8cpp.html#a2">00048</a> <font class="preprocessor">#define NL3D_VERTEX_FREE_MEMORY_RESERVE 1024</font>
00049 <font class="preprocessor"></font><font class="comment">// 65000 is a maximum because of GeForce limitations.</font>
<a name="l00050"></a><a class="code" href="landscapevb__allocator_8cpp.html#a3">00050</a> <font class="preprocessor">#define NL3D_VERTEX_MAX_VERTEX_VBHARD   40000</font>
00051 <font class="preprocessor"></font>
00052 
00053 <font class="comment">// ***************************************************************************</font>
<a name="l00054"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#a0">00054</a> CLandscapeVBAllocator::CLandscapeVBAllocator(TType <a class="code" href="driver__opengl__extension__def_8h.html#a251">type</a>)
00055 {
00056         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o0">_Type</a>= <a class="code" href="driver__opengl__extension__def_8h.html#a251">type</a>;
00057         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o2">_VertexFreeMemory</a>.reserve(<a class="code" href="landscapevb__allocator_8cpp.html#a2">NL3D_VERTEX_FREE_MEMORY_RESERVE</a>);
00058 
00059         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o1">_ReallocationOccur</a>= <font class="keyword">false</font>;
00060         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>= 0;
00061         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_3">_VBHardOk</a>= <font class="keyword">false</font>;
00062         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_6">_BufferLocked</a>= <font class="keyword">false</font>;
00063 
00064         <font class="keywordflow">for</font>(<a class="code" href="types__nl_8h.html#a14">uint</a> i=0;i&lt;<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_0u0">MaxVertexProgram</a>;i++)
00065                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[i]= NULL;
00066 }
00067 
00068 <font class="comment">// ***************************************************************************</font>
<a name="l00069"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#a1">00069</a> CLandscapeVBAllocator::~CLandscapeVBAllocator()
00070 {
00071         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#a3">clear</a>();
00072 }
00073 
00074 
00075 <font class="comment">// ***************************************************************************</font>
<a name="l00076"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#a2">00076</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::updateDriver(IDriver *driver)
00077 {
00078         <font class="comment">// test change of driver.</font>
00079         <a class="code" href="debug_8h.html#a6">nlassert</a>(driver);
00080         <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>==NULL || driver!=<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a> )
00081         {
00082                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_0">deleteVertexBuffer</a>();
00083                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>= driver;
00084                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_3">_VBHardOk</a>= <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>-&gt;supportVertexBufferHard();
00085 
00086                 <font class="comment">// If change of driver, delete the VertexProgram first, if any</font>
00087                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_1">deleteVertexProgram</a>();
00088                 <font class="comment">// Then rebuild VB format, and VertexProgram, if needed.</font>
00089                 <font class="comment">// Do it only if VP supported by GPU.</font>
00090                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_2">setupVBFormatAndVertexProgram</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>-&gt;isVertexProgramSupported()  &amp;&amp; !<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>-&gt;isVertexProgramEmulated());
00091 
00092                 <font class="comment">// must reallocate the VertexBuffer.</font>
00093                 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>&gt;0 )
00094                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_1">allocateVertexBuffer</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>);
00095         }
00096         <font class="keywordflow">else</font>
00097         {
00098                 <font class="comment">// if VBHard possible, and if vbHardDeleted but space needed, reallocate.</font>
00099                 <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_3">_VBHardOk</a> &amp;&amp; <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>==NULL &amp;&amp; <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>&gt;0 )
00100                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_1">allocateVertexBuffer</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>);
00101         }
00102 
00103 }
00104 
00105 
00106 <font class="comment">// ***************************************************************************</font>
<a name="l00107"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#a3">00107</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::clear()
00108 {
00109         <font class="comment">// clear list.</font>
00110         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o2">_VertexFreeMemory</a>.clear();
00111         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>= 0;
00112 
00113         <font class="comment">// delete the VB.</font>
00114         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_0">deleteVertexBuffer</a>();
00115 
00116         <font class="comment">// delete vertex Program, if any</font>
00117         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_1">deleteVertexProgram</a>();
00118 
00119         <font class="comment">// clear other states.</font>
00120         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o1">_ReallocationOccur</a>= <font class="keyword">false</font>;
00121         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>= NULL;
00122         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_3">_VBHardOk</a>= <font class="keyword">false</font>;
00123 }
00124 
00125 
00126 
00127 <font class="comment">// ***************************************************************************</font>
<a name="l00128"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z492_1">00128</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::resetReallocation()
00129 {
00130         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o1">_ReallocationOccur</a>= <font class="keyword">false</font>;
00131 }
00132 
00133 
00134 
00135 <font class="comment">// ***************************************************************************</font>
00136 <font class="comment">// ***************************************************************************</font>
00137 <font class="comment">// allocation.</font>
00138 <font class="comment">// ***************************************************************************</font>
00139 <font class="comment">// ***************************************************************************</font>
00140 
00141 
00142 
00143 <font class="comment">// ***************************************************************************</font>
<a name="l00144"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z492_2">00144</a> <a class="code" href="types__nl_8h.html#a14">uint</a>                    CLandscapeVBAllocator::allocateVertex()
00145 {
00146         <font class="comment">// if no more free, allocate.</font>
00147         <font class="keywordflow">if</font>( <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o2">_VertexFreeMemory</a>.size()==0 )
00148         {
00149                 <font class="comment">// enlarge capacity.</font>
00150                 <a class="code" href="types__nl_8h.html#a14">uint</a>    newResize;
00151                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>==0)
00152                         newResize= <a class="code" href="landscapevb__allocator_8cpp.html#a1">NL3D_LANDSCAPE_VERTEX_ALLOCATE_START</a>;
00153                 <font class="keywordflow">else</font>
00154                         newResize= <a class="code" href="landscapevb__allocator_8cpp.html#a0">NL3D_LANDSCAPE_VERTEX_ALLOCATE_SECURITY</a>;
00155                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>+= newResize;
00156                 <font class="comment">// re-allocate VB.</font>
00157                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_1">allocateVertexBuffer</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>);
00158                 <font class="comment">// resize infos on vertices.</font>
00159                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o3">_VertexInfos</a>.resize(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>);
00160 
00161                 <font class="comment">// Fill list of free elements.</font>
00162                 <font class="keywordflow">for</font>(<a class="code" href="types__nl_8h.html#a14">uint</a> i=0;i&lt;newResize;i++)
00163                 {
00164                         <font class="comment">// create a new entry which points to this vertex.</font>
00165                         <font class="comment">// the list is made so allocation is in growing order.</font>
00166                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o2">_VertexFreeMemory</a>.push_back( <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a> - (i+1) );
00167 
00168                         <font class="comment">// Mark as free the new vertices. (Debug).</font>
00169                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o3">_VertexInfos</a>[<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a> - (i+1)].Free= <font class="keyword">true</font>;
00170                 }
00171         }
00172 
00173         <font class="comment">// get a vertex (pop_back).</font>
00174         <a class="code" href="types__nl_8h.html#a14">uint</a>    <a class="code" href="driver__opengl__extension__def_8h.html#a234">id</a>= <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o2">_VertexFreeMemory</a>.back();
00175         <font class="comment">// delete this vertex free entry.</font>
00176         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o2">_VertexFreeMemory</a>.pop_back();
00177 
00178         <font class="comment">// check and Mark as not free the vertex. (Debug).</font>
00179         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a234">id</a>&lt;<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>);
00180         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o3">_VertexInfos</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a234">id</a>].Free);
00181         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o3">_VertexInfos</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a234">id</a>].Free= <font class="keyword">false</font>;
00182 
00183         <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a234">id</a>;
00184 }
00185 
00186 <font class="comment">// ***************************************************************************</font>
<a name="l00187"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z492_3">00187</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::deleteVertex(<a class="code" href="types__nl_8h.html#a14">uint</a> vid)
00188 {
00189         <font class="comment">// check and Mark as free the vertex. (Debug).</font>
00190         <a class="code" href="debug_8h.html#a6">nlassert</a>(vid&lt;<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o4">_NumVerticesAllocated</a>);
00191         <a class="code" href="debug_8h.html#a6">nlassert</a>(!<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o3">_VertexInfos</a>[vid].Free);
00192         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o3">_VertexInfos</a>[vid].Free= <font class="keyword">true</font>;
00193 
00194         <font class="comment">// Add this vertex to the free list.</font>
00195         <font class="comment">// create a new entry which points to this vertex.</font>
00196         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o2">_VertexFreeMemory</a>.push_back( vid );
00197 }
00198 
00199 
00200 <font class="comment">// ***************************************************************************</font>
<a name="l00201"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z493_0">00201</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::lockBuffer(CFarVertexBufferInfo &amp;farVB)
00202 {
00203         <a class="code" href="debug_8h.html#a6">nlassert</a>( <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o0">_Type</a>==<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#s3s0">Far0</a> || <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o0">_Type</a>==<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#s3s1">Far1</a> );
00204         <font class="comment">// force unlock</font>
00205         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z493_2">unlockBuffer</a>();
00206 
00207         <font class="keywordflow">if</font>(_VBHard)
00208         {
00209                 <font class="keywordtype">void</font>    *<a class="code" href="driver__opengl__extension__def_8h.html#a271">data</a>= <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>-&gt;lock();
00210                 farVB.setupVertexBufferHard(*<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a271">data</a>, <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[0]!=NULL );
00211         }
00212         <font class="keywordflow">else</font>
00213         {
00214                 farVB.setupVertexBuffer(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>, <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[0]!=NULL );
00215         }
00216 
00217         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_6">_BufferLocked</a>= <font class="keyword">true</font>;
00218 }
00219 <font class="comment">// ***************************************************************************</font>
<a name="l00220"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z493_1">00220</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::lockBuffer(CNearVertexBufferInfo &amp;tileVB)
00221 {
00222         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o0">_Type</a>==<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#s3s2">Tile</a>);
00223         <font class="comment">// force unlock</font>
00224         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z493_2">unlockBuffer</a>();
00225 
00226         <font class="keywordflow">if</font>(_VBHard)
00227         {
00228                 <font class="keywordtype">void</font>    *<a class="code" href="driver__opengl__extension__def_8h.html#a271">data</a>= <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>-&gt;lock();
00229                 tileVB.setupVertexBufferHard(*<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a271">data</a>, <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[0]!=NULL );
00230         }
00231         <font class="keywordflow">else</font>
00232         {
00233                 tileVB.setupVertexBuffer(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>, <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[0]!=NULL );
00234         }
00235 
00236         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_6">_BufferLocked</a>= <font class="keyword">true</font>;
00237 }
00238 <font class="comment">// ***************************************************************************</font>
<a name="l00239"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z493_2">00239</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::unlockBuffer()
00240 {
00241         <font class="keywordflow">if</font>(_BufferLocked)
00242         {
00243                 <font class="keywordflow">if</font>(_VBHard)
00244                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>-&gt;unlock();
00245                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_6">_BufferLocked</a>= <font class="keyword">false</font>;
00246         }
00247 }
00248 
00249 
00250 <font class="comment">// ***************************************************************************</font>
00251 <font class="comment">// ***************************************************************************</font>
00252 <font class="comment">// VertexBuffer mgt.</font>
00253 <font class="comment">// ***************************************************************************</font>
00254 <font class="comment">// ***************************************************************************</font>
00255 
00256 
00257 <font class="comment">// ***************************************************************************</font>
<a name="l00258"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z493_4">00258</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::activate(<a class="code" href="types__nl_8h.html#a14">uint</a> vpId)
00259 {
00260         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>);
00261         <a class="code" href="debug_8h.html#a6">nlassert</a>(!<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_6">_BufferLocked</a>);
00262 
00263         <font class="comment">// If enabled, activate Vertex program first.</font>
00264         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[vpId])
00265         {
00266                 <font class="comment">//nlinfo("\nSTARTVP\n%s\nENDVP\n", _VertexProgram[vpId]-&gt;getProgram().c_str());</font>
00267                 <a class="code" href="debug_8h.html#a9">nlverify</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>-&gt;activeVertexProgram(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[vpId]));
00268         }
00269 
00270         <font class="comment">// Activate VB.</font>
00271         <font class="keywordflow">if</font>(_VBHard)
00272                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>-&gt;activeVertexBufferHard(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>);
00273         <font class="keywordflow">else</font>
00274                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>-&gt;activeVertexBuffer(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>);
00275 }
00276 
00277 
00278 <font class="comment">// ***************************************************************************</font>
<a name="l00279"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_0">00279</a> <font class="keywordtype">void</font>                            CLandscapeVBAllocator::deleteVertexBuffer()
00280 {
00281         <font class="comment">// must unlock VBhard before.</font>
00282         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z493_2">unlockBuffer</a>();
00283 
00284         <font class="comment">// test (refptr) if the object still exist in memory.</font>
00285         <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>!=NULL)
00286         {
00287                 <font class="comment">// A vbufferhard should still exist only if driver still exist.</font>
00288                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>!=NULL);
00289 
00290                 <font class="comment">// delete it from driver.</font>
00291                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>-&gt;deleteVertexBufferHard(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>);
00292                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>= NULL;
00293         }
00294 
00295         <font class="comment">// delete the soft one.</font>
00296         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.deleteAllVertices();
00297 }
00298 
00299 
00300 <font class="comment">// ***************************************************************************</font>
<a name="l00301"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_1">00301</a> <font class="keywordtype">void</font>                            CLandscapeVBAllocator::allocateVertexBuffer(<a class="code" href="types__nl_8h.html#a10">uint32</a> numVertices)
00302 {
00303         <font class="comment">// no allocation must be done if the Driver is not setuped, or if the driver has been deleted by refPtr.</font>
00304         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>);
00305 
00306         <font class="comment">// allocate() =&gt;_ReallocationOccur= true;</font>
00307         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o1">_ReallocationOccur</a>= <font class="keyword">true</font>;
00308         <font class="comment">// must unlock VBhard before.</font>
00309         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z493_2">unlockBuffer</a>();
00310 
00311         <font class="comment">// trye to allocate a vbufferhard if possible.</font>
00312         <font class="keywordflow">if</font>( _VBHardOk )
00313         {
00314                 <font class="comment">// delete possible old _VBHard.</font>
00315                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>!=NULL)
00316                 {
00317                         <font class="comment">// VertexBufferHard lifetime &lt; Driver lifetime.</font>
00318                         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>!=NULL);
00319                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>-&gt;deleteVertexBufferHard(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>);
00320                 }
00321 
00322                 <font class="comment">// try to create new one, in AGP Ram</font>
00323                 <font class="comment">// If too many vertices wanted, abort VBHard.</font>
00324                 <font class="keywordflow">if</font>(numVertices &lt;= <a class="code" href="landscapevb__allocator_8cpp.html#a3">NL3D_VERTEX_MAX_VERTEX_VBHARD</a>)
00325                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>= <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_2">_Driver</a>-&gt;createVertexBufferHard(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.getVertexFormat(), <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.getValueTypePointer(), numVertices, IDriver::VBHardAGP);
00326                 <font class="keywordflow">else</font>
00327                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>= NULL;
00328 
00329                 <font class="comment">// If KO, never try again.</font>
00330                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_5">_VBHard</a>==NULL)
00331                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_3">_VBHardOk</a>= <font class="keyword">false</font>;
00332         }
00333 
00334         <font class="comment">// else, or if last fails, allocate a standard VB.</font>
00335         <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_3">_VBHardOk</a>)
00336         {
00337                 <font class="comment">// This always works.</font>
00338                 <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.setNumVertices(numVertices);
00339         }
00340 
00341 
00342         <font class="comment">//nlinfo("Alloc a LandVB %s of %d vertices in %s", _Type==Far0?"Far0":(_Type==Far1?"Far1":"Tile"), numVertices, _VBHardOk?"VBHard":"VBSoft");</font>
00343 }
00344 
00345 
00346 <font class="comment">// ***************************************************************************</font>
00347 <font class="comment">// ***************************************************************************</font>
00348 <font class="comment">// Vertex Program.</font>
00349 <font class="comment">// ***************************************************************************</font>
00350 <font class="comment">// ***************************************************************************</font>
00351 
00352 
00353 <font class="comment">// ***************************************************************************</font>
00354 <font class="comment">/*</font>
00355 <font class="comment">        Common Part. Inputs and constants.</font>
00356 <font class="comment"></font>
00357 <font class="comment">        Inputs</font>
00358 <font class="comment">        --------</font>
00359 <font class="comment">        Standard:</font>
00360 <font class="comment">        v[0] == StartPos.       Hence, It is the SplitPoint of the father face.</font>
00361 <font class="comment">        v[8] == Tex0 (xy) </font>
00362 <font class="comment">        v[9] == Tex1 (xy) (different meanings for Far and Tile).</font>
00363 <font class="comment">        v[13] == Tex2 (xy) (just for Tile mode).</font>
00364 <font class="comment"></font>
00365 <font class="comment">        Geomorph:</font>
00366 <font class="comment">        v[10] == { GeomFactor, MaxNearLimit }</font>
00367 <font class="comment">                * where GeomFactor == max(SizeFaceA, SizeFaceB) * OORefineThreshold.</font>
00368 <font class="comment">                It's means vertices are re-computed when the RefineThreshold setup change.</font>
00369 <font class="comment"></font>
00370 <font class="comment">                * MaxNearLimit= max(nearLimitFaceA, nearLimitFaceB)</font>
00371 <font class="comment"></font>
00372 <font class="comment">        v[11].xyz == EndPos-StartPos</font>
00373 <font class="comment"></font>
00374 <font class="comment">        Alpha: NB: Since only usefull for Far1, v[12] is not in the VB for Far0 and Tile VertexBuffer.</font>
00375 <font class="comment">        v[12] == { TransitionSqrMin, OOTransitionSqrDelta}</font>
00376 <font class="comment">                * TransitionSqrMin, OOTransitionSqrDelta : Alpha transition, see preRender().</font>
00377 <font class="comment">                        There is only 3 values possibles. It depends on Far1 type. Changed in preRender()</font>
00378 <font class="comment"></font>
00379 <font class="comment"></font>
00380 <font class="comment">        Constant:</font>
00381 <font class="comment">        --------</font>
00382 <font class="comment">        Setuped at beginning of CLandscape::render()</font>
00383 <font class="comment">        c[0..3]= ModelViewProjection Matrix.</font>
00384 <font class="comment">        c[4]= {0, 1, 0.5, 0}</font>
00385 <font class="comment">        c[5]= RefineCenter</font>
00386 <font class="comment">        c[6]= {TileDistFarSqr, OOTileDistDeltaSqr, *, *}</font>
00387 <font class="comment">        c[7]= ???</font>
00388 <font class="comment">        c[8..11]= ModelView Matrix (for Fog).</font>
00389 <font class="comment">        c[12]= PZBModelPosition: landscape center / delta Position to apply before multipliying by mviewMatrix</font>
00390 <font class="comment"></font>
00391 <font class="comment"></font>
00392 <font class="comment">        Fog Note:</font>
00393 <font class="comment">        -----------</font>
00394 <font class="comment">        Fog is computed on geomorphed position R1.</font>
00395 <font class="comment">        R1.w==1, and suppose that ModelViewMatrix has no Projection Part.</font>
00396 <font class="comment">        Then Homogenous-coordinate == Non-Homogenous-coordinate.</font>
00397 <font class="comment">        Hence we need only (ModelView*R1).z to get the FogC value.</font>
00398 <font class="comment">        =&gt; computed in just on instruction.</font>
00399 <font class="comment">*/</font>
00400 
00401 
00402 <font class="comment">// ***********************</font>
00403 <font class="comment">/*</font>
00404 <font class="comment">        Common start of the program for Far0, Far1 and Tile mode.</font>
00405 <font class="comment">        It compute the good Geomorphed position.</font>
00406 <font class="comment">        At the end of this program, nothing is written in the output register, and we have in the Temp Registers:</font>
00407 <font class="comment"></font>
00408 <font class="comment">        - R0= scratch</font>
00409 <font class="comment">        - R1= CurrentPos geomorphed</font>
00410 <font class="comment">        - R2.x= sqrDist= (startPos - RefineCenter).sqrnorm(). Usefull for alpha computing.</font>
00411 <font class="comment"></font>
00412 <font class="comment">Pgr Len= 18.</font>
00413 <font class="comment">NB: 9 ope for normal errorMetric, and 9 ope for smoothing with TileNear.</font>
00414 <font class="comment"></font>
00415 <font class="comment">        The C code for this Program is:  (v[] means data is a vertex input, c[] means it is a constant)</font>
00416 <font class="comment">        {</font>
00417 <font class="comment">                // Compute Basic ErrorMetric.</font>
00418 <font class="comment">                sqrDist= (v[StartPos] - c[RefineCenter]).sqrnorm()</font>
00419 <font class="comment">                ErrorMetric= v[GeomFactor] / sqrDist</font>
00420 <font class="comment"></font>
00421 <font class="comment">                // Compute ErrorMetric modified by TileNear transition.</font>
00422 <font class="comment">                f= (c[TileDistFarSqr] - sqrDist) * c[OOTileDistDeltaSqr]</font>
00423 <font class="comment">                clamp(f, 0, 1);</font>
00424 <font class="comment">                // ^4 gives better smooth result</font>
00425 <font class="comment">                f= sqr(f);      f= sqr(f);</font>
00426 <font class="comment">                // interpolate the errorMetric</font>
00427 <font class="comment">                ErrorMetricModified= v[MaxNearLimit]*f + ErrorMetric*(1-f);</font>
00428 <font class="comment"></font>
00429 <font class="comment">                // Take the max errorMetric.</font>
00430 <font class="comment">                ErrorMetric= max(ErrorMetric, ErrorMetricModified);</font>
00431 <font class="comment"></font>
00432 <font class="comment">                // Interpolate StartPos to EndPos, between 1 and 2.</font>
00433 <font class="comment">                f= ErrorMetric - 1;</font>
00434 <font class="comment">                clamp(f, 0, 1);</font>
00435 <font class="comment">                R1= f * v[EndPos-StartPos] + StartPos;</font>
00436 <font class="comment">        }</font>
00437 <font class="comment"></font>
00438 <font class="comment">*/</font>
00439 <font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="namespaceNL3D.html#a87">NL3D_LandscapeCommonStartProgram</a>=
00440 <font class="stringliteral">"!!VP1.0                                                                                                                                                                \n\</font>
00441 <font class="stringliteral">        # compute Basic geomorph into R0.x                                                                                                      \n\</font>
00442 <font class="stringliteral">        ADD     R0, v[0], -c[5];                        # R0 = startPos - RefineCenter                                          \n\</font>
00443 <font class="stringliteral">        DP3     R2.x, R0, R0;                           # R2.x= sqrDist= (startPos - RefineCenter).sqrnorm()\n\</font>
00444 <font class="stringliteral">        RCP     R0.x, R2.x;                                     # R0.x= 1 / sqrDist                                                                     \n\</font>
00445 <font class="stringliteral">        MUL     R0.x, v[10].x, R0.x;            # R0.x= ErrorMetric= GeomFactor / sqrDist                       \n\</font>
00446 <font class="stringliteral">                                                                                                                                                                                \n\</font>
00447 <font class="stringliteral">        # compute Transition Factor To TileNear Geomorph, into R0.z                                                     \n\</font>
00448 <font class="stringliteral">        ADD     R0.z, c[6].x, -R2.x;            # R0.z= TileDistFarSqr - sqrDist                                        \n\</font>
00449 <font class="stringliteral">        MUL     R0.z, R0.z, c[6].y;                     # R0.z= f= (TileDistFarSqr - sqrDist ) * OOTileDistDeltaSqr     \n\</font>
00450 <font class="stringliteral">        MAX R0.z, R0.z, c[4].x;                                                                                                                         \n\</font>
00451 <font class="stringliteral">        MIN R0.z, R0.z, c[4].y;                 # R0.z= f= clamp(f, 0, 1);                                                      \n\</font>
00452 <font class="stringliteral">        MUL R0.z, R0.z, R0.z;                                                                                                                           \n\</font>
00453 <font class="stringliteral">        MUL R0.z, R0.z, R0.z;                   # R0.z= finalFactor= f^4                                                        \n\</font>
00454 <font class="stringliteral">                                                                                                                                                                                \n\</font>
00455 <font class="stringliteral">        # Apply the transition factor to the ErrorMetric =&gt; R0.w= ErrorMetricModified.          \n\</font>
00456 <font class="stringliteral">        ADD     R0.w, v[10].y, -R0.x;           # R0.w= maxNearLimit - ErrorMetric                                      \n\</font>
00457 <font class="stringliteral">        MAD     R0.w, R0.z, R0.w, R0.x; # R0.w= finalFactor * (maxNearLimit - ErrorMetric) + ErrorMetric \n\</font>
00458 <font class="stringliteral">                                                                                                                                                                                \n\</font>
00459 <font class="stringliteral">        # R0.w may be &lt; R0.x; (when the point is very near). Must take the bigger errorMetric.  \n\</font>
00460 <font class="stringliteral">        MAX     R0.x, R0.x, R0.w;                       # R0.x= ErrorMetric Max                                                         \n\</font>
00461 <font class="stringliteral">                                                                                                                                                                                \n\</font>
00462 <font class="stringliteral">        # apply geomorph into R1                                                                                                                        \n\</font>
00463 <font class="stringliteral">        ADD R0.x, R0.x, -c[4].y;                # R0.x= ErrorMetric Max - 1                                                     \n\</font>
00464 <font class="stringliteral">        MAX R0.x, R0.x, c[4].x;                                                                                                                         \n\</font>
00465 <font class="stringliteral">        MIN R0.x, R0.x, c[4].y;                 # R0.x= geomBlend= clamp(R0.x, 0, 1);                           \n\</font>
00466 <font class="stringliteral">                                                                                                                                                                                \n\</font>
00467 <font class="stringliteral">        # NB: Can't use MAD R1.xyz, v[11], R0.x, v[0], because can't acces 2 inputs in one op.  \n\</font>
00468 <font class="stringliteral">        # Hence, can use a MAD to Sub the Landscape Center _PZBModelPosition                            \n\</font>
00469 <font class="stringliteral">        MAD     R1.xyz, v[11], R0.x, -c[12];                                                                                                    \n\</font>
00470 <font class="stringliteral">        # trick here: since R1.w= 0, and v[0].w= 1, final R1.w==1.                                                      \n\</font>
00471 <font class="stringliteral">        ADD     R1, R1, v[0];                           # R1= geomBlend * (EndPos-StartPos) + StartPos          \n\</font>
00472 <font class="stringliteral">"</font>;
00473 
00474 
00475 <font class="comment">// ***********************</font>
00476 <font class="comment">// Test Speed.</font>
00477 <font class="comment">/*"!!VP1.0                                                                                                                                                              \n\</font>
00478 <font class="comment">        # compute Basic geomorph into R0.x                                                                                                      \n\</font>
00479 <font class="comment">        ADD     R0, v[0], -c[5];                        # R0 = startPos - RefineCenter                                          \n\</font>
00480 <font class="comment">        DP3     R2.x, R0, R0;                           # R2.x= sqrDist= (startPos - RefineCenter).sqrnorm()\n\</font>
00481 <font class="comment">        MOV     R1, v[0];                                       # R1= geomBlend * (EndPos-StartPos) + StartPos          \n\</font>
00482 <font class="comment">";</font>
00483 <font class="comment">*/</font>
00484 <font class="keyword">const</font> string <a class="code" href="namespaceNL3D.html#a88">NL3D_LandscapeTestSpeedProgram</a>=
00485 <font class="stringliteral">"       MOV R1, R1; \n  MOV R1, R1; \n  MOV R1, R1; \n  MOV R1, R1; \n  MOV R1, R1; \n\</font>
00486 <font class="stringliteral">        MOV R1, R1; \n  MOV R1, R1; \n  MOV R1, R1; \n  MOV R1, R1; \n  MOV R1, R1; \n\</font>
00487 <font class="stringliteral">"</font>;
00488 
00489 
00490 <font class="comment">// ***********************</font>
00491 <font class="comment">/*</font>
00492 <font class="comment">        Far0:</font>
00493 <font class="comment">                just project, copy uv0 and uv1</font>
00494 <font class="comment">                NB: leave o[COL0] undefined because the material don't care diffuse RGBA here</font>
00495 <font class="comment">*/</font>
00496 <font class="comment">// ***********************</font>
00497 <font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="namespaceNL3D.html#a89">NL3D_LandscapeFar0EndProgram</a>=
00498 <font class="stringliteral">"       # compute in Projection space                                                                                                           \n\</font>
00499 <font class="stringliteral">        DP4 o[HPOS].x, c[0], R1;                                                                                                                        \n\</font>
00500 <font class="stringliteral">        DP4 o[HPOS].y, c[1], R1;                                                                                                                        \n\</font>
00501 <font class="stringliteral">        DP4 o[HPOS].z, c[2], R1;                                                                                                                        \n\</font>
00502 <font class="stringliteral">        DP4 o[HPOS].w, c[3], R1;                                                                                                                        \n\</font>
00503 <font class="stringliteral">        MOV o[TEX0].xy, v[8];                                                                                                                           \n\</font>
00504 <font class="stringliteral">        MOV o[TEX1].xy, v[9];                                                                                                                           \n\</font>
00505 <font class="stringliteral">        DP4     o[FOGC].x, c[10], -R1;          # fogc&gt;0 =&gt; fogc= - (ModelView*R1).z                            \n\</font>
00506 <font class="stringliteral">        END                                                                                                                                                                     \n\</font>
00507 <font class="stringliteral">"</font>;
00508 
00509 
00510 <font class="comment">// ***********************</font>
00511 <font class="comment">/*</font>
00512 <font class="comment">        Far1:</font>
00513 <font class="comment">                Compute Alpha transition.</font>
00514 <font class="comment">                Project, copy uv0 and uv1, </font>
00515 <font class="comment">                NB: leave o[COL0] RGB undefined because the material don't care diffuse RGB</font>
00516 <font class="comment">*/</font>
00517 <font class="comment">// ***********************</font>
00518 <font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="namespaceNL3D.html#a90">NL3D_LandscapeFar1EndProgram</a>=
00519 <font class="stringliteral">"       # compute Alpha Transition                                                                                                                      \n\</font>
00520 <font class="stringliteral">        ADD R0.x, R2.x, -v[12].x;               # R0.x= sqrDist-TransitionSqrMin                                        \n\</font>
00521 <font class="stringliteral">        MUL     R0.x, R0.x, v[12].y;            # R0.x= (sqrDist-TransitionSqrMin) * OOTransitionSqrDelta       \n\</font>
00522 <font class="stringliteral">        MAX R0.x, R0.x, c[4].x;                                                                                                                         \n\</font>
00523 <font class="stringliteral">        MIN o[COL0].w, R0.x, c[4].y;    # col.A= clamp(R0.x, 0, 1);                                                     \n\</font>
00524 <font class="stringliteral">                                                                                                                                                                                \n\</font>
00525 <font class="stringliteral">        # compute in Projection space                                                                                                           \n\</font>
00526 <font class="stringliteral">        DP4 o[HPOS].x, c[0], R1;                                                                                                                        \n\</font>
00527 <font class="stringliteral">        DP4 o[HPOS].y, c[1], R1;                                                                                                                        \n\</font>
00528 <font class="stringliteral">        DP4 o[HPOS].z, c[2], R1;                                                                                                                        \n\</font>
00529 <font class="stringliteral">        DP4 o[HPOS].w, c[3], R1;                                                                                                                        \n\</font>
00530 <font class="stringliteral">        MOV o[TEX0].xy, v[8];                                                                                                                           \n\</font>
00531 <font class="stringliteral">        MOV o[TEX1].xy, v[9];                                                                                                                           \n\</font>
00532 <font class="stringliteral">        DP4     o[FOGC].x, c[10], -R1;          # fogc&gt;0 =&gt; fogc= - (ModelView*R1).z                            \n\</font>
00533 <font class="stringliteral">        END                                                                                                                                                                     \n\</font>
00534 <font class="stringliteral">"</font>;
00535 
00536 
00537 <font class="comment">// ***********************</font>
00538 <font class="comment">/*</font>
00539 <font class="comment">        Tile:</font>
00540 <font class="comment">                just project, copy uv0, uv1.</font>
00541 <font class="comment">                NB: leave o[COL0] undefined because the material don't care diffuse RGBA here</font>
00542 <font class="comment">*/</font>
00543 <font class="comment">// ***********************</font>
00544 <font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="namespaceNL3D.html#a91">NL3D_LandscapeTileEndProgram</a>=
00545 <font class="stringliteral">"       # compute in Projection space                                                                                                           \n\</font>
00546 <font class="stringliteral">        DP4 o[HPOS].x, c[0], R1;                                                                                                                        \n\</font>
00547 <font class="stringliteral">        DP4 o[HPOS].y, c[1], R1;                                                                                                                        \n\</font>
00548 <font class="stringliteral">        DP4 o[HPOS].z, c[2], R1;                                                                                                                        \n\</font>
00549 <font class="stringliteral">        DP4 o[HPOS].w, c[3], R1;                                                                                                                        \n\</font>
00550 <font class="stringliteral">        MOV o[TEX0].xy, v[8];                                                                                                                           \n\</font>
00551 <font class="stringliteral">        MOV o[TEX1].xy, v[9];                                                                                                                           \n\</font>
00552 <font class="stringliteral">        DP4     o[FOGC].x, c[10], -R1;          # fogc&gt;0 =&gt; fogc= - (ModelView*R1).z                            \n\</font>
00553 <font class="stringliteral">        END                                                                                                                                                                     \n\</font>
00554 <font class="stringliteral">"</font>;
00555 
00557 <font class="keyword">const</font> <font class="keywordtype">char</font>* <a class="code" href="namespaceNL3D.html#a92">NL3D_LandscapeTileLightMapEndProgram</a>=
00558 <font class="stringliteral">"       # compute in Projection space                                                                                                           \n\</font>
00559 <font class="stringliteral">        DP4 o[HPOS].x, c[0], R1;                                                                                                                        \n\</font>
00560 <font class="stringliteral">        DP4 o[HPOS].y, c[1], R1;                                                                                                                        \n\</font>
00561 <font class="stringliteral">        DP4 o[HPOS].z, c[2], R1;                                                                                                                        \n\</font>
00562 <font class="stringliteral">        DP4 o[HPOS].w, c[3], R1;                                                                                                                        \n\</font>
00563 <font class="stringliteral">        MOV o[TEX0].xy, v[13];                                                                                                                          \n\</font>
00564 <font class="stringliteral">        MOV o[TEX1].xy, v[9];                                                                                                                           \n\</font>
00565 <font class="stringliteral">        DP4     o[FOGC].x, c[10], -R1;          # fogc&gt;0 =&gt; fogc= - (ModelView*R1).z                            \n\</font>
00566 <font class="stringliteral">        END                                                                                                                                                                     \n\</font>
00567 <font class="stringliteral">"</font>;
00568 
00569 
00570 <font class="comment">// ***************************************************************************</font>
<a name="l00571"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_1">00571</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::deleteVertexProgram()
00572 {
00573         <font class="keywordflow">for</font>(<a class="code" href="types__nl_8h.html#a14">uint</a> i=0;i&lt;<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_0u0">MaxVertexProgram</a>;i++)
00574         {
00575                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[i])
00576                 {
00577                         <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[i];
00578                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[i]= NULL;
00579                 }
00580         }
00581 }
00582 
00583 
00584 <font class="comment">// ***************************************************************************</font>
<a name="l00585"></a><a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_2">00585</a> <font class="keywordtype">void</font>                    CLandscapeVBAllocator::setupVBFormatAndVertexProgram(<font class="keywordtype">bool</font> withVertexProgram)
00586 {
00587         <font class="comment">// If not vertexProgram mode</font>
00588         <font class="keywordflow">if</font>(!withVertexProgram)
00589         {
00590                 <font class="comment">// setup normal VB format.</font>
00591                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o0">_Type</a>==<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#s3s0">Far0</a>)
00592                         <font class="comment">// v3f/t2f0/t2f1</font>
00593                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.setVertexFormat(CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag | CVertexBuffer::TexCoord1Flag);
00594                 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o0">_Type</a>==<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#s3s1">Far1</a>)
00595                         <font class="comment">// v3f/t2f/t2f1/c4ub</font>
00596                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.setVertexFormat(CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag | CVertexBuffer::TexCoord1Flag | CVertexBuffer::PrimaryColorFlag );
00597                 <font class="keywordflow">else</font>
00598                         <font class="comment">// v3f/t2f0/t2f1/t2f2</font>
00599                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.setVertexFormat(CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag | CVertexBuffer::TexCoord1Flag | CVertexBuffer::TexCoord2Flag);
00600         }
00601         <font class="keywordflow">else</font>
00602         {
00603                 <font class="comment">// Else Setup our Vertex Program, and good VBuffers, according to _Type.</font>
00604 
00605                 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o0">_Type</a>==<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#s3s0">Far0</a>)
00606                 {
00607                         <font class="comment">// Build the Vertex Format.</font>
00608                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.clearValueEx();
00609                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a0">NL3D_LANDSCAPE_VPPOS_STARTPOS</a>,   CVertexBuffer::Float3); <font class="comment">// v[0]= StartPos.</font>
00610                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a1">NL3D_LANDSCAPE_VPPOS_TEX0</a>,               CVertexBuffer::Float2); <font class="comment">// v[8]= Tex0.</font>
00611                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a2">NL3D_LANDSCAPE_VPPOS_TEX1</a>,               CVertexBuffer::Float2); <font class="comment">// v[9]= Tex1.</font>
00612                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a4">NL3D_LANDSCAPE_VPPOS_GEOMINFO</a>,   CVertexBuffer::Float2); <font class="comment">// v[10]= GeomInfos.</font>
00613                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a5">NL3D_LANDSCAPE_VPPOS_DELTAPOS</a>,   CVertexBuffer::Float3); <font class="comment">// v[11]= EndPos-StartPos.</font>
00614                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.initEx();
00615 
00616                         <font class="comment">// Init the Vertex Program.</font>
00617                         string  vpgram= string(<a class="code" href="namespaceNL3D.html#a87">NL3D_LandscapeCommonStartProgram</a>) + 
00618                                 string(<a class="code" href="namespaceNL3D.html#a89">NL3D_LandscapeFar0EndProgram</a>);
00619                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[0]= <font class="keyword">new</font> CVertexProgram(vpgram.c_str());
00620                 }
00621                 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#o0">_Type</a>==<a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#s3s1">Far1</a>)
00622                 {
00623                         <font class="comment">// Build the Vertex Format.</font>
00624                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.clearValueEx();
00625                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a0">NL3D_LANDSCAPE_VPPOS_STARTPOS</a>,   CVertexBuffer::Float3); <font class="comment">// v[0]= StartPos.</font>
00626                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a1">NL3D_LANDSCAPE_VPPOS_TEX0</a>,               CVertexBuffer::Float2); <font class="comment">// v[8]= Tex0.</font>
00627                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a2">NL3D_LANDSCAPE_VPPOS_TEX1</a>,               CVertexBuffer::Float2); <font class="comment">// v[9]= Tex1.</font>
00628                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a4">NL3D_LANDSCAPE_VPPOS_GEOMINFO</a>,   CVertexBuffer::Float2); <font class="comment">// v[10]= GeomInfos.</font>
00629                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a5">NL3D_LANDSCAPE_VPPOS_DELTAPOS</a>,   CVertexBuffer::Float3); <font class="comment">// v[11]= EndPos-StartPos.</font>
00630                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a6">NL3D_LANDSCAPE_VPPOS_ALPHAINFO</a>,  CVertexBuffer::Float2); <font class="comment">// v[12]= AlphaInfos.</font>
00631                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.initEx();
00632 
00633                         <font class="comment">// Init the Vertex Program.</font>
00634                         string  vpgram= string(<a class="code" href="namespaceNL3D.html#a87">NL3D_LandscapeCommonStartProgram</a>) + 
00635                                 string(<a class="code" href="namespaceNL3D.html#a90">NL3D_LandscapeFar1EndProgram</a>);
00636                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[0]= <font class="keyword">new</font> CVertexProgram(vpgram.c_str());
00637                 }
00638                 <font class="keywordflow">else</font>
00639                 {
00640                         <font class="comment">// Build the Vertex Format.</font>
00641                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.clearValueEx();
00642                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a0">NL3D_LANDSCAPE_VPPOS_STARTPOS</a>,   CVertexBuffer::Float3); <font class="comment">// v[0]= StartPos.</font>
00643                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a1">NL3D_LANDSCAPE_VPPOS_TEX0</a>,               CVertexBuffer::Float2); <font class="comment">// v[8]= Tex0.</font>
00644                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a2">NL3D_LANDSCAPE_VPPOS_TEX1</a>,               CVertexBuffer::Float2); <font class="comment">// v[9]= Tex1.</font>
00645                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a3">NL3D_LANDSCAPE_VPPOS_TEX2</a>,               CVertexBuffer::Float2); <font class="comment">// v[13]= Tex2.</font>
00646                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a4">NL3D_LANDSCAPE_VPPOS_GEOMINFO</a>,   CVertexBuffer::Float2); <font class="comment">// v[10]= GeomInfos.</font>
00647                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.addValueEx(<a class="code" href="landscapevb__allocator_8h.html#a5">NL3D_LANDSCAPE_VPPOS_DELTAPOS</a>,   CVertexBuffer::Float3); <font class="comment">// v[11]= EndPos-StartPos.</font>
00648                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z494_4">_VB</a>.initEx();
00649 
00650                         <font class="comment">// Init the Vertex Program.</font>
00651                         string  vpgram= string(<a class="code" href="namespaceNL3D.html#a87">NL3D_LandscapeCommonStartProgram</a>) + 
00652                                 string(<a class="code" href="namespaceNL3D.html#a91">NL3D_LandscapeTileEndProgram</a>);
00653                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[0]= <font class="keyword">new</font> CVertexProgram(vpgram.c_str());
00654 
00655                         <font class="comment">// Init the Vertex Program for lightmap pass</font>
00656                         vpgram= string(<a class="code" href="namespaceNL3D.html#a87">NL3D_LandscapeCommonStartProgram</a>) + 
00657                                 string(<a class="code" href="namespaceNL3D.html#a92">NL3D_LandscapeTileLightMapEndProgram</a>);
00658                         <a class="code" href="classNL3D_1_1CLandscapeVBAllocator.html#z495_3">_VertexProgram</a>[1]= <font class="keyword">new</font> CVertexProgram(vpgram.c_str());
00659                 }
00660         }
00661 
00662 }
00663 
00664 
00665 
00666 
00667 } <font class="comment">// NL3D</font>
</pre></div>

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