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
|
<!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> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </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> <A CLASS=uplinks HREF=http://www.nevrax.com><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="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>
<!-- 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> </td>
</tr></table>
<!-- Generated by Doxygen 1.2.2 on Wed May 30 22:01:13 2001 -->
<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:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>landscape.h</h1><a href="landscape_h.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">#ifndef NL_LANDSCAPE_H
</font>00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_LANDSCAPE_H
</font>00028 <font class="preprocessor"></font>
00029
00030 <font class="preprocessor">#include "<a class="code" href="types_nl_h.html">nel/misc/types_nl.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="class_id_h.html">nel/misc/class_id.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="smart_ptr_h.html">nel/misc/smart_ptr.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="triangle_h.html">nel/misc/triangle.h</a>"</font>
00034 <font class="preprocessor">#include "<a class="code" href="3d_zone_h.html">nel/3d/zone.h</a>"</font>
00035 <font class="preprocessor">#include "<a class="code" href="tile_bank_h.html">nel/3d/tile_bank.h</a>"</font>
00036 <font class="preprocessor">#include "<a class="code" href="patch_rdr_pass_h.html">nel/3d/patch_rdr_pass.h</a>"</font>
00037 <font class="preprocessor">#include "<a class="code" href="vertex_buffer_h.html">nel/3d/vertex_buffer.h</a>"</font>
00038 <font class="preprocessor">#include "<a class="code" href="primitive_block_h.html">nel/3d/primitive_block.h</a>"</font>
00039 <font class="preprocessor">#include "<a class="code" href="material_h.html">nel/3d/material.h</a>"</font>
00040 <font class="preprocessor">#include "<a class="code" href="tile_far_bank_h.html">nel/3d/tile_far_bank.h</a>"</font>
00041 <font class="preprocessor">#include "<a class="code" href="texture_near_h.html">nel/3d/texture_near.h</a>"</font>
00042 <font class="preprocessor">#include <map></font>
00043
<a name="l00044"></a><a class="code" href="landscape_h.html#a0">00044</a> <font class="preprocessor">#define NL_MAX_SIZE_OF_TEXTURE_EDGE_SHIFT (NL_MAX_TILES_BY_PATCH_EDGE_SHIFT+NL_NUM_PIXELS_ON_FAR_TILE_EDGE_SHIFT)
</font><a name="l00045"></a><a class="code" href="landscape_h.html#a1">00045</a> <font class="preprocessor"></font><font class="preprocessor">#define NL_MAX_SIZE_OF_TEXTURE_EDGE (1<<NL_MAX_SIZE_OF_TEXTURE_EDGE_SHIFT) // Size max of a far texture edge in pixel
</font>00046 <font class="preprocessor"></font>
00047
00048 <font class="keyword">namespace</font> NL3D
00049 {
00050
00051
00052 <font class="keyword">class </font>CHeightMap;
00053
00054
00055 <font class="comment">// ***************************************************************************</font>
00056 <font class="comment">// The maximum amount of different tiles in world.</font>
<a name="l00057"></a><a class="code" href="namespace_NL3D.html#a32">00057</a> <font class="keyword">const</font> sint NbTilesMax= 65536;
00058 <font class="comment">// Size of a CTextureNear. 256 by default (works everywhere).</font>
00059 <font class="comment">// Texures must be square, because of uvscalebias...</font>
<a name="l00060"></a><a class="code" href="namespace_NL3D.html#a33">00060</a> <font class="keyword">const</font> sint TextureNearSize= 256;
<a name="l00061"></a><a class="code" href="namespace_NL3D.html#a34">00061</a> <font class="keyword">const</font> sint NbTilesByLine= TextureNearSize/NL_TILE_LIGHTMAP_SIZE;
<a name="l00062"></a><a class="code" href="namespace_NL3D.html#a35">00062</a> <font class="keyword">const</font> sint NbTilesByTexture= NbTilesByLine*NbTilesByLine;
00063
00064
00065
00066 <font class="comment">// ***************************************************************************
</font><a name="l00073"></a><a class="code" href="class_NL3D__EBadBind.html">00073</a> <font class="comment"></font><font class="keyword">struct </font>EBadBind : <font class="keyword">public</font> Exception
00074 {
00075 <font class="keyword">private</font>:
<a name="l00076"></a><a class="code" href="class_NL3D__EBadBind.html#o0">00076</a> <font class="keyword">mutable</font> std::string _Output;
00077
00078 <font class="keyword">public</font>:
<a name="l00079"></a><a class="code" href="class_NL3D__EBadBind__CBindError.html">00079</a> <font class="keyword">struct </font>CBindError
00080 {
<a name="l00081"></a><a class="code" href="class_NL3D__EBadBind__CBindError.html#a0">00081</a> CBindError(sint z, sint p)<font class="keyword"> </font>{ZoneId= z; PatchId= p;}
<a name="l00082"></a><a class="code" href="class_NL3D__EBadBind__CBindError.html#m0">00082</a> sint ZoneId;
<a name="l00083"></a><a class="code" href="class_NL3D__EBadBind__CBindError.html#m1">00083</a> sint PatchId;
00084 };
00085
00086
00087 <font class="comment">// The result list of bind errors.</font>
<a name="l00088"></a><a class="code" href="class_NL3D__EBadBind.html#m0">00088</a> std::list<CBindError> BindErrors;
00089
00090 <font class="keyword">public</font>:
<a name="l00091"></a><a class="code" href="class_NL3D__EBadBind.html#a0">00091</a> EBadBind() : Exception( "Landscape Bind Error in (3DSMax indices!! (+1) ): " ) {}
00092 <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *what() <font class="keyword">const</font> <font class="keywordflow">throw</font>();
00093
00094 };
00095
00096
00097
00098 <font class="comment">// ***************************************************************************
</font><a name="l00119"></a><a class="code" href="class_NL3D__CLandscape.html">00119</a> <font class="comment"></font><font class="keyword">class </font>CLandscape : <font class="keyword">public</font> NLMISC::CRefCount
00120 {
00121 <font class="keyword">public</font>:
00122 <font class="comment">// The bank of tiles information.</font>
<a name="l00123"></a><a class="code" href="class_NL3D__CLandscape.html#m0">00123</a> CTileBank TileBank;
<a name="l00124"></a><a class="code" href="class_NL3D__CLandscape.html#m1">00124</a> CTileFarBank TileFarBank;
00125
00126 <font class="keyword">public</font>:
00127
00129 CLandscape();
00131 ~CLandscape();
00132
00133
00135 <font class="comment">// @{
</font>00137 <font class="comment"> void init();</font>
00138
00144 <font class="keywordtype">bool</font> addZone(<font class="keyword">const</font> CZone &newZone);
00145
00151 <font class="keywordtype">bool</font> removeZone(uint16 zoneId);
00152
00154 <font class="keywordtype">void</font> clear();
00155
00157 <font class="keywordtype">void</font> checkBinds() <font class="keywordflow">throw</font>(EBadBind);
00159 <font class="keywordtype">void</font> checkBinds(uint16 zoneId) <font class="keywordflow">throw</font>(EBadBind);
00160
00166 <font class="keywordtype">bool</font> initTileBanks ();
00167 <font class="comment">// @}</font>
00168
00169
00171 <font class="comment">// @{
</font>00173 <font class="comment"> void setTileNear (float tileNear);
</font><a name="l00175"></a><a class="code" href="class_NL3D__CLandscape.html#a10">00175</a> <font class="comment"> float getTileNear () const {return _TileDistNear;}
</font><a name="l00177"></a><a class="code" href="class_NL3D__CLandscape.html#a11">00177</a> <font class="comment"> void setThreshold (float thre) {_Threshold= thre;}
</font><a name="l00179"></a><a class="code" href="class_NL3D__CLandscape.html#a12">00179</a> <font class="comment"> float getThreshold () const {return _Threshold;}</font>
<a name="l00180"></a><a class="code" href="class_NL3D__CLandscape.html#a13">00180</a> <font class="keywordtype">void</font> setRefineMode(<font class="keywordtype">bool</font> enabled)<font class="keyword"> </font>{_RefineMode= enabled;}
<a name="l00181"></a><a class="code" href="class_NL3D__CLandscape.html#a14">00181</a> <font class="keywordtype">bool</font> getRefineMode()<font class="keyword"> const </font>{<font class="keywordflow">return</font> _RefineMode;}
00183 <font class="keywordtype">void</font> setTileMaxSubdivision (uint tileDiv);
00185 uint getTileMaxSubdivision ();
00186
00187 <font class="comment">// TODO: other landscape param setup (Transition etc...).</font>
00188 <font class="comment">// Store it by landscape, and not only globally in CTessFace statics.</font>
00189 <font class="comment">// @}</font>
00190
00191
00193 <font class="comment">// @{
</font>00197 <font class="comment"></font> <font class="keywordtype">void</font> clip(<font class="keyword">const</font> CVector &refineCenter, <font class="keyword">const</font> std::vector<CPlane> &pyramid);
00199 <font class="keywordtype">void</font> refine(<font class="keyword">const</font> CVector &refineCenter);
00201 <font class="keywordtype">void</font> render(IDriver *drv, <font class="keyword">const</font> CVector &refineCenter, <font class="keyword">const</font> std::vector<CPlane> &pyramid, <font class="keywordtype">bool</font> doTileAddPass=<font class="keyword">false</font>);
00203 <font class="keywordtype">void</font> refineAll(<font class="keyword">const</font> CVector &refineCenter);
00204 <font class="comment">// @}</font>
00205
00206
00208 <font class="comment">// @{
</font>00216 <font class="comment"></font> <font class="keywordtype">void</font> buildCollideFaces(<font class="keyword">const</font> CAABBoxExt &bbox, std::vector<CTriangle> &faces, <font class="keywordtype">bool</font> faceSplit);
00220 <font class="keywordtype">void</font> buildCollideFaces(sint zoneId, sint patch, std::vector<CTriangle> &faces);
00221 <font class="comment">// @}</font>
00222
00223
00224
00226 <font class="comment">// @{
</font>00232 <font class="comment"></font> CZone* getZone (sint zoneId);
00238 <font class="keyword">const</font> CZone* getZone (sint zoneId) <font class="keyword">const</font>;
00239 <font class="comment">// @}</font>
00240
00241
00243 <font class="comment">// @{
</font>00245 <font class="comment"> void flushTiles(IDriver *drv, uint16 tileStart, uint16 nbTiles);
</font>00247 <font class="comment"> void releaseTiles(uint16 tileStart, uint16 nbTiles);</font>
00248
00250 <a class="code" href="class_NLMISC__CSmartPtr.html">NLMISC::CSmartPtr<ITexture></a> getTileTexture(uint16 tileId, CTile::TBitmap bitmapType, CVector &uvScaleBias);
00251 <font class="comment">// @}</font>
00252
00254 <font class="comment">// @{
</font>00262 <font class="comment"></font> <font class="keywordtype">void</font> setupStaticLight (<font class="keyword">const</font> CRGBA &diffuse, <font class="keyword">const</font> CRGBA &ambiant, <font class="keywordtype">float</font> multiply);
<a name="l00268"></a><a class="code" href="class_NL3D__CLandscape.html#a29">00268</a> <font class="keyword">const</font> CRGBA* getStaticLight ()<font class="keyword"> const
</font>00269 <font class="keyword"> </font>{
00270 <font class="keywordflow">return</font> _LightValue;
00271 }
00272 <font class="comment">// @}</font>
00273
00274
00276 <font class="comment">// @{
</font>00278 <font class="comment"> CVector getHeightFieldDeltaZ(float x, float y) const;
</font>00284 <font class="comment"></font> <font class="keywordtype">void</font> setHeightField(<font class="keyword">const</font> CHeightMap &hf);
00285 <font class="comment">// @}</font>
00286
00287
00288
00289 <font class="comment">// ********************************</font>
00290 <font class="keyword">private</font>:
00291 <font class="comment">// Private part used by CPatch.</font>
<a name="l00292"></a><a class="code" href="class_NL3D__CLandscape.html#l0">00292</a> <font class="keyword">friend</font> <font class="keyword">class </font>CPatch;
<a name="l00293"></a><a class="code" href="class_NL3D__CLandscape.html#l1">00293</a> <font class="keyword">friend</font> <font class="keyword">class </font>CZone;
00294
00295 <font class="comment">// Return the render pass for a far texture here.</font>
00296 CPatchRdrPass *getFarRenderPass(CPatch* pPatch, uint farIndex, <font class="keywordtype">float</font>& far1UScale, <font class="keywordtype">float</font>& far1VScale, <font class="keywordtype">float</font>& far1UBias, <font class="keywordtype">float</font>& far1VBias, <font class="keywordtype">bool</font>& bRot);
00297 <font class="comment">// Free the render pass for a far texture here.</font>
00298 <font class="keywordtype">void</font> freeFarRenderPass (CPatch* pPatch, CPatchRdrPass* pass, uint farIndex);
00299 <font class="comment">// Return the render pass for a tile Id, and a patch Lightmap.</font>
00300 CPatchRdrPass *getTileRenderPass(uint16 tileId, <font class="keywordtype">bool</font> additiveRdrPass);
00301 <font class="comment">// Return the UvScaleBias for a tile Id. uv.z has the scale info. uv.x has the BiasU, and uv.y has the BiasV.</font>
00302 <font class="comment">// if bitmap type is CTile::alpha, Return also the additionla rot for alpha (else 0).</font>
00303 <font class="keywordtype">void</font> getTileUvScaleBiasRot(uint16 tileId, CTile::TBitmap bitmapType, CVector &uvScaleBias, uint8 &rotAlpha);
00304
00305 <font class="comment">// release Far render pass/reset Tile/Far render.</font>
00306 <font class="keywordtype">void</font> resetRenderFar();
00308 <font class="keywordtype">void</font> forceMergeAtTileLevel();
00309
00310 <font class="comment">// Update globals value to CTessFace</font>
00311 <font class="keywordtype">void</font> updateGlobals (<font class="keyword">const</font> CVector &refineCenter) <font class="keyword">const</font>;
00312
00313 <font class="keyword">private</font>:
<a name="l00314"></a><a class="code" href="class_NL3D__CLandscape.html#o0">00314</a> TZoneMap Zones;
00315
00316 <font class="comment">// Parameters.</font>
<a name="l00317"></a><a class="code" href="class_NL3D__CLandscape.html#o1">00317</a> <font class="keywordtype">float</font> _TileDistNear;
<a name="l00318"></a><a class="code" href="class_NL3D__CLandscape.html#o2">00318</a> <font class="keywordtype">float</font> _Threshold;
<a name="l00319"></a><a class="code" href="class_NL3D__CLandscape.html#o3">00319</a> <font class="keywordtype">bool</font> _RefineMode;
<a name="l00320"></a><a class="code" href="class_NL3D__CLandscape.html#o4">00320</a> <font class="keywordtype">float</font> _FarTransition;
<a name="l00321"></a><a class="code" href="class_NL3D__CLandscape.html#o5">00321</a> uint _TileMaxSubdivision;
00322
00323 <font class="comment">// The temp VB for tiles and far passes.</font>
<a name="l00324"></a><a class="code" href="class_NL3D__CLandscape.html#o6">00324</a> CVertexBuffer FarVB;
<a name="l00325"></a><a class="code" href="class_NL3D__CLandscape.html#o7">00325</a> CVertexBuffer TileVB;
00326
00327
00328 <font class="comment">// Tiles Types.</font>
00329 <font class="comment">//=============</font>
00330 <font class="comment">// Texture Map. Use a RefPtr because TileTextureMap must not reference the object, but the ptr.</font>
<a name="l00331"></a><a class="code" href="class_NL3D__CLandscape.html#u0">00331</a> <font class="keyword">typedef</font> <a class="code" href="class_NLMISC__CRefPtr.html">NLMISC::CRefPtr<ITexture></a> RPTexture;
<a name="l00332"></a><a class="code" href="class_NL3D__CLandscape.html#u1">00332</a> <font class="keyword">typedef</font> std::map<std::string, RPTexture> TTileTextureMap;
<a name="l00333"></a><a class="code" href="class_NL3D__CLandscape.html#u2">00333</a> <font class="keyword">typedef</font> TTileTextureMap::iterator ItTileTextureMap;
00334 <font class="comment">// RdrPass Set.</font>
<a name="l00335"></a><a class="code" href="class_NL3D__CLandscape.html#u3">00335</a> <font class="keyword">typedef</font> std::set<CPatchRdrPass> TTileRdrPassSet;
<a name="l00336"></a><a class="code" href="class_NL3D__CLandscape.html#u4">00336</a> <font class="keyword">typedef</font> TTileRdrPassSet::iterator ItTileRdrPassSet;
<a name="l00337"></a><a class="code" href="class_NL3D__CLandscape.html#u5">00337</a> <font class="keyword">typedef</font> <a class="code" href="class_NLMISC__CSmartPtr.html">NLMISC::CSmartPtr<CPatchRdrPass></a> TSPRenderPass;
00338
00339 <font class="comment">// The additional realtime structure for a tile.</font>
<a name="l00340"></a><a class="code" href="class_NL3D__CLandscape__CTileInfo.html">00340</a> <font class="keyword">struct </font>CTileInfo
00341 {
00342 <font class="comment">// NB: CSmartPtr are not used for simplicity, and because of TTileRdrPassSet...</font>
00343 <font class="comment">// CPatchRdrPass::RefCount are excplictly incremented/decremented...</font>
00344 <font class="comment">// The rdrpass for diffuse+Alpha material.</font>
<a name="l00345"></a><a class="code" href="class_NL3D__CLandscape__CTileInfo.html#m0">00345</a> CPatchRdrPass *DiffuseRdrPass;
00346 <font class="comment">// The rdrpass for additive material (may be NULL if no additive part).</font>
<a name="l00347"></a><a class="code" href="class_NL3D__CLandscape__CTileInfo.html#m1">00347</a> CPatchRdrPass *AdditiveRdrPass;
00348 <font class="comment">// The scale/Bias to access those tiles in the big texture.</font>
00349 <font class="comment">// uv.z has the scale info. uv.x has the BiasU, and uv.y has the BiasV.</font>
00350 <font class="comment">// Manages the demi-texel on tile border too.</font>
<a name="l00351"></a><a class="code" href="class_NL3D__CLandscape__CTileInfo.html#m2">00351</a> CVector DiffuseUvScaleBias;
<a name="l00352"></a><a class="code" href="class_NL3D__CLandscape__CTileInfo.html#m3">00352</a> CVector AlphaUvScaleBias;
<a name="l00353"></a><a class="code" href="class_NL3D__CLandscape__CTileInfo.html#m4">00353</a> CVector AdditiveUvScaleBias;
00354 <font class="comment">// The additional rotation for this tile, in alpha.</font>
<a name="l00355"></a><a class="code" href="class_NL3D__CLandscape__CTileInfo.html#m5">00355</a> uint8 RotAlpha;
00356 };
00357
00358
00359 <font class="comment">// Tiles Data.</font>
00360 <font class="comment">//=============</font>
00361 <font class="comment">// The map of tile texture loaded.</font>
<a name="l00362"></a><a class="code" href="class_NL3D__CLandscape.html#o8">00362</a> TTileTextureMap TileTextureMap;
00363 <font class="comment">// The set of tile Rdr Pass.</font>
<a name="l00364"></a><a class="code" href="class_NL3D__CLandscape.html#o9">00364</a> TTileRdrPassSet TileRdrPassSet;
00365 <font class="comment">// The parrallel array of tile of those existing in TileBank. size of NbTilesMax.</font>
<a name="l00366"></a><a class="code" href="class_NL3D__CLandscape.html#o10">00366</a> std::vector<CTileInfo*> TileInfos;
00367 <font class="comment">// The Lightmap rdrpass for tiles.</font>
00368 <font class="comment">// must have a vector of pointer, because of vector reallocation.</font>
<a name="l00369"></a><a class="code" href="class_NL3D__CLandscape.html#o11">00369</a> std::vector<TSPRenderPass> _TextureNears;
<a name="l00370"></a><a class="code" href="class_NL3D__CLandscape.html#o12">00370</a> uint _NFreeLightMaps;
00371
00372
00373 <font class="comment">// The Tile material.</font>
<a name="l00374"></a><a class="code" href="class_NL3D__CLandscape.html#o13">00374</a> CMaterial TileMaterial;
00375
00376 <font class="comment">// The Far material.</font>
<a name="l00377"></a><a class="code" href="class_NL3D__CLandscape.html#o14">00377</a> CMaterial FarMaterial;
00378
00379
00380 <font class="comment">// *** Far texture </font>
00381
00382 <font class="comment">// ** Some types</font>
00383
00384 <font class="comment">// The vector of set of far render pass</font>
<a name="l00385"></a><a class="code" href="class_NL3D__CLandscape.html#u6">00385</a> <font class="keyword">typedef</font> std::set<TSPRenderPass> TSPRenderPassSet;
<a name="l00386"></a><a class="code" href="class_NL3D__CLandscape.html#u7">00386</a> <font class="keyword">typedef</font> TSPRenderPassSet::iterator ItSPRenderPassSet;
<a name="l00387"></a><a class="code" href="class_NL3D__CLandscape.html#u8">00387</a> <font class="keyword">typedef</font> std::vector<TSPRenderPassSet> TSPRdrPassSetVector;
<a name="l00388"></a><a class="code" href="class_NL3D__CLandscape.html#o15">00388</a> TSPRenderPassSet _FarRdrPassSet; <font class="comment">// Contain all the render pass not empty for pass0 and pass1</font>
<a name="l00389"></a><a class="code" href="class_NL3D__CLandscape.html#o16">00389</a> TSPRdrPassSetVector _FarRdrPassSetVectorFree; <font class="comment">// Contain the render pass not filled yet sorted by size for pass0 and pass1</font>
<a name="l00390"></a><a class="code" href="class_NL3D__CLandscape.html#o17">00390</a> <font class="keywordtype">bool</font> _FarInitialized;
00391
00392 <font class="comment">// Used internaly by initTileBanks</font>
00393 <font class="keywordtype">bool</font> eraseTileFarIfNotGood (uint tileNumber, uint sizeOrder0, uint sizeOrder1, uint sizeOrder2);
00394
00395 <font class="comment">// ** Some private methods</font>
00396 <font class="keyword">static</font> uint getRdrPassIndexWithSize (uint width, uint height);
00397 <font class="keywordtype">void</font> addPatch ();
00398 <font class="keywordtype">void</font> removePatch ();
00399
00400
00401 <font class="comment">// *** Lighting</font>
<a name="l00402"></a><a class="code" href="class_NL3D__CLandscape.html#o18">00402</a> CRGBA _LightValue[256];
00403
00404 <font class="keyword">private</font>:
00405 <font class="comment">// Internal only. Force load of the tile (with TileBank).</font>
00406 <font class="keywordtype">void</font> loadTile(uint16 tileId);
00407 <font class="keywordtype">void</font> releaseTile(uint16 tileId);
00408 ITexture *findTileTexture(<font class="keyword">const</font> std::string &textName);
00409 CPatchRdrPass *findTileRdrPass(<font class="keyword">const</font> CPatchRdrPass &pass);
00410
00411 <font class="comment">// Tile LightMap mgt.</font>
00412 <font class="comment">// @{</font>
00413 <font class="comment">// Compute and get a lightmapId/lightmap renderpass.</font>
00414 <font class="comment">// lightmap returned is to be uses with getTileRenderPass(). The id returned must be stored.</font>
00415 uint getTileLightMap(CRGBA map[NL_TILE_LIGHTMAP_SIZE*NL_TILE_LIGHTMAP_SIZE], CPatchRdrPass *&lightmapRdrPass);
00416 <font class="comment">// tileLightMapId must be the id returned by getTileLightMap().</font>
00417 <font class="keywordtype">void</font> getTileLightMapUvInfo(uint tileLightMapId, CVector &uvScaleBias);
00418 <font class="comment">// tileLightMapId must be the id returned by getTileLightMap().</font>
00419 <font class="keywordtype">void</font> releaseTileLightMap(uint tileLightMapId);
00420 <font class="comment">// @}</font>
00421
00422
00423 <font class="comment">// check a zone, adding error to exception.</font>
00424 <font class="keywordtype">void</font> checkZoneBinds(CZone &curZone, EBadBind &bindError);
00425
00426
<a name="l00430"></a><a class="code" href="class_NL3D__CLandscape__CBezierPatchZ.html">00430</a> <font class="keyword">struct </font>CBezierPatchZ
00431 {
<a name="l00433"></a><a class="code" href="class_NL3D__CLandscape__CBezierPatchZ.html#m0">00433</a> <font class="keywordtype">float</font> Vertices[4];
<a name="l00435"></a><a class="code" href="class_NL3D__CLandscape__CBezierPatchZ.html#m1">00435</a> <font class="keywordtype">float</font> Tangents[8];
<a name="l00437"></a><a class="code" href="class_NL3D__CLandscape__CBezierPatchZ.html#m2">00437</a> <font class="keywordtype">float</font> Interiors[4];
00438
00440 <font class="keywordtype">void</font> makeInteriors();
00442 <font class="keywordtype">float</font> eval(<font class="keywordtype">float</font> s, <font class="keywordtype">float</font> t) <font class="keyword">const</font>; <font class="comment">// s,t coordinates for quad.</font>
00443 };
00444
00445
00446 <font class="comment">// HeightFields.</font>
<a name="l00447"></a><a class="code" href="class_NL3D__CLandscape__CHeightField.html">00447</a> <font class="keyword">struct </font>CHeightField
00448 {
<a name="l00449"></a><a class="code" href="class_NL3D__CLandscape__CHeightField.html#m0">00449</a> std::vector<CBezierPatchZ> ZPatchs;
00450
<a name="l00452"></a><a class="code" href="class_NL3D__CLandscape__CHeightField.html#m2">00452</a> <font class="keywordtype">float</font> OriginX, OriginY;
<a name="l00454"></a><a class="code" href="class_NL3D__CLandscape__CHeightField.html#m4">00454</a> <font class="keywordtype">float</font> SizeX, SizeY;
<a name="l00455"></a><a class="code" href="class_NL3D__CLandscape__CHeightField.html#m6">00455</a> <font class="keywordtype">float</font> OOSizeX, OOSizeY;
<a name="l00457"></a><a class="code" href="class_NL3D__CLandscape__CHeightField.html#m7">00457</a> uint Width, Height;
00458 };
<a name="l00459"></a><a class="code" href="class_NL3D__CLandscape.html#o19">00459</a> CHeightField _HeightField;
00460
00461 };
00462
00463
00464
00465 } <font class="comment">// NL3D</font>
00466
00467
00468 <font class="preprocessor">#endif // NL_LANDSCAPE_H
</font>00469 <font class="preprocessor"></font>
00470 <font class="comment">/* End of landscape.h */</font>
</div></pre>
<!-- footer -->
<BR><FONT Size=+5> </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>
|