aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a02708.html
blob: 07fef19ff743550c78ab336f13fd1417f606a4c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NL3D::CLandscapeCollisionGrid class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex">  <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CLandscapeCollisionGrid Class Reference</h1><code>#include &lt;<a class="el" href="a05865.html">landscape_collision_grid.h</a>&gt;</code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A grid of Tiles Id. Each <a class="el" href="a03705.html">CVisualCollisionEntity</a> has such a grid. This looks like <a class="el" href="a03273.html">CQuadGrid</a>, but with special features. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a05865.html#l00055">55</a> of file <a class="el" href="a05865.html">landscape_collision_grid.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGrida0">build</a> (const std::vector&lt; <a class="el" href="a03068.html">CPatchQuadBlock</a> * &gt; &amp;quadBlocks, const <a class="el" href="a03128.html">CVector</a> &amp;delta)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGrida1">CLandscapeCollisionGrid</a> (<a class="el" href="a03707.html">CVisualCollisionManager</a> *owner)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor.  <a href="#NL3D_1_1CLandscapeCollisionGrida1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGrida2">clear</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">clear the chainlist in the quadgrid.  <a href="#NL3D_1_1CLandscapeCollisionGrida2"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03713.html">CVisualTileDescNode</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGrida3">select</a> (const <a class="el" href="a03128.html">NLMISC::CVector</a> &amp;pos)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">select one entry in the chainQuad. pos is a position in World.  <a href="#NL3D_1_1CLandscapeCollisionGrida3"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGrida4">~CLandscapeCollisionGrid</a> ()</td></tr>

<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridd0">addQuadToGrid</a> (<a class="el" href="a04558.html#a9">uint16</a> paBlockId, <a class="el" href="a04558.html#a9">uint16</a> quadId, <a class="el" href="a04558.html#a14">sint</a> minx, <a class="el" href="a04558.html#a14">sint</a> maxx, <a class="el" href="a04558.html#a14">sint</a> miny, <a class="el" href="a04558.html#a14">sint</a> maxy)</td></tr>

<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr0">_Cleared</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Array of list of <a class="el" href="a03713.html">CVisualTileDescNode</a>.  <a href="#NL3D_1_1CLandscapeCollisionGridr0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03128.html">CVector</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr1">_Delta</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03713.html">CVisualTileDescNode</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr2">_Grid</a> [32 *32]</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03707.html">CVisualCollisionManager</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr3">_Owner</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr4">_SizePower</a></td></tr>

</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGrida1" doxytag="NL3D::CLandscapeCollisionGrid::CLandscapeCollisionGrid" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> NL3D::CLandscapeCollisionGrid::CLandscapeCollisionGrid </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a03707.html">CVisualCollisionManager</a> *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>owner</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Constructor. 
<p>

<p>
Definition at line <a class="el" href="a05864.html#l00040">40</a> of file <a class="el" href="a05864.html">landscape_collision_grid.cpp</a>.
<p>
References <a class="el" href="a05865.html#l00082">_Cleared</a>, <a class="el" href="a05865.html#l00083">_Grid</a>, <a class="el" href="a05865.html#l00084">_SizePower</a>, <a class="el" href="a05586.html#l00358">NLMISC::getPowerOf2()</a>, <a class="el" href="a05586.html#l00371">NLMISC::isPowerOf2()</a>, <a class="el" href="a05865.html#l00043">NL_COLGRID_SIZE</a>, and <a class="el" href="a05622.html#l00290">nlassert</a>.
<p>
<div class="fragment"><pre>00041 {
00042         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr3">_Owner</a>= owner;
00043         <span class="comment">// reset list to NULL.</span>
00044         memset(_Grid, 0, NL_COLGRID_SIZE*NL_COLGRID_SIZE * <span class="keyword">sizeof</span>(CVisualTileDescNode*));
00045         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr0">_Cleared</a>= <span class="keyword">true</span>;
00046 
00047         <span class="comment">// sizepower.</span>
00048         <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a05378.html#a264">isPowerOf2</a>(NL_COLGRID_SIZE));
00049         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr4">_SizePower</a>= <a class="code" href="a05378.html#a263">getPowerOf2</a>(NL_COLGRID_SIZE);
00050 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGrida4" doxytag="NL3D::CLandscapeCollisionGrid::~CLandscapeCollisionGrid" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> NL3D::CLandscapeCollisionGrid::~<a class="el" href="a02708.html">CLandscapeCollisionGrid</a> </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05864.html#l00053">53</a> of file <a class="el" href="a05864.html">landscape_collision_grid.cpp</a>.
<p>
References <a class="el" href="a05864.html#l00059">clear()</a>.
<p>
<div class="fragment"><pre>00054 {
00055         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGrida2">clear</a>();
00056 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGridd0" doxytag="NL3D::CLandscapeCollisionGrid::addQuadToGrid" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CLandscapeCollisionGrid::addQuadToGrid </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>paBlockId</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>quadId</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>minx</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>maxx</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>miny</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>maxy</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [private]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05864.html#l00213">213</a> of file <a class="el" href="a05864.html">landscape_collision_grid.cpp</a>.
<p>
References <a class="el" href="a05865.html#l00083">_Grid</a>, <a class="el" href="a05865.html#l00084">_SizePower</a>, <a class="el" href="a06729.html#l00096">NL3D::CVisualCollisionManager::newVisualTileDescNode()</a>, <a class="el" href="a06730.html#l00059">NL3D::CVisualTileDescNode::Next</a>, <a class="el" href="a05865.html#l00043">NL_COLGRID_SIZE</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06730.html#l00055">NL3D::CVisualTileDescNode::PatchQuadBlocId</a>, <a class="el" href="a06730.html#l00057">NL3D::CVisualTileDescNode::QuadId</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>.
<p>
Referenced by <a class="el" href="a05864.html#l00147">build()</a>.
<p>
<div class="fragment"><pre>00214 {
00215         <span class="comment">// coordinate should be positive.</span>
00216         <a class="code" href="a04199.html#a6">nlassert</a>(x0&gt;=0 &amp;&amp; x1&gt;=x0);
00217         <a class="code" href="a04199.html#a6">nlassert</a>(y0&gt;=0 &amp;&amp; y1&gt;=y0);
00218 
00219         <span class="comment">// first, transform coordinate (in meters) in quadgrid eltSize (ie 2 meters).</span>
00220         x0= (x0&gt;&gt;1);            <span class="comment">// floor().</span>
00221         x1= (x1&gt;&gt;1) + 1;        <span class="comment">// equivalent of ceil().</span>
00222         y0= (y0&gt;&gt;1);            <span class="comment">// floor().</span>
00223         y1= (y1&gt;&gt;1) + 1;        <span class="comment">// equivalent of ceil().</span>
00224 
00225         <span class="comment">// setup bounds in quadgrid coordinate.</span>
00226         <span class="keywordflow">if</span>(x1-x0&gt;=<a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>)
00227                 x0=0, x1= <a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>;
00228         <span class="keywordflow">else</span>
00229         {
00230                 x0&amp;= <a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>-1;
00231                 x1&amp;= <a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>-1;
00232                 <span class="keywordflow">if</span>(x1&lt;=x0)
00233                         x1+=<a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>;
00234         }
00235         <span class="keywordflow">if</span>(y1-y0&gt;=<a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>)
00236                 y0=0, y1= <a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>;
00237         <span class="keywordflow">else</span>
00238         {
00239                 y0&amp;= <a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>-1;
00240                 y1&amp;= <a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>-1;
00241                 <span class="keywordflow">if</span>(y1&lt;=y0)
00242                         y1+=<a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>;
00243         }
00244 
00245         <span class="comment">// fill all cases with element.</span>
00246         <a class="code" href="a04558.html#a14">sint</a>    <a class="code" href="a04223.html#a572">x</a>,<a class="code" href="a04223.html#a573">y</a>;
00247         <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>= y0;<a class="code" href="a04223.html#a573">y</a>&lt;y1;<a class="code" href="a04223.html#a573">y</a>++)
00248         {
00249                 <a class="code" href="a04558.html#a14">sint</a>    xe,ye;
00250                 ye= <a class="code" href="a04223.html#a573">y</a> &amp;(<a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>-1);
00251                 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>= x0;<a class="code" href="a04223.html#a572">x</a>&lt;x1;<a class="code" href="a04223.html#a572">x</a>++)
00252                 {
00253                         xe= <a class="code" href="a04223.html#a572">x</a> &amp;(<a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>-1);
00254                         <span class="comment">// which case we add the element.</span>
00255                         <a class="code" href="a04558.html#a14">sint</a> gridId= (ye&lt;&lt;<a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr4">_SizePower</a>)+xe;
00256 
00257                         <span class="comment">// allocate element.</span>
00258                         CVisualTileDescNode             *elt= <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr3">_Owner</a>-&gt;newVisualTileDescNode();
00259 
00260                         <span class="comment">// fill elt.</span>
00261                         elt-&gt;PatchQuadBlocId= paBlockId;
00262                         elt-&gt;QuadId= quadId;
00263 
00264                         <span class="comment">// bind elt to the list.</span>
00265                         elt-&gt;Next= <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr2">_Grid</a>[gridId];
00266                         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr2">_Grid</a>[gridId]= elt;
00267                 }
00268         }
00269 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGrida0" doxytag="NL3D::CLandscapeCollisionGrid::build" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CLandscapeCollisionGrid::build </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const std::vector&lt; <a class="el" href="a03068.html">CPatchQuadBlock</a> * &gt; &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>quadBlocks</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>delta</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Build the quadgrid with a array of patchblock. delta is the vector to apply to tiles coordinate, before insertion in the quadgrid (for precision consideration).
<p>
Definition at line <a class="el" href="a05864.html#l00147">147</a> of file <a class="el" href="a05864.html">landscape_collision_grid.cpp</a>.
<p>
References <a class="el" href="a05865.html#l00082">_Cleared</a>, <a class="el" href="a05865.html#l00085">_Delta</a>, <a class="el" href="a05864.html#l00213">addQuadToGrid()</a>, <a class="el" href="a05864.html#l00059">clear()</a>, <a class="el" href="a05864.html#l00138">NL3D::fastFloor()</a>, <a class="el" href="a05864.html#l00136">NL3D::fastFloorBegin()</a>, <a class="el" href="a05864.html#l00137">NL3D::fastFloorEnd()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06156.html#l00064">NL_PATCH_BLOCK_MAX_QUAD</a>, <a class="el" href="a06156.html#l00065">NL_PATCH_BLOCK_MAX_VERTEX</a>, <a class="el" href="a06156.html#l00255">NL3D::CPatchQuadBlock::PatchBlockId</a>, <a class="el" href="a06156.html#l00201">NL3D::CPatchBlockIdent::S0</a>, <a class="el" href="a06156.html#l00201">NL3D::CPatchBlockIdent::S1</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06156.html#l00201">NL3D::CPatchBlockIdent::T0</a>, <a class="el" href="a06156.html#l00201">NL3D::CPatchBlockIdent::T1</a>, <a class="el" href="a06156.html#l00258">NL3D::CPatchQuadBlock::Vertices</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a05864.html#l00091">NL3D::CVector2i::x</a>, <a class="el" href="a05646.html#l00236">x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, <a class="el" href="a05864.html#l00091">NL3D::CVector2i::y</a>, and <a class="el" href="a05646.html#l00236">y</a>.
<p>
Referenced by <a class="el" href="a06725.html#l00414">NL3D::CVisualCollisionEntity::doComputeLandscape()</a>.
<p>
<div class="fragment"><pre>00148 {
00149         <a class="code" href="a04558.html#a14">sint</a>    <a class="code" href="a04223.html#a572">x</a>,<a class="code" href="a04223.html#a573">y</a>;
00150         <span class="keyword">static</span> CVector2i        floorVals[<a class="code" href="a04733.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a>*<a class="code" href="a04733.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a>];
00151 
00152         <span class="comment">// first clear</span>
00153         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGrida2">clear</a>();
00154 
00155         <span class="comment">// init for fast floor.</span>
00156         <a class="code" href="a05363.html#a426">fastFloorBegin</a>();
00157 
00158         <span class="comment">// then fill.</span>
00159         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr0">_Cleared</a>= <span class="keyword">false</span>;
00160         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr1">_Delta</a>= delta;
00161         <span class="comment">// parse all quad blocks.</span>
00162         <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0; i&lt;(<a class="code" href="a04558.html#a14">sint</a>)quadBlocks.size();i++)
00163         {
00164                 CPatchQuadBlock         &amp;qb= *quadBlocks[i];
00165                 <a class="code" href="a04558.html#a14">sint</a>            lenS= qb.PatchBlockId.S1 - qb.PatchBlockId.S0;
00166                 <a class="code" href="a04558.html#a14">sint</a>            lenT= qb.PatchBlockId.T1 - qb.PatchBlockId.T0;
00167 
00168                 <span class="comment">// First, floor all vertices of interest.</span>
00169                 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>=0; <a class="code" href="a04223.html#a573">y</a>&lt;lenT+1; <a class="code" href="a04223.html#a573">y</a>++)
00170                 {
00171                         <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>=0; <a class="code" href="a04223.html#a572">x</a>&lt;lenS+1; <a class="code" href="a04223.html#a572">x</a>++)
00172                         {
00173                                 <a class="code" href="a04558.html#a14">sint</a>    <span class="keywordtype">id</span>= <a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04733.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a> + <a class="code" href="a04223.html#a572">x</a>;
00174                                 <span class="comment">// Add delta, and floor to sint.</span>
00175                                 floorVals[<span class="keywordtype">id</span>].x= <a class="code" href="a05363.html#a428">fastFloor</a>(qb.Vertices[<span class="keywordtype">id</span>].x + delta.x);
00176                                 floorVals[<span class="keywordtype">id</span>].y= <a class="code" href="a05363.html#a428">fastFloor</a>(qb.Vertices[<span class="keywordtype">id</span>].y + delta.y);
00177                         }
00178                 }
00179 
00180                 <span class="comment">// Then compute min max for all quads, and insert quad id in the quadGrid.</span>
00181                 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>=0; <a class="code" href="a04223.html#a573">y</a>&lt;lenT; <a class="code" href="a04223.html#a573">y</a>++)
00182                 {
00183                         <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>=0; <a class="code" href="a04223.html#a572">x</a>&lt;lenS; <a class="code" href="a04223.html#a572">x</a>++)
00184                         {
00185                                 <a class="code" href="a04558.html#a14">sint</a>    minx, maxx, miny, maxy;
00186                                 <a class="code" href="a04558.html#a14">sint</a>    <span class="keywordtype">id</span>= <a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04733.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a> + <a class="code" href="a04223.html#a572">x</a>;
00187                                 <span class="comment">// Compute min max of the 4 vertices.</span>
00188                                 minx= floorVals[<span class="keywordtype">id</span>].x; maxx= floorVals[<span class="keywordtype">id</span>].x;
00189                                 miny= floorVals[<span class="keywordtype">id</span>].y; maxy= floorVals[<span class="keywordtype">id</span>].y;
00190                                 <span class="keywordtype">id</span>++;
00191                                 minx= <a class="code" href="a04061.html#a0">min</a>(minx, floorVals[<span class="keywordtype">id</span>].x); maxx= max(maxx, floorVals[<span class="keywordtype">id</span>].x);
00192                                 miny= <a class="code" href="a04061.html#a0">min</a>(miny, floorVals[<span class="keywordtype">id</span>].y); maxy= max(maxy, floorVals[<span class="keywordtype">id</span>].y);
00193                                 <span class="keywordtype">id</span>+= <a class="code" href="a04733.html#a10">NL_PATCH_BLOCK_MAX_VERTEX</a>;
00194                                 minx= <a class="code" href="a04061.html#a0">min</a>(minx, floorVals[<span class="keywordtype">id</span>].x); maxx= max(maxx, floorVals[<span class="keywordtype">id</span>].x);
00195                                 miny= <a class="code" href="a04061.html#a0">min</a>(miny, floorVals[<span class="keywordtype">id</span>].y); maxy= max(maxy, floorVals[<span class="keywordtype">id</span>].y);
00196                                 <span class="keywordtype">id</span>--;
00197                                 minx= <a class="code" href="a04061.html#a0">min</a>(minx, floorVals[<span class="keywordtype">id</span>].x); maxx= max(maxx, floorVals[<span class="keywordtype">id</span>].x);
00198                                 miny= <a class="code" href="a04061.html#a0">min</a>(miny, floorVals[<span class="keywordtype">id</span>].y); maxy= max(maxy, floorVals[<span class="keywordtype">id</span>].y);
00199 
00200                                 <span class="comment">// store minmax in the quad.</span>
00201                                 <a class="code" href="a04558.html#a14">sint</a>    quadId= <a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04733.html#a9">NL_PATCH_BLOCK_MAX_QUAD</a> + <a class="code" href="a04223.html#a572">x</a>;
00202                                 <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridd0">addQuadToGrid</a>(i, quadId, minx, maxx, miny, maxy);
00203                         }
00204                 }
00205         }
00206 
00207         <span class="comment">// init for fast floor.</span>
00208         <a class="code" href="a05363.html#a427">fastFloorEnd</a>();
00209 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGrida2" doxytag="NL3D::CLandscapeCollisionGrid::clear" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CLandscapeCollisionGrid::clear </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
clear the chainlist in the quadgrid. 
<p>

<p>
Definition at line <a class="el" href="a05864.html#l00059">59</a> of file <a class="el" href="a05864.html">landscape_collision_grid.cpp</a>.
<p>
References <a class="el" href="a05865.html#l00082">_Cleared</a>, <a class="el" href="a05865.html#l00083">_Grid</a>, <a class="el" href="a06729.html#l00102">NL3D::CVisualCollisionManager::deleteVisualTileDescNode()</a>, <a class="el" href="a06730.html#l00059">NL3D::CVisualTileDescNode::Next</a>, <a class="el" href="a05865.html#l00043">NL_COLGRID_SIZE</a>, and <a class="el" href="a05981.html#l00104">sint</a>.
<p>
Referenced by <a class="el" href="a05864.html#l00147">build()</a>, <a class="el" href="a05864.html#l00053">~CLandscapeCollisionGrid()</a>, and <a class="el" href="a06725.html#l00072">NL3D::CVisualCollisionEntity::~CVisualCollisionEntity()</a>.
<p>
<div class="fragment"><pre>00060 {
00061         <span class="comment">// already cleared? do nothing.</span>
00062         <span class="keywordflow">if</span>(<a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr0">_Cleared</a>)
00063                 <span class="keywordflow">return</span>;
00064 
00065         <span class="comment">// Parse all quads.</span>
00066         <a class="code" href="a04558.html#a14">sint</a>    i;
00067         <span class="keywordflow">for</span>(i=0;i&lt;<a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>*<a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>;i++)
00068         {
00069                 CVisualTileDescNode                     *ptr, *next;
00070                 ptr= <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr2">_Grid</a>[i];
00071 
00072                 <span class="comment">// delete list of node.</span>
00073                 <span class="keywordflow">while</span>(ptr)
00074                 {
00075                         next= ptr-&gt;Next;
00076                         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr3">_Owner</a>-&gt;deleteVisualTileDescNode(ptr);
00077                         ptr= next;
00078                 }
00079 
00080                 <span class="comment">// reset root.</span>
00081                 _Grid[i]= NULL;
00082         }
00083 
00084         <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr0">_Cleared</a>= <span class="keyword">true</span>;
00085 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGrida3" doxytag="NL3D::CLandscapeCollisionGrid::select" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03713.html">CVisualTileDescNode</a> * NL3D::CLandscapeCollisionGrid::select </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03128.html">NLMISC::CVector</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>pos</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
select one entry in the chainQuad. pos is a position in World. 
<p>

<p>
Definition at line <a class="el" href="a05864.html#l00273">273</a> of file <a class="el" href="a05864.html">landscape_collision_grid.cpp</a>.
<p>
References <a class="el" href="a05865.html#l00085">_Delta</a>, <a class="el" href="a05865.html#l00083">_Grid</a>, <a class="el" href="a05865.html#l00043">NL_COLGRID_SIZE</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a05646.html#l00236">x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, and <a class="el" href="a05646.html#l00236">y</a>.
<p>
Referenced by <a class="el" href="a06725.html#l00096">NL3D::CVisualCollisionEntity::getPatchTriangleUnderUs()</a>.
<p>
<div class="fragment"><pre>00274 {
00275         <span class="comment">// compute pos in the quadgrid.</span>
00276         CVector         localPos;
00277         localPos= pos + <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr1">_Delta</a>;
00278         <span class="comment">// cases are 2x2 meters.</span>
00279         localPos/=2;
00280 
00281         <span class="comment">// floor, bound in quadgrid coordinate.</span>
00282         <a class="code" href="a04558.html#a14">sint</a>    <a class="code" href="a04223.html#a572">x</a>,<a class="code" href="a04223.html#a573">y</a>;
00283         <a class="code" href="a04223.html#a572">x</a>= (<a class="code" href="a04558.html#a14">sint</a>)floor(localPos.x);
00284         <a class="code" href="a04223.html#a573">y</a>= (<a class="code" href="a04558.html#a14">sint</a>)floor(localPos.y);
00285         <a class="code" href="a04223.html#a572">x</a>&amp;= <a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>-1;
00286         <a class="code" href="a04223.html#a573">y</a>&amp;= <a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>-1;
00287 
00288         <span class="keywordflow">return</span> <a class="code" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr2">_Grid</a>[<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04442.html#a0">NL_COLGRID_SIZE</a>+<a class="code" href="a04223.html#a572">x</a>];
00289 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGridr0" doxytag="NL3D::CLandscapeCollisionGrid::_Cleared" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool <a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr0">NL3D::CLandscapeCollisionGrid::_Cleared</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Array of list of <a class="el" href="a03713.html">CVisualTileDescNode</a>. 
<p>

<p>
Definition at line <a class="el" href="a05865.html#l00082">82</a> of file <a class="el" href="a05865.html">landscape_collision_grid.h</a>.
<p>
Referenced by <a class="el" href="a05864.html#l00147">build()</a>, <a class="el" href="a05864.html#l00040">CLandscapeCollisionGrid()</a>, and <a class="el" href="a05864.html#l00059">clear()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGridr1" doxytag="NL3D::CLandscapeCollisionGrid::_Delta" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03128.html">CVector</a> <a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr1">NL3D::CLandscapeCollisionGrid::_Delta</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05865.html#l00085">85</a> of file <a class="el" href="a05865.html">landscape_collision_grid.h</a>.
<p>
Referenced by <a class="el" href="a05864.html#l00147">build()</a>, and <a class="el" href="a05864.html#l00273">select()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGridr2" doxytag="NL3D::CLandscapeCollisionGrid::_Grid" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03713.html">CVisualTileDescNode</a>* <a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr2">NL3D::CLandscapeCollisionGrid::_Grid</a>[ 32 * 32 ]<code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05865.html#l00083">83</a> of file <a class="el" href="a05865.html">landscape_collision_grid.h</a>.
<p>
Referenced by <a class="el" href="a05864.html#l00213">addQuadToGrid()</a>, <a class="el" href="a05864.html#l00040">CLandscapeCollisionGrid()</a>, <a class="el" href="a05864.html#l00059">clear()</a>, and <a class="el" href="a05864.html#l00273">select()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGridr3" doxytag="NL3D::CLandscapeCollisionGrid::_Owner" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03707.html">CVisualCollisionManager</a>* <a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr3">NL3D::CLandscapeCollisionGrid::_Owner</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05865.html#l00078">78</a> of file <a class="el" href="a05865.html">landscape_collision_grid.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CLandscapeCollisionGridr4" doxytag="NL3D::CLandscapeCollisionGrid::_SizePower" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a02708.html#NL3D_1_1CLandscapeCollisionGridr4">NL3D::CLandscapeCollisionGrid::_SizePower</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05865.html#l00084">84</a> of file <a class="el" href="a05865.html">landscape_collision_grid.h</a>.
<p>
Referenced by <a class="el" href="a05864.html#l00213">addQuadToGrid()</a>, and <a class="el" href="a05864.html#l00040">CLandscapeCollisionGrid()</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a05865.html">landscape_collision_grid.h</a><li><a class="el" href="a05864.html">landscape_collision_grid.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:48:38 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>