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
|
<!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> <A CLASS=uplinks HREF='/'><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=><b>nevrax.com</B></FONT></A> </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>
<!-- 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> </td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>tess_block.cpp</h1><a href="tess__block_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
00007 <font class="comment">/* Copyright, 2000 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="tess__block_8h.html">3d/tess_block.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="patch__rdr__pass_8h.html">3d/patch_rdr_pass.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="landscape__face__vector__manager_8h.html">3d/landscape_face_vector_manager.h</a>"</font>
00031
00032
00033 <font class="keyword">namespace </font>NL3D
00034 {
00035
00036
<a name="l00037"></a><a class="code" href="classNL3D_1_1CTessBlock.html#p0">00037</a> CPlane CTessBlock::CurrentPyramid[<a class="code" href="tess__block_8h.html#a0">NL3D_TESSBLOCK_NUM_CLIP_PLANE</a>];
00038
00039
00040
00041 <font class="comment">// ***************************************************************************</font>
<a name="l00042"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a0">00042</a> CTessBlock::CTessBlock()
00043 {
00044 <a class="code" href="classNL3D_1_1CTessBlock.html#o6">_Patch</a>= NULL;
00045
00046 <font class="comment">// init bounding info.</font>
00047 <a class="code" href="classNL3D_1_1CTessBlock.html#o2">Empty</a>= <font class="keyword">true</font>;
00048 <font class="comment">// By default, the tessBlock is clipped.</font>
00049 <a class="code" href="classNL3D_1_1CTessBlock.html#o3">Clipped</a>= <font class="keyword">true</font>;
00050 <a class="code" href="classNL3D_1_1CTessBlock.html#o4">FullFar1</a>= <font class="keyword">false</font>;
00051 <a class="code" href="classNL3D_1_1CTessBlock.html#o5">EmptyFar1</a>= <font class="keyword">false</font>;
00052
00053 <font class="comment">// init vert/face list.</font>
00054 <font class="keywordflow">for</font>(sint i=0;i<<a class="code" href="tess__block_8h.html#a1">NL3D_TESSBLOCK_TILESIZE</a>;i++)
00055 {
00056 <a class="code" href="classNL3D_1_1CTessBlock.html#m3">RdrTileRoot</a>[i]=NULL;
00057 }
00058
00059 <font class="comment">// init LightMap.</font>
00060 <a class="code" href="classNL3D_1_1CTessBlock.html#m9">LightMapRefCount</a>= 0;
00061
00062 <a class="code" href="classNL3D_1_1CTessBlock.html#m6">Far0FaceVector</a>= NULL;
00063 <a class="code" href="classNL3D_1_1CTessBlock.html#m7">Far1FaceVector</a>= NULL;
00064
00065 <a class="code" href="classNL3D_1_1CTessBlock.html#o7">_PrecToModify</a>= NULL;
00066 <a class="code" href="classNL3D_1_1CTessBlock.html#o8">_NextToModify</a>= NULL;
00067
00068 <a class="code" href="classNL3D_1_1CTessBlock.html#m4">FaceTileMaterialRefCount</a>= 0;
00069 <a class="code" href="classNL3D_1_1CTessBlock.html#m5">TileMaterialRefCount</a>= 0;
00070
00071 <font class="comment">// Micro-vegetation.</font>
00072 <a class="code" href="classNL3D_1_1CTessBlock.html#m11">VegetableBlock</a>= NULL;
00073 }
00074
00075
00076 <font class="comment">// ***************************************************************************</font>
<a name="l00077"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a1">00077</a> CTessBlock::~CTessBlock()
00078 {
00079 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTessBlock.html#a24">isInModifyList</a>())
00080 {
00081 <a class="code" href="classNL3D_1_1CTessBlock.html#a26">removeFromModifyList</a>();
00082 }
00083
00084 <font class="comment">// LightMap should be released</font>
00085 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTessBlock.html#m9">LightMapRefCount</a>==0);
00086 }
00087
00088 <font class="comment">// ***************************************************************************</font>
<a name="l00089"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a2">00089</a> <font class="keywordtype">void</font> CTessBlock::init(CPatch *patch)
00090 {
00091 <a class="code" href="classNL3D_1_1CTessBlock.html#o6">_Patch</a>= patch;
00092 }
00093 <font class="comment">// ***************************************************************************</font>
<a name="l00094"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a3">00094</a> CPatch *CTessBlock::getPatch()
00095 {
00096 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CTessBlock.html#o6">_Patch</a>;
00097 }
00098
00099
00100
00101 <font class="comment">// ***************************************************************************</font>
<a name="l00102"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a4">00102</a> <font class="keywordtype">void</font> CTessBlock::extendSphereFirst(<font class="keyword">const</font> CVector &vec)
00103 {
00104 <font class="keywordflow">if</font>(Empty)
00105 {
00106 <a class="code" href="classNL3D_1_1CTessBlock.html#o2">Empty</a>= <font class="keyword">false</font>;
00107 <a class="code" href="classNL3D_1_1CTessBlock.html#o0">BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_0">setCenter</a>(vec);
00108 <a class="code" href="classNL3D_1_1CTessBlock.html#o0">BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_1">setHalfSize</a>(CVector::Null);
00109 }
00110 <font class="keywordflow">else</font>
00111 <a class="code" href="classNL3D_1_1CTessBlock.html#a5">extendSphereAdd</a>(vec);
00112 }
00113
00114 <font class="comment">// ***************************************************************************</font>
<a name="l00115"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a5">00115</a> <font class="keywordtype">void</font> CTessBlock::extendSphereAdd(<font class="keyword">const</font> CVector &vec)
00116 {
00117 <font class="keywordflow">if</font>( !<a class="code" href="classNL3D_1_1CTessBlock.html#o0">BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z265_2">include</a>(vec) )
00118 <a class="code" href="classNL3D_1_1CTessBlock.html#o0">BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_4">extend</a>(vec);
00119 }
00120
00121 <font class="comment">// ***************************************************************************</font>
<a name="l00122"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a6">00122</a> <font class="keywordtype">void</font> CTessBlock::extendSphereCompile()
00123 {
00124 <a class="code" href="classNL3D_1_1CTessBlock.html#o1">BSphere</a>.<a class="code" href="classNLMISC_1_1CBSphere.html#m0">Center</a>= <a class="code" href="classNL3D_1_1CTessBlock.html#o0">BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z264_4">getCenter</a>();
00125 <a class="code" href="classNL3D_1_1CTessBlock.html#o1">BSphere</a>.<a class="code" href="classNLMISC_1_1CBSphere.html#m1">Radius</a>= <a class="code" href="classNL3D_1_1CTessBlock.html#o0">BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z264_8">getRadius</a>();
00126 }
00127
00128
00129 <font class="comment">// ***************************************************************************</font>
<a name="l00130"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a7">00130</a> <font class="keywordtype">void</font> CTessBlock::resetClip()
00131 {
00132 <a class="code" href="classNL3D_1_1CTessBlock.html#o3">Clipped</a>= <font class="keyword">false</font>;
00133 <a class="code" href="classNL3D_1_1CTessBlock.html#o4">FullFar1</a>= <font class="keyword">false</font>;
00134 <a class="code" href="classNL3D_1_1CTessBlock.html#o5">EmptyFar1</a>= <font class="keyword">false</font>;
00135 }
00136
00137
00138 <font class="comment">// ***************************************************************************</font>
<a name="l00139"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a8">00139</a> <font class="keywordtype">void</font> CTessBlock::forceClip()
00140 {
00141 <a class="code" href="classNL3D_1_1CTessBlock.html#o3">Clipped</a>= <font class="keyword">true</font>;
00142 }
00143
00144
00145 <font class="comment">// ***************************************************************************</font>
<a name="l00146"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a9">00146</a> <font class="keywordtype">void</font> CTessBlock::clip()
00147 {
00148 <a class="code" href="classNL3D_1_1CTessBlock.html#o3">Clipped</a>= <font class="keyword">false</font>;
00149 <font class="keywordflow">for</font>(sint i=0;i<<a class="code" href="tess__block_8h.html#a0">NL3D_TESSBLOCK_NUM_CLIP_PLANE</a>;i++)
00150 {
00151 <font class="comment">// If entirely out.</font>
00152 <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CTessBlock.html#o1">BSphere</a>.<a class="code" href="classNLMISC_1_1CBSphere.html#z279_1">clipBack</a>( CTessBlock::CurrentPyramid[i] ))
00153 {
00154 <a class="code" href="classNL3D_1_1CTessBlock.html#o3">Clipped</a>= <font class="keyword">true</font>;
00155 <font class="keywordflow">break</font>;
00156 }
00157 }
00158 }
00159 <font class="comment">// ***************************************************************************</font>
<a name="l00160"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a10">00160</a> <font class="keywordtype">void</font> CTessBlock::clipFar(<font class="keyword">const</font> CVector &refineCenter, <font class="keywordtype">float</font> tileDistNear, <font class="keywordtype">float</font> farTransition)
00161 {
00162 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>= (refineCenter-<a class="code" href="classNL3D_1_1CTessBlock.html#o1">BSphere</a>.<a class="code" href="classNLMISC_1_1CBSphere.html#m0">Center</a>).norm();
00163 <font class="keywordflow">if</font>( (<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>-<a class="code" href="classNL3D_1_1CTessBlock.html#o1">BSphere</a>.<a class="code" href="classNLMISC_1_1CBSphere.html#m1">Radius</a>) > tileDistNear)
00164 {
00165 <a class="code" href="classNL3D_1_1CTessBlock.html#o4">FullFar1</a>= <font class="keyword">true</font>;
00166 }
00167 <font class="keywordflow">else</font>
00168 {
00169 <font class="keywordflow">if</font>( (<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>+<a class="code" href="classNL3D_1_1CTessBlock.html#o1">BSphere</a>.<a class="code" href="classNLMISC_1_1CBSphere.html#m1">Radius</a>) < (tileDistNear-farTransition) )
00170 <a class="code" href="classNL3D_1_1CTessBlock.html#o5">EmptyFar1</a>= <font class="keyword">true</font>;
00171 }
00172 }
00173
00174
00175
00176 <font class="comment">// ***************************************************************************</font>
<a name="l00177"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a21">00177</a> <font class="keywordtype">void</font> CTessBlock::refillFaceVectorFar0()
00178 {
00179 <font class="comment">// If size is not 0.</font>
00180 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTessBlock.html#m2">FarFaceList</a>.size()>0)
00181 {
00182 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTessBlock.html#m6">Far0FaceVector</a>!=NULL);
00183
00184 <font class="comment">// Fill this faceVector, with FarFaceList</font>
00185 CTessFace *pFace;
00186 uint32 *dest= <a class="code" href="classNL3D_1_1CTessBlock.html#m6">Far0FaceVector</a>->TriPtr;
00187 <font class="keywordflow">for</font>(pFace= <a class="code" href="classNL3D_1_1CTessBlock.html#m2">FarFaceList</a>.begin(); pFace; pFace= (CTessFace*)pFace->Next)
00188 {
00189 *(dest++)= pFace->FVBase->Index0;
00190 *(dest++)= pFace->FVLeft->Index0;
00191 *(dest++)= pFace->FVRight->Index0;
00192 }
00193 }
00194 }
00195
00196
00197 <font class="comment">// ***************************************************************************</font>
<a name="l00198"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a15">00198</a> <font class="keywordtype">void</font> CTessBlock::createFaceVectorFar0(CLandscapeFaceVectorManager &mgr)
00199 {
00200 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTessBlock.html#m6">Far0FaceVector</a>==NULL);
00201 <font class="comment">// If size is not 0.</font>
00202 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTessBlock.html#m2">FarFaceList</a>.size()>0)
00203 {
00204 <font class="comment">// Create a faceVector of the wanted triangles size.</font>
00205 <a class="code" href="classNL3D_1_1CTessBlock.html#m6">Far0FaceVector</a>= mgr.createFaceVector(<a class="code" href="classNL3D_1_1CTessBlock.html#m2">FarFaceList</a>.size());
00206
00207 <font class="comment">// init.</font>
00208 <a class="code" href="classNL3D_1_1CTessBlock.html#a21">refillFaceVectorFar0</a>();
00209 }
00210
00211 }
00212 <font class="comment">// ***************************************************************************</font>
<a name="l00213"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a16">00213</a> <font class="keywordtype">void</font> CTessBlock::deleteFaceVectorFar0(CLandscapeFaceVectorManager &mgr)
00214 {
00215 <font class="keywordflow">if</font>(Far0FaceVector)
00216 {
00217 mgr.deleteFaceVector(<a class="code" href="classNL3D_1_1CTessBlock.html#m6">Far0FaceVector</a>);
00218 <a class="code" href="classNL3D_1_1CTessBlock.html#m6">Far0FaceVector</a>= NULL;
00219 }
00220 }
00221
00222 <font class="comment">// ***************************************************************************</font>
<a name="l00223"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a22">00223</a> <font class="keywordtype">void</font> CTessBlock::refillFaceVectorFar1()
00224 {
00225 <font class="comment">// If size is not 0.</font>
00226 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTessBlock.html#m2">FarFaceList</a>.size()>0)
00227 {
00228 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTessBlock.html#m7">Far1FaceVector</a>!=NULL);
00229 <font class="comment">// Fill this faceVector, with FarFaceList</font>
00230 CTessFace *pFace;
00231 uint32 *dest= <a class="code" href="classNL3D_1_1CTessBlock.html#m7">Far1FaceVector</a>->TriPtr;
00232 <font class="keywordflow">for</font>(pFace= <a class="code" href="classNL3D_1_1CTessBlock.html#m2">FarFaceList</a>.begin(); pFace; pFace= (CTessFace*)pFace->Next)
00233 {
00234 *(dest++)= pFace->FVBase->Index1;
00235 *(dest++)= pFace->FVLeft->Index1;
00236 *(dest++)= pFace->FVRight->Index1;
00237 }
00238 }
00239 }
00240
00241 <font class="comment">// ***************************************************************************</font>
<a name="l00242"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a17">00242</a> <font class="keywordtype">void</font> CTessBlock::createFaceVectorFar1(CLandscapeFaceVectorManager &mgr)
00243 {
00244 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CTessBlock.html#m7">Far1FaceVector</a>==NULL);
00245 <font class="comment">// If size is not 0.</font>
00246 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTessBlock.html#m2">FarFaceList</a>.size()>0)
00247 {
00248 <font class="comment">// Create a faceVector of the wanted triangles size.</font>
00249 <a class="code" href="classNL3D_1_1CTessBlock.html#m7">Far1FaceVector</a>= mgr.createFaceVector(<a class="code" href="classNL3D_1_1CTessBlock.html#m2">FarFaceList</a>.size());
00250
00251 <font class="comment">// init.</font>
00252 <a class="code" href="classNL3D_1_1CTessBlock.html#a22">refillFaceVectorFar1</a>();
00253 }
00254 }
00255 <font class="comment">// ***************************************************************************</font>
<a name="l00256"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a18">00256</a> <font class="keywordtype">void</font> CTessBlock::deleteFaceVectorFar1(CLandscapeFaceVectorManager &mgr)
00257 {
00258 <font class="keywordflow">if</font>(Far1FaceVector)
00259 {
00260 mgr.deleteFaceVector(<a class="code" href="classNL3D_1_1CTessBlock.html#m7">Far1FaceVector</a>);
00261 <a class="code" href="classNL3D_1_1CTessBlock.html#m7">Far1FaceVector</a>= NULL;
00262 }
00263 }
00264
00265
00266 <font class="comment">// ***************************************************************************</font>
<a name="l00267"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a23">00267</a> <font class="keywordtype">void</font> CTessBlock::refillFaceVectorTile()
00268 {
00269 <font class="comment">// For all tiles existing, and for all facePass existing, fill the faceVector.</font>
00270 <font class="keywordflow">for</font>(uint tileId=0; tileId<<a class="code" href="tess__block_8h.html#a1">NL3D_TESSBLOCK_TILESIZE</a>; tileId++)
00271 {
00272 <font class="comment">// if tile exist.</font>
00273 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTessBlock.html#m3">RdrTileRoot</a>[tileId])
00274 {
00275 <font class="comment">// For all Pass faces of the tile.</font>
00276 <font class="keywordflow">for</font>(uint facePass=0; facePass<<a class="code" href="landscape__def_8h.html#a1">NL3D_MAX_TILE_FACE</a>; facePass++)
00277 {
00278 CTessList<CTileFace> &faceList= <a class="code" href="classNL3D_1_1CTessBlock.html#m3">RdrTileRoot</a>[tileId]->TileFaceList[facePass];
00279 CLandscapeFaceVector *faceVector= <a class="code" href="classNL3D_1_1CTessBlock.html#m3">RdrTileRoot</a>[tileId]->TileFaceVectors[facePass];
00280 <font class="comment">// If some triangles create them.</font>
00281 <font class="keywordflow">if</font>(faceList.size()>0)
00282 {
00283 <a class="code" href="debug_8h.html#a6">nlassert</a>( faceVector!=NULL );
00284
00285 <font class="comment">// Fill this faceVector, with the TileFaceList</font>
00286 CTileFace *pFace;
00287 uint32 *dest= faceVector->TriPtr;
00288 <font class="keywordflow">for</font>(pFace= faceList.begin(); pFace; pFace= (CTileFace*)pFace->Next)
00289 {
00290 *(dest++)= pFace->V[CTessFace::IdUvBase]->Index;
00291 *(dest++)= pFace->V[CTessFace::IdUvLeft]->Index;
00292 *(dest++)= pFace->V[CTessFace::IdUvRight]->Index;
00293 }
00294 }
00295 }
00296 }
00297 }
00298 }
00299
00300
00301 <font class="comment">// ***************************************************************************</font>
<a name="l00302"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a19">00302</a> <font class="keywordtype">void</font> CTessBlock::createFaceVectorTile(CLandscapeFaceVectorManager &mgr)
00303 {
00304 <font class="comment">// For all tiles existing, and for all facePass existing, create the faceVector.</font>
00305 <font class="keywordflow">for</font>(uint tileId=0; tileId<<a class="code" href="tess__block_8h.html#a1">NL3D_TESSBLOCK_TILESIZE</a>; tileId++)
00306 {
00307 <font class="comment">// if tile exist.</font>
00308 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTessBlock.html#m3">RdrTileRoot</a>[tileId])
00309 {
00310 <font class="comment">// For all Pass faces of the tile.</font>
00311 <font class="keywordflow">for</font>(uint facePass=0; facePass<<a class="code" href="landscape__def_8h.html#a1">NL3D_MAX_TILE_FACE</a>; facePass++)
00312 {
00313 CTessList<CTileFace> &faceList= <a class="code" href="classNL3D_1_1CTessBlock.html#m3">RdrTileRoot</a>[tileId]->TileFaceList[facePass];
00314 CLandscapeFaceVector *&faceVector= <a class="code" href="classNL3D_1_1CTessBlock.html#m3">RdrTileRoot</a>[tileId]->TileFaceVectors[facePass];
00315 <font class="comment">// If some triangles create them.</font>
00316 <font class="keywordflow">if</font>(faceList.size()>0)
00317 {
00318 <font class="comment">// Create a faceVector of the wanted triangles size.</font>
00319 faceVector= mgr.createFaceVector(faceList.size());
00320 }
00321 }
00322 }
00323 }
00324
00325 <font class="comment">// init.</font>
00326 <a class="code" href="classNL3D_1_1CTessBlock.html#a23">refillFaceVectorTile</a>();
00327 }
00328 <font class="comment">// ***************************************************************************</font>
<a name="l00329"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a20">00329</a> <font class="keywordtype">void</font> CTessBlock::deleteFaceVectorTile(CLandscapeFaceVectorManager &mgr)
00330 {
00331 <font class="comment">// For all tiles existing, and for all facePass existing, delete the faceVector.</font>
00332 <font class="keywordflow">for</font>(uint tileId=0; tileId<<a class="code" href="tess__block_8h.html#a1">NL3D_TESSBLOCK_TILESIZE</a>; tileId++)
00333 {
00334 <font class="comment">// if tile exist.</font>
00335 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTessBlock.html#m3">RdrTileRoot</a>[tileId])
00336 {
00337 <font class="comment">// For all Pass faces of the tile.</font>
00338 <font class="keywordflow">for</font>(uint facePass=0; facePass<<a class="code" href="landscape__def_8h.html#a1">NL3D_MAX_TILE_FACE</a>; facePass++)
00339 {
00340 CLandscapeFaceVector *&faceVector= <a class="code" href="classNL3D_1_1CTessBlock.html#m3">RdrTileRoot</a>[tileId]->TileFaceVectors[facePass];
00341 <font class="comment">// If the faceVector exist, delete it.</font>
00342 <font class="keywordflow">if</font>(faceVector)
00343 {
00344 mgr.deleteFaceVector(faceVector);
00345 faceVector= NULL;
00346 }
00347 }
00348 }
00349 }
00350 }
00351
00352
00353 <font class="comment">// ***************************************************************************</font>
<a name="l00354"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a25">00354</a> <font class="keywordtype">void</font> CTessBlock::appendToModifyListAndDeleteFaceVector(CTessBlock &root, CLandscapeFaceVectorManager &mgr)
00355 {
00356 <font class="comment">// If already appened, return.</font>
00357 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CTessBlock.html#a24">isInModifyList</a>())
00358 <font class="keywordflow">return</font>;
00359
00360 <font class="comment">// append to root.</font>
00361 <a class="code" href="classNL3D_1_1CTessBlock.html#o7">_PrecToModify</a>= &root;
00362 <a class="code" href="classNL3D_1_1CTessBlock.html#o8">_NextToModify</a>= root._NextToModify;
00363 <font class="keywordflow">if</font>(root._NextToModify)
00364 root._NextToModify->_PrecToModify= <font class="keyword">this</font>;
00365 root._NextToModify= <font class="keyword">this</font>;
00366
00367 <font class="comment">// Then delete All faceVector that may exist.</font>
00368 <a class="code" href="classNL3D_1_1CTessBlock.html#a16">deleteFaceVectorFar0</a>(mgr);
00369 <a class="code" href="classNL3D_1_1CTessBlock.html#a18">deleteFaceVectorFar1</a>(mgr);
00370 <a class="code" href="classNL3D_1_1CTessBlock.html#a20">deleteFaceVectorTile</a>(mgr);
00371 }
00372 <font class="comment">// ***************************************************************************</font>
<a name="l00373"></a><a class="code" href="classNL3D_1_1CTessBlock.html#a26">00373</a> <font class="keywordtype">void</font> CTessBlock::removeFromModifyList()
00374 {
00375 <font class="comment">// If already removed, return.</font>
00376 <font class="comment">// _PrecToModify must be !NULL</font>
00377 <font class="keywordflow">if</font>(!<a class="code" href="classNL3D_1_1CTessBlock.html#a24">isInModifyList</a>())
00378 <font class="keywordflow">return</font>;
00379
00380 <font class="comment">// unlink.</font>
00381 <a class="code" href="classNL3D_1_1CTessBlock.html#o7">_PrecToModify</a>->_NextToModify= <a class="code" href="classNL3D_1_1CTessBlock.html#o8">_NextToModify</a>;
00382 <font class="keywordflow">if</font>(_NextToModify)
00383 <a class="code" href="classNL3D_1_1CTessBlock.html#o8">_NextToModify</a>->_PrecToModify= <a class="code" href="classNL3D_1_1CTessBlock.html#o7">_PrecToModify</a>;
00384 <a class="code" href="classNL3D_1_1CTessBlock.html#o7">_PrecToModify</a>= NULL;
00385 <a class="code" href="classNL3D_1_1CTessBlock.html#o8">_NextToModify</a>= NULL;
00386 }
00387
00388
00389 } <font class="comment">// NL3D</font>
</pre></div>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|