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
|
<!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>landscape_user.cpp</h1><a href="landscape__user_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="landscape__user_8h.html">3d/landscape_user.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="file_8h.html">nel/misc/file.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="hierarchical__timer_8h.html">nel/misc/hierarchical_timer.h</a>"</font>
00032
00033 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00034
00035 <font class="keyword">namespace </font>NL3D
00036 {
00037
00038 <a class="code" href="hierarchical__timer_8h.html#a6">H_AUTO_DECL</a>( NL3D_UI_Landscape )
00039 <a class="code" href="hierarchical__timer_8h.html#a6">H_AUTO_DECL</a>( NL3D_Render_Landscape_updateLightingAll )
00040 <a class="code" href="hierarchical__timer_8h.html#a6">H_AUTO_DECL</a>( NL3D_Load_Landscape )
00041
<a name="l00042"></a><a class="code" href="landscape__user_8cpp.html#a0">00042</a> <font class="preprocessor">#define NL3D_HAUTO_UI_LANDSCAPE H_AUTO_USE( NL3D_UI_Landscape )</font>
<a name="l00043"></a><a class="code" href="landscape__user_8cpp.html#a1">00043</a> <font class="preprocessor"></font><font class="preprocessor">#define NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL H_AUTO_USE( NL3D_Render_Landscape_updateLightingAll )</font>
<a name="l00044"></a><a class="code" href="landscape__user_8cpp.html#a2">00044</a> <font class="preprocessor"></font><font class="preprocessor">#define NL3D_HAUTO_LOAD_LANDSCAPE H_AUTO_USE( NL3D_Load_Landscape )</font>
00045 <font class="preprocessor"></font>
00046
00047 <font class="comment">//****************************************************************************</font>
<a name="l00048"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_0">00048</a> <font class="keywordtype">void</font> CLandscapeUser::setZonePath(<font class="keyword">const</font> std::string &zonePath)
00049 {
00050 NL3D_MEM_LANDSCAPE
00051 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00052 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.setZonePath(zonePath);
00053 }
00054 <font class="comment">//****************************************************************************</font>
<a name="l00055"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_1">00055</a> <font class="keywordtype">void</font> CLandscapeUser::loadBankFiles(<font class="keyword">const</font> std::string &tileBankFile, <font class="keyword">const</font> std::string &farBankFile)
00056 {
00057 NL3D_MEM_LANDSCAPE
00058 <a class="code" href="landscape__user_8cpp.html#a2">NL3D_HAUTO_LOAD_LANDSCAPE</a>;
00059
00060 <font class="comment">// First, load the banks.</font>
00061 <font class="comment">//=======================</font>
00062 CIFile bankFile(CPath::lookup(tileBankFile));
00063 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.TileBank.serial(bankFile);
00064 <font class="comment">// All textures path are relative!</font>
00065 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.TileBank.makeAllPathRelative();
00066 <font class="comment">// Use DDS!!!</font>
00067 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.TileBank.makeAllExtensionDDS();
00068 <font class="comment">// No absolute path</font>
00069 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.TileBank.setAbsPath (<font class="stringliteral">""</font>);
00070
00071 <font class="comment">// After loading the TileBank, and before initTileBanks(), must load the vegetables descritpor</font>
00072 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.TileBank.loadTileVegetableDescs();
00073
00074 CIFile farbankFile(CPath::lookup(farBankFile));
00075 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.TileFarBank.serial(farbankFile);
00076 <font class="keywordflow">if</font> ( ! <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.initTileBanks() )
00077 {
00078 <a class="code" href="debug_8h.html#a2">nlwarning</a>( <font class="stringliteral">"You need to recompute bank.farbank for the far textures"</font> );
00079 }
00080 bankFile.close();
00081 farbankFile.close();
00082
00083
00084 <font class="comment">// Second, temporary, flushTiles.</font>
00085 <font class="comment">//===============================</font>
00086 sint ts;
00087 <font class="keywordflow">for</font> (ts=0; ts<<a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.TileBank.getTileSetCount (); ts++)
00088 {
00089 CTileSet *tileSet=<a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.TileBank.getTileSet (ts);
00090 sint tl;
00091 <font class="keywordflow">for</font> (tl=0; tl<tileSet->getNumTile128(); tl++)
00092 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.flushTiles (<a class="code" href="classNL3D_1_1CLandscapeUser.html#o0">_Scene</a>->getDriver(), (uint16)tileSet->getTile128(tl), 1);
00093 <font class="keywordflow">for</font> (tl=0; tl<tileSet->getNumTile256(); tl++)
00094 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.flushTiles (<a class="code" href="classNL3D_1_1CLandscapeUser.html#o0">_Scene</a>->getDriver(), (uint16)tileSet->getTile256(tl), 1);
00095 <font class="keywordflow">for</font> (tl=0; tl<CTileSet::count; tl++)
00096 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.flushTiles (<a class="code" href="classNL3D_1_1CLandscapeUser.html#o0">_Scene</a>->getDriver(), (uint16)tileSet->getTransition(tl)->getTile (), 1);
00097 }
00098
00099 }
00100
00101
00102 <font class="comment">//****************************************************************************</font>
<a name="l00103"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_3">00103</a> <font class="keywordtype">void</font> CLandscapeUser::loadAllZonesAround(<font class="keyword">const</font> CVector &pos, <font class="keywordtype">float</font> radius, std::vector<std::string> &zonesAdded)
00104 {
00105 NL3D_MEM_LANDSCAPE
00106 <a class="code" href="landscape__user_8cpp.html#a2">NL3D_HAUTO_LOAD_LANDSCAPE</a>;
00107
00108 zonesAdded.clear();
00109
00110 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius);
00111 <font class="keywordflow">while</font> (<a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.isWorking())
00112 {
00113 CZoneManager::SZoneManagerWork Work;
00114 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.isWorkComplete(Work))
00115 {
00116 <a class="code" href="debug_8h.html#a6">nlassert</a>(!Work.ZoneRemoved);
00117 <font class="keywordflow">if</font> (Work.ZoneAdded)
00118 {
00119 <font class="keywordflow">if</font> (Work.Zone == (CZone*)-1)
00120 {
00121 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Can't load zone %s"</font>, Work.NameZoneAdded.c_str ());
00122 }
00123 <font class="keywordflow">else</font>
00124 {
00125 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.addZone (*Work.Zone);
00126
00127 <font class="keyword">delete</font> Work.Zone;
00128 std::string zoneadd = Work.NameZoneAdded;
00129 zoneadd = zoneadd.substr(0, zoneadd.find(<font class="charliteral">'.'</font>));
00130 zonesAdded.push_back(zoneadd);
00131 }
00132 }
00133 }
00134 <font class="keywordflow">else</font>
00135 {
00136 <a class="code" href="namespaceNLMISC.html#a236">nlSleep</a> (1);
00137 }
00138 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius);
00139 }
00140 <font class="comment">// Yoyo: must check the binds of the zones.</font>
00141 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.checkBinds();
00142 }
00143
00144 <font class="comment">//****************************************************************************</font>
<a name="l00145"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_6">00145</a> <font class="keywordtype">void</font> CLandscapeUser::refreshAllZonesAround(<font class="keyword">const</font> CVector &pos, <font class="keywordtype">float</font> radius, std::vector<std::string> &zonesAdded, std::vector<std::string> &zonesRemoved)
00146 {
00147 NL3D_MEM_LANDSCAPE
00148 <a class="code" href="landscape__user_8cpp.html#a2">NL3D_HAUTO_LOAD_LANDSCAPE</a>;
00149
00150 zonesAdded.clear();
00151 zonesRemoved.clear();
00152 std::string za, zr;
00153
00154 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius);
00155 <font class="keywordflow">while</font> (<a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.isWorking())
00156 {
00157 <a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_4">refreshZonesAround</a> (pos, radius, za, zr);
00158
00159 <font class="comment">// some zone added or removed??</font>
00160 <font class="keywordflow">if</font>(za != <font class="stringliteral">""</font>)
00161 zonesAdded.push_back(za);
00162 <font class="keywordflow">if</font>(zr != <font class="stringliteral">""</font>)
00163 zonesRemoved.push_back(zr);
00164
00165 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius);
00166 }
00167 }
00168
00169 <font class="comment">// ***************************************************************************</font>
<a name="l00170"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_7">00170</a> <font class="keywordtype">void</font> CLandscapeUser::getAllZoneLoaded(std::vector<std::string> &zoneLoaded)<font class="keyword"> const</font>
00171 <font class="keyword"></font>{
00172 NL3D_MEM_LANDSCAPE
00173 <font class="comment">// Build the list of zoneId.</font>
00174 std::vector<uint16> zoneIds;
00175 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.getZoneList(zoneIds);
00176
00177 <font class="comment">// transcript</font>
00178 zoneLoaded.clear();
00179 zoneLoaded.resize(zoneIds.size());
00180 <font class="keywordflow">for</font>(uint i=0;i<zoneLoaded.size();i++)
00181 {
00182 CLandscape::buildZoneName(zoneIds[i], zoneLoaded[i]);
00183 }
00184 }
00185
00186 <font class="comment">//****************************************************************************</font>
<a name="l00187"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_2">00187</a> <font class="keywordtype">void</font> CLandscapeUser::loadAllZonesAround(<font class="keyword">const</font> CVector &pos, <font class="keywordtype">float</font> radius)
00188 {
00189 NL3D_MEM_LANDSCAPE
00190 std::vector<std::string> dummy;
00191 <a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_2">loadAllZonesAround</a>(pos, radius, dummy);
00192 }
00193
00194
00195 <font class="comment">//****************************************************************************</font>
<a name="l00196"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_4">00196</a> <font class="keywordtype">void</font> CLandscapeUser::refreshZonesAround(<font class="keyword">const</font> CVector &pos, <font class="keywordtype">float</font> radius)
00197 {
00198 NL3D_MEM_LANDSCAPE
00199 <a class="code" href="landscape__user_8cpp.html#a2">NL3D_HAUTO_LOAD_LANDSCAPE</a>;
00200
00201 std::string dummy1, dummy2;
00202 <a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_4">refreshZonesAround</a>(pos, radius, dummy1, dummy2);
00203 }
00204 <font class="comment">//****************************************************************************</font>
<a name="l00205"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z501_5">00205</a> <font class="keywordtype">void</font> CLandscapeUser::refreshZonesAround(<font class="keyword">const</font> CVector &pos, <font class="keywordtype">float</font> radius, std::string &zoneAdded, std::string &zoneRemoved)
00206 {
00207 NL3D_MEM_LANDSCAPE
00208 <a class="code" href="landscape__user_8cpp.html#a2">NL3D_HAUTO_LOAD_LANDSCAPE</a>;
00209
00210 zoneRemoved= <font class="stringliteral">""</font>;
00211 zoneAdded= <font class="stringliteral">""</font>;
00212 CZoneManager::SZoneManagerWork Work;
00213 <font class="comment">// Check if new zone must be added to landscape</font>
00214 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.isWorkComplete(Work))
00215 {
00216 <font class="keywordflow">if</font> (Work.ZoneAdded)
00217 {
00218 <font class="keywordflow">if</font> (Work.Zone == (CZone*)-1)
00219 {
00220 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Can't load zone %s"</font>, Work.NameZoneAdded.c_str ());
00221 }
00222 <font class="keywordflow">else</font>
00223 {
00224 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.addZone(*Work.Zone);
00225
00226 <font class="comment">// Yoyo: must check the binds of the new inserted zone.</font>
00227 <font class="keywordflow">try</font>
00228 {
00229 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.checkBinds(Work.Zone->getZoneId());
00230 }
00231 <font class="keywordflow">catch</font> (EBadBind &e)
00232 {
00233 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Bind error : %s"</font>, e.what());
00234 }
00235
00236 <font class="keyword">delete</font> Work.Zone;
00237 zoneAdded = Work.NameZoneAdded;
00238 zoneAdded = zoneAdded.substr(0, zoneAdded.find(<font class="charliteral">'.'</font>));
00239 }
00240 }
00241
00242 <font class="comment">// Check if a zone must be removed from landscape</font>
00243 <font class="keywordflow">if</font> (Work.ZoneRemoved)
00244 {
00245 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.removeZone (Work.IdZoneToRemove);
00246 zoneRemoved = Work.NameZoneRemoved;
00247 zoneRemoved = zoneRemoved.substr(0, zoneRemoved.find(<font class="charliteral">'.'</font>));
00248 }
00249 }
00250
00251 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.checkZonesAround((uint)pos.x, (uint)(-pos.y), (uint)radius);
00252 }
00253
00254
00255 <font class="comment">//****************************************************************************</font>
<a name="l00256"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z502_0">00256</a> <font class="keywordtype">void</font> CLandscapeUser::setupStaticLight (<font class="keyword">const</font> CRGBA &diffuse, <font class="keyword">const</font> CRGBA &ambiant, <font class="keywordtype">float</font> multiply)
00257 {
00258 NL3D_MEM_LANDSCAPE
00259 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00260 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setupStaticLight(diffuse, ambiant, multiply);
00261 }
00262
00263
00264
00265 <font class="comment">//****************************************************************************</font>
<a name="l00266"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z503_0">00266</a> <font class="keywordtype">void</font> CLandscapeUser::setThreshold (<font class="keywordtype">float</font> thre)
00267 {
00268 NL3D_MEM_LANDSCAPE
00269 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00270 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setThreshold(thre);
00271 }
00272 <font class="comment">//****************************************************************************</font>
<a name="l00273"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z503_1">00273</a> <font class="keywordtype">float</font> CLandscapeUser::getThreshold ()<font class="keyword"> const</font>
00274 <font class="keyword"></font>{
00275 NL3D_MEM_LANDSCAPE
00276 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00277 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.getThreshold();
00278 }
00279 <font class="comment">//****************************************************************************</font>
<a name="l00280"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z503_2">00280</a> <font class="keywordtype">void</font> CLandscapeUser::setTileNear (<font class="keywordtype">float</font> tileNear)
00281 {
00282 NL3D_MEM_LANDSCAPE
00283 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00284 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setTileNear(tileNear);
00285 }
00286 <font class="comment">//****************************************************************************</font>
<a name="l00287"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z503_3">00287</a> <font class="keywordtype">float</font> CLandscapeUser::getTileNear ()<font class="keyword"> const</font>
00288 <font class="keyword"></font>{
00289 NL3D_MEM_LANDSCAPE
00290 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00291 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.getTileNear();
00292 }
00293 <font class="comment">//****************************************************************************</font>
<a name="l00294"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z503_4">00294</a> <font class="keywordtype">void</font> CLandscapeUser::setTileMaxSubdivision (uint tileDiv)
00295 {
00296 NL3D_MEM_LANDSCAPE
00297 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00298 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setTileMaxSubdivision(tileDiv);
00299 }
00300 <font class="comment">//****************************************************************************</font>
<a name="l00301"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z503_5">00301</a> uint CLandscapeUser::getTileMaxSubdivision ()
00302 {
00303 NL3D_MEM_LANDSCAPE
00304 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00305 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.getTileMaxSubdivision();
00306 }
00307
00308
00309 <font class="comment">//****************************************************************************</font>
<a name="l00310"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z504_0">00310</a> std::string CLandscapeUser::getZoneName(<font class="keyword">const</font> CVector &pos)
00311 {
00312 NL3D_MEM_LANDSCAPE
00313 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00314 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CLandscapeUser.html#o2">_ZoneManager</a>.getZoneName((uint)pos.x, (uint)(-pos.y), 0, 0).first;
00315 }
00316
00317
00318 <font class="comment">//****************************************************************************</font>
<a name="l00319"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z505_0">00319</a> CVector CLandscapeUser::getHeightFieldDeltaZ(<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>)<font class="keyword"> const</font>
00320 <font class="keyword"></font>{
00321 NL3D_MEM_LANDSCAPE
00322 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00323 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.getHeightFieldDeltaZ(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>);
00324 }
00325
00326 <font class="comment">//****************************************************************************</font>
<a name="l00327"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z505_1">00327</a> <font class="keywordtype">void</font> CLandscapeUser::setHeightField(<font class="keyword">const</font> CHeightMap &hf)
00328 {
00329 NL3D_MEM_LANDSCAPE
00330 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00331 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setHeightField(hf);
00332 }
00333
00334
00335 <font class="comment">//****************************************************************************</font>
<a name="l00336"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z506_0">00336</a> <font class="keywordtype">void</font> CLandscapeUser::enableVegetable(<font class="keywordtype">bool</font> enable)
00337 {
00338 NL3D_MEM_LANDSCAPE
00339 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00340 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.enableVegetable(enable);
00341 }
00342
00343 <font class="comment">//****************************************************************************</font>
<a name="l00344"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z506_1">00344</a> <font class="keywordtype">void</font> CLandscapeUser::loadVegetableTexture(<font class="keyword">const</font> std::string &textureFileName)
00345 {
00346 NL3D_MEM_LANDSCAPE
00347 <a class="code" href="landscape__user_8cpp.html#a2">NL3D_HAUTO_LOAD_LANDSCAPE</a>;
00348 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.loadVegetableTexture(textureFileName);
00349 }
00350
00351 <font class="comment">//****************************************************************************</font>
<a name="l00352"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z506_2">00352</a> <font class="keywordtype">void</font> CLandscapeUser::setupVegetableLighting(<font class="keyword">const</font> CRGBA &ambient, <font class="keyword">const</font> CRGBA &diffuse, <font class="keyword">const</font> CVector &directionalLight)
00353 {
00354 NL3D_MEM_LANDSCAPE
00355 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00356 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setupVegetableLighting(ambient, diffuse, directionalLight);
00357 }
00358
00359 <font class="comment">//****************************************************************************</font>
<a name="l00360"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z506_3">00360</a> <font class="keywordtype">void</font> CLandscapeUser::setVegetableWind(<font class="keyword">const</font> CVector &windDir, <font class="keywordtype">float</font> windFreq, <font class="keywordtype">float</font> windPower, <font class="keywordtype">float</font> windBendMin)
00361 {
00362 NL3D_MEM_LANDSCAPE
00363 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00364 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setVegetableWind(windDir, windFreq, windPower, windBendMin);
00365 }
00366
00367 <font class="comment">//****************************************************************************</font>
<a name="l00368"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z506_4">00368</a> <font class="keywordtype">void</font> CLandscapeUser::setVegetableUpdateLightingFrequency(<font class="keywordtype">float</font> freq)
00369 {
00370 NL3D_MEM_LANDSCAPE
00371 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00372 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setVegetableUpdateLightingFrequency(freq);
00373 }
00374
00375
00376 <font class="comment">//****************************************************************************</font>
<a name="l00377"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z502_3">00377</a> <font class="keywordtype">void</font> CLandscapeUser::setPointLightFactor(<font class="keyword">const</font> std::string &lightGroupName, <a class="code" href="classNLMISC_1_1CRGBA.html">NLMISC::CRGBA</a> nFactor)
00378 {
00379 NL3D_MEM_LANDSCAPE
00380 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00381 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setPointLightFactor(lightGroupName, nFactor);
00382 }
00383
00384 <font class="comment">//****************************************************************************</font>
<a name="l00385"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z502_4">00385</a> <font class="keywordtype">void</font> CLandscapeUser::setUpdateLightingFrequency(<font class="keywordtype">float</font> freq)
00386 {
00387 NL3D_MEM_LANDSCAPE
00388 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00389 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setUpdateLightingFrequency(freq);
00390 }
00391
00392
00393 <font class="comment">//****************************************************************************</font>
<a name="l00394"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z504_3">00394</a> <font class="keywordtype">void</font> CLandscapeUser::enableAdditive (<font class="keywordtype">bool</font> enable)
00395 {
00396 NL3D_MEM_LANDSCAPE
00397 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00398 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->enableAdditive(enable);
00399 }
00400 <font class="comment">//****************************************************************************</font>
<a name="l00401"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z504_4">00401</a> <font class="keywordtype">bool</font> CLandscapeUser::isAdditiveEnabled ()<font class="keyword"> const</font>
00402 <font class="keyword"></font>{
00403 NL3D_MEM_LANDSCAPE
00404 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00405 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->isAdditive ();
00406 }
00407
00408 <font class="comment">//****************************************************************************</font>
<a name="l00409"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z502_1">00409</a> <font class="keywordtype">void</font> CLandscapeUser::setPointLightDiffuseMaterial(CRGBA diffuse)
00410 {
00411 NL3D_MEM_LANDSCAPE
00412 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00413 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setPointLightDiffuseMaterial(diffuse);
00414 }
00415 <font class="comment">//****************************************************************************</font>
<a name="l00416"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z502_2">00416</a> CRGBA CLandscapeUser::getPointLightDiffuseMaterial ()<font class="keyword"> const</font>
00417 <font class="keyword"></font>{
00418 NL3D_MEM_LANDSCAPE
00419 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00420 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.getPointLightDiffuseMaterial();
00421 }
00422
00423 <font class="comment">//****************************************************************************</font>
<a name="l00424"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z507_0">00424</a> <font class="keywordtype">void</font> CLandscapeUser::setDLMGlobalVegetableColor(CRGBA gvc)
00425 {
00426 NL3D_MEM_LANDSCAPE
00427 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00428 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.setDLMGlobalVegetableColor(gvc);
00429 }
00430 <font class="comment">//****************************************************************************</font>
<a name="l00431"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z507_1">00431</a> CRGBA CLandscapeUser::getDLMGlobalVegetableColor()<font class="keyword"> const</font>
00432 <font class="keyword"></font>{
00433 NL3D_MEM_LANDSCAPE
00434 <a class="code" href="landscape__user_8cpp.html#a0">NL3D_HAUTO_UI_LANDSCAPE</a>;
00435 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.getDLMGlobalVegetableColor();
00436 }
00437 <font class="comment">//****************************************************************************</font>
<a name="l00438"></a><a class="code" href="classNL3D_1_1CLandscapeUser.html#z502_5">00438</a> <font class="keywordtype">void</font> CLandscapeUser::updateLightingAll()
00439 {
00440 NL3D_MEM_LANDSCAPE
00441 <a class="code" href="landscape__user_8cpp.html#a1">NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL</a>;
00442 <a class="code" href="classNL3D_1_1CLandscapeUser.html#o1">_Landscape</a>->Landscape.updateLightingAll();
00443 }
00444
00445
00446
00447 } <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>
|