source: ps/trunk/source/graphics/Terrain.cpp@ 9635

Last change on this file since 9635 was 9055, checked in by philip, 11 years ago

# Initial version of terrain decal textures.
Rejig CModel to support non-mesh-based props.
Avoid redundant recomputation for non-moving CRenderableObjects.

  • Property svn:eol-style set to native
File size: 17.6 KB
Line 
1/* Copyright (C) 2011 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Describes ground via heightmap and array of CPatch.
20 */
21
22#include "precompiled.h"
23
24#include "lib/res/graphics/ogl_tex.h"
25#include "lib/sysdep/cpu.h"
26
27#include "renderer/Renderer.h"
28
29#include "TerrainProperties.h"
30#include "TerrainTextureEntry.h"
31#include "TerrainTextureManager.h"
32
33#include <string.h>
34#include "Terrain.h"
35#include "Patch.h"
36#include "maths/FixedVector3D.h"
37#include "maths/MathUtil.h"
38#include "ps/CLogger.h"
39
40///////////////////////////////////////////////////////////////////////////////
41// CTerrain constructor
42CTerrain::CTerrain()
43: m_Heightmap(0), m_Patches(0), m_MapSize(0), m_MapSizePatches(0),
44m_BaseColour(255, 255, 255, 255)
45{
46}
47
48///////////////////////////////////////////////////////////////////////////////
49// CTerrain constructor
50CTerrain::~CTerrain()
51{
52 ReleaseData();
53}
54
55
56///////////////////////////////////////////////////////////////////////////////
57// ReleaseData: delete any data allocated by this terrain
58void CTerrain::ReleaseData()
59{
60 delete[] m_Heightmap;
61 delete[] m_Patches;
62}
63
64
65///////////////////////////////////////////////////////////////////////////////
66// Initialise: initialise this terrain to the given size
67// using given heightmap to setup elevation data
68bool CTerrain::Initialize(ssize_t patchesPerSide,const u16* data)
69{
70 // clean up any previous terrain
71 ReleaseData();
72
73 // store terrain size
74 m_MapSize=patchesPerSide*PATCH_SIZE+1;
75 m_MapSizePatches=patchesPerSide;
76 // allocate data for new terrain
77 m_Heightmap=new u16[m_MapSize*m_MapSize];
78 m_Patches=new CPatch[m_MapSizePatches*m_MapSizePatches];
79
80 // given a heightmap?
81 if (data) {
82 // yes; keep a copy of it
83 memcpy(m_Heightmap,data,m_MapSize*m_MapSize*sizeof(u16));
84 } else {
85 // build a flat terrain
86 memset(m_Heightmap,0,m_MapSize*m_MapSize*sizeof(u16));
87 }
88
89 // setup patch parents, indices etc
90 InitialisePatches();
91
92 return true;
93}
94
95///////////////////////////////////////////////////////////////////////////////
96
97CStr8 CTerrain::GetMovementClass(ssize_t i, ssize_t j) const
98{
99 CMiniPatch* tile = GetTile(i, j);
100 if (tile && tile->GetTextureEntry())
101 return tile->GetTextureEntry()->GetProperties().GetMovementClass();
102
103 return "default";
104}
105
106///////////////////////////////////////////////////////////////////////////////
107// CalcPosition: calculate the world space position of the vertex at (i,j)
108// If i,j is off the map, it acts as if the edges of the terrain are extended
109// outwards to infinity
110void CTerrain::CalcPosition(ssize_t i, ssize_t j, CVector3D& pos) const
111{
112 ssize_t hi = clamp(i, (ssize_t)0, m_MapSize-1);
113 ssize_t hj = clamp(j, (ssize_t)0, m_MapSize-1);
114 u16 height = m_Heightmap[hj*m_MapSize + hi];
115 pos.X = float(i*CELL_SIZE);
116 pos.Y = float(height*HEIGHT_SCALE);
117 pos.Z = float(j*CELL_SIZE);
118}
119
120///////////////////////////////////////////////////////////////////////////////
121// CalcPositionFixed: calculate the world space position of the vertex at (i,j)
122void CTerrain::CalcPositionFixed(ssize_t i, ssize_t j, CFixedVector3D& pos) const
123{
124 ssize_t hi = clamp(i, (ssize_t)0, m_MapSize-1);
125 ssize_t hj = clamp(j, (ssize_t)0, m_MapSize-1);
126 u16 height = m_Heightmap[hj*m_MapSize + hi];
127 pos.X = fixed::FromInt(i) * (int)CELL_SIZE;
128 pos.Y = fixed::FromInt(height) / (int)HEIGHT_UNITS_PER_METRE;
129 pos.Z = fixed::FromInt(j) * (int)CELL_SIZE;
130}
131
132
133///////////////////////////////////////////////////////////////////////////////
134// CalcNormal: calculate the world space normal of the vertex at (i,j)
135void CTerrain::CalcNormal(ssize_t i, ssize_t j, CVector3D& normal) const
136{
137 CVector3D left, right, up, down;
138
139 // Calculate normals of the four half-tile triangles surrounding this vertex:
140
141 // get position of vertex where normal is being evaluated
142 CVector3D basepos;
143 CalcPosition(i, j, basepos);
144
145 if (i > 0) {
146 CalcPosition(i-1, j, left);
147 left -= basepos;
148 left.Normalize();
149 }
150
151 if (i < m_MapSize-1) {
152 CalcPosition(i+1, j, right);
153 right -= basepos;
154 right.Normalize();
155 }
156
157 if (j > 0) {
158 CalcPosition(i, j-1, up);
159 up -= basepos;
160 up.Normalize();
161 }
162
163 if (j < m_MapSize-1) {
164 CalcPosition(i, j+1, down);
165 down -= basepos;
166 down.Normalize();
167 }
168
169 CVector3D n0 = up.Cross(left);
170 CVector3D n1 = left.Cross(down);
171 CVector3D n2 = down.Cross(right);
172 CVector3D n3 = right.Cross(up);
173
174 // Compute the mean of the normals
175 normal = n0 + n1 + n2 + n3;
176 float nlen=normal.Length();
177 if (nlen>0.00001f) normal*=1.0f/nlen;
178}
179
180///////////////////////////////////////////////////////////////////////////////
181// CalcNormalFixed: calculate the world space normal of the vertex at (i,j)
182void CTerrain::CalcNormalFixed(ssize_t i, ssize_t j, CFixedVector3D& normal) const
183{
184 CFixedVector3D left, right, up, down;
185
186 // Calculate normals of the four half-tile triangles surrounding this vertex:
187
188 // get position of vertex where normal is being evaluated
189 CFixedVector3D basepos;
190 CalcPositionFixed(i, j, basepos);
191
192 if (i > 0) {
193 CalcPositionFixed(i-1, j, left);
194 left -= basepos;
195 left.Normalize();
196 }
197
198 if (i < m_MapSize-1) {
199 CalcPositionFixed(i+1, j, right);
200 right -= basepos;
201 right.Normalize();
202 }
203
204 if (j > 0) {
205 CalcPositionFixed(i, j-1, up);
206 up -= basepos;
207 up.Normalize();
208 }
209
210 if (j < m_MapSize-1) {
211 CalcPositionFixed(i, j+1, down);
212 down -= basepos;
213 down.Normalize();
214 }
215
216 CFixedVector3D n0 = up.Cross(left);
217 CFixedVector3D n1 = left.Cross(down);
218 CFixedVector3D n2 = down.Cross(right);
219 CFixedVector3D n3 = right.Cross(up);
220
221 // Compute the mean of the normals
222 normal = n0 + n1 + n2 + n3;
223 normal.Normalize();
224}
225
226///////////////////////////////////////////////////////////////////////////////
227// GetPatch: return the patch at (i,j) in patch space, or null if the patch is
228// out of bounds
229CPatch* CTerrain::GetPatch(ssize_t i, ssize_t j) const
230{
231 // range check (invalid indices are passed in by the culling and
232 // patch blend code because they iterate from 0..#patches and examine
233 // neighbors without checking if they're already on the edge)
234 if( (size_t)i >= (size_t)m_MapSizePatches || (size_t)j >= (size_t)m_MapSizePatches )
235 return 0;
236
237 return &m_Patches[(j*m_MapSizePatches)+i];
238}
239
240
241///////////////////////////////////////////////////////////////////////////////
242// GetTile: return the tile at (i,j) in tile space, or null if the tile is out
243// of bounds
244CMiniPatch* CTerrain::GetTile(ssize_t i, ssize_t j) const
245{
246 // see comment above
247 if( (size_t)i >= (size_t)(m_MapSize-1) || (size_t)j >= (size_t)(m_MapSize-1) )
248 return 0;
249
250 CPatch* patch=GetPatch(i/PATCH_SIZE, j/PATCH_SIZE); // can't fail (due to above check)
251 return &patch->m_MiniPatches[j%PATCH_SIZE][i%PATCH_SIZE];
252}
253
254float CTerrain::GetVertexGroundLevel(ssize_t i, ssize_t j) const
255{
256 i = clamp(i, (ssize_t)0, m_MapSize-1);
257 j = clamp(j, (ssize_t)0, m_MapSize-1);
258 return HEIGHT_SCALE * m_Heightmap[j*m_MapSize + i];
259}
260
261fixed CTerrain::GetVertexGroundLevelFixed(ssize_t i, ssize_t j) const
262{
263 i = clamp(i, (ssize_t)0, m_MapSize-1);
264 j = clamp(j, (ssize_t)0, m_MapSize-1);
265 // Convert to fixed metres (being careful to avoid intermediate overflows)
266 return fixed::FromInt(m_Heightmap[j*m_MapSize + i] / 2) / (int)(HEIGHT_UNITS_PER_METRE / 2);
267}
268
269fixed CTerrain::GetSlopeFixed(ssize_t i, ssize_t j) const
270{
271 // Clamp to size-2 so we can use the tiles (i,j)-(i+1,j+1)
272 i = clamp(i, (ssize_t)0, m_MapSize-2);
273 j = clamp(j, (ssize_t)0, m_MapSize-2);
274
275 u16 h00 = m_Heightmap[j*m_MapSize + i];
276 u16 h01 = m_Heightmap[(j+1)*m_MapSize + i];
277 u16 h10 = m_Heightmap[j*m_MapSize + (i+1)];
278 u16 h11 = m_Heightmap[(j+1)*m_MapSize + (i+1)];
279
280 // Difference of highest point from lowest point
281 u16 delta = std::max(std::max(h00, h01), std::max(h10, h11)) -
282 std::min(std::min(h00, h01), std::min(h10, h11));
283
284 // Compute fractional slope (being careful to avoid intermediate overflows)
285 return fixed::FromInt(delta / CELL_SIZE) / (int)HEIGHT_UNITS_PER_METRE;
286}
287
288float CTerrain::GetExactGroundLevel(float x, float z) const
289{
290 // Clamp to size-2 so we can use the tiles (xi,zi)-(xi+1,zi+1)
291 const ssize_t xi = clamp((ssize_t)floor(x/CELL_SIZE), (ssize_t)0, m_MapSize-2);
292 const ssize_t zi = clamp((ssize_t)floor(z/CELL_SIZE), (ssize_t)0, m_MapSize-2);
293
294 const float xf = clamp(x/CELL_SIZE-xi, 0.0f, 1.0f);
295 const float zf = clamp(z/CELL_SIZE-zi, 0.0f, 1.0f);
296
297 float h00 = m_Heightmap[zi*m_MapSize + xi];
298 float h01 = m_Heightmap[(zi+1)*m_MapSize + xi];
299 float h10 = m_Heightmap[zi*m_MapSize + (xi+1)];
300 float h11 = m_Heightmap[(zi+1)*m_MapSize + (xi+1)];
301 // Linearly interpolate
302 return (HEIGHT_SCALE * (
303 (1 - zf) * ((1 - xf) * h00 + xf * h10)
304 + zf * ((1 - xf) * h01 + xf * h11)));
305}
306
307fixed CTerrain::GetExactGroundLevelFixed(fixed x, fixed z) const
308{
309 // Clamp to size-2 so we can use the tiles (xi,zi)-(xi+1,zi+1)
310 const ssize_t xi = clamp((ssize_t)(x / (int)CELL_SIZE).ToInt_RoundToZero(), (ssize_t)0, m_MapSize-2);
311 const ssize_t zi = clamp((ssize_t)(z / (int)CELL_SIZE).ToInt_RoundToZero(), (ssize_t)0, m_MapSize-2);
312
313 const fixed one = fixed::FromInt(1);
314
315 const fixed xf = clamp((x / (int)CELL_SIZE) - fixed::FromInt(xi), fixed::Zero(), one);
316 const fixed zf = clamp((z / (int)CELL_SIZE) - fixed::FromInt(zi), fixed::Zero(), one);
317
318 u16 h00 = m_Heightmap[zi*m_MapSize + xi];
319 u16 h01 = m_Heightmap[(zi+1)*m_MapSize + xi];
320 u16 h10 = m_Heightmap[zi*m_MapSize + (xi+1)];
321 u16 h11 = m_Heightmap[(zi+1)*m_MapSize + (xi+1)];
322
323 // Intermediate scaling of xf, so we don't overflow in the multiplications below
324 // (h00 <= 65535, xf <= 1, max fixed is < 32768; divide by 2 here so xf1*h00 <= 32767.5)
325 const fixed xf0 = xf / 2;
326 const fixed xf1 = (one - xf) / 2;
327
328 // Linearly interpolate
329 return ((one - zf).Multiply(xf1 * h00 + xf0 * h10)
330 + zf.Multiply(xf1 * h01 + xf0 * h11)) / (int)(HEIGHT_UNITS_PER_METRE / 2);
331}
332
333bool CTerrain::GetTriangulationDir(ssize_t i, ssize_t j) const
334{
335 // Clamp to size-2 so we can use the tiles (i,j)-(i+1,j+1)
336 i = clamp(i, (ssize_t)0, m_MapSize-2);
337 j = clamp(j, (ssize_t)0, m_MapSize-2);
338
339 int h00 = m_Heightmap[j*m_MapSize + i];
340 int h01 = m_Heightmap[(j+1)*m_MapSize + i];
341 int h10 = m_Heightmap[j*m_MapSize + (i+1)];
342 int h11 = m_Heightmap[(j+1)*m_MapSize + (i+1)];
343
344 // Prefer triangulating in whichever direction means the midpoint of the diagonal
345 // will be the highest. (In particular this means a diagonal edge will be straight
346 // along the top, and jagged along the bottom, which makes sense for terrain.)
347 int mid1 = h00+h11;
348 int mid2 = h01+h10;
349 return (mid1 < mid2);
350}
351
352///////////////////////////////////////////////////////////////////////////////
353// Resize: resize this terrain to the given size (in patches per side)
354void CTerrain::Resize(ssize_t size)
355{
356 if (size==m_MapSizePatches) {
357 // inexplicable request to resize terrain to the same size .. ignore it
358 return;
359 }
360
361 if (!m_Heightmap) {
362 // not yet created a terrain; build a default terrain of the given size now
363 Initialize(size,0);
364 return;
365 }
366
367 // allocate data for new terrain
368 ssize_t newMapSize=size*PATCH_SIZE+1;
369 u16* newHeightmap=new u16[newMapSize*newMapSize];
370 CPatch* newPatches=new CPatch[size*size];
371
372 if (size>m_MapSizePatches) {
373 // new map is bigger than old one - zero the heightmap so we don't get uninitialised
374 // height data along the expanded edges
375 memset(newHeightmap,0,newMapSize*newMapSize*sizeof(u16));
376 }
377
378 // now copy over rows of data
379 u16* src=m_Heightmap;
380 u16* dst=newHeightmap;
381 ssize_t copysize=std::min(newMapSize, m_MapSize);
382 for (ssize_t j=0;j<copysize;j++) {
383 memcpy(dst,src,copysize*sizeof(u16));
384 dst+=copysize;
385 src+=m_MapSize;
386 if (newMapSize>m_MapSize) {
387 // extend the last height to the end of the row
388 for (size_t i=0;i<newMapSize-(size_t)m_MapSize;i++) {
389 *dst++=*(src-1);
390 }
391 }
392 }
393
394
395 if (newMapSize>m_MapSize) {
396 // copy over heights of the last row to any remaining rows
397 src=newHeightmap+((m_MapSize-1)*newMapSize);
398 dst=src+newMapSize;
399 for (ssize_t i=0;i<newMapSize-m_MapSize;i++) {
400 memcpy(dst,src,newMapSize*sizeof(u16));
401 dst+=newMapSize;
402 }
403 }
404
405 // now build new patches
406 for (ssize_t j=0;j<size;j++) {
407 for (ssize_t i=0;i<size;i++) {
408 // copy over texture data from existing tiles, if possible
409 if (i<m_MapSizePatches && j<m_MapSizePatches) {
410 memcpy(newPatches[j*size+i].m_MiniPatches,m_Patches[j*m_MapSizePatches+i].m_MiniPatches,sizeof(CMiniPatch)*PATCH_SIZE*PATCH_SIZE);
411 }
412 }
413
414 if (j<m_MapSizePatches && size>m_MapSizePatches) {
415 // copy over the last tile from each column
416 for (ssize_t n=0;n<size-m_MapSizePatches;n++) {
417 for (ssize_t m=0;m<PATCH_SIZE;m++) {
418 CMiniPatch& src=m_Patches[j*m_MapSizePatches+m_MapSizePatches-1].m_MiniPatches[m][15];
419 for (ssize_t k=0;k<PATCH_SIZE;k++) {
420 CMiniPatch& dst=newPatches[j*size+m_MapSizePatches+n].m_MiniPatches[m][k];
421 dst = src;
422 }
423 }
424 }
425 }
426 }
427
428 if (size>m_MapSizePatches) {
429 // copy over the last tile from each column
430 CPatch* srcpatch=&newPatches[(m_MapSizePatches-1)*size];
431 CPatch* dstpatch=srcpatch+size;
432 for (ssize_t p=0;p<(ssize_t)size-m_MapSizePatches;p++) {
433 for (ssize_t n=0;n<(ssize_t)size;n++) {
434 for (ssize_t m=0;m<PATCH_SIZE;m++) {
435 for (ssize_t k=0;k<PATCH_SIZE;k++) {
436 CMiniPatch& src=srcpatch->m_MiniPatches[15][k];
437 CMiniPatch& dst=dstpatch->m_MiniPatches[m][k];
438 dst = src;
439 }
440 }
441 srcpatch++;
442 dstpatch++;
443 }
444 }
445 }
446
447
448 // release all the original data
449 ReleaseData();
450
451 // store new data
452 m_Heightmap=newHeightmap;
453 m_Patches=newPatches;
454 m_MapSize=(ssize_t)newMapSize;
455 m_MapSizePatches=(ssize_t)size;
456
457 // initialise all the new patches
458 InitialisePatches();
459}
460
461///////////////////////////////////////////////////////////////////////////////
462// InitialisePatches: initialise patch data
463void CTerrain::InitialisePatches()
464{
465 for (ssize_t j=0;j<m_MapSizePatches;j++) {
466 for (ssize_t i=0;i<m_MapSizePatches;i++) {
467 CPatch* patch=GetPatch(i,j); // can't fail
468 patch->Initialize(this,i,j);
469 }
470 }
471}
472
473///////////////////////////////////////////////////////////////////////////////
474// SetHeightMap: set up a new heightmap from 16-bit source data;
475// assumes heightmap matches current terrain size
476void CTerrain::SetHeightMap(u16* heightmap)
477{
478 // keep a copy of the given heightmap
479 memcpy(m_Heightmap,heightmap,m_MapSize*m_MapSize*sizeof(u16));
480
481 // recalculate patch bounds, invalidate vertices
482 for (ssize_t j=0;j<m_MapSizePatches;j++) {
483 for (ssize_t i=0;i<m_MapSizePatches;i++) {
484 CPatch* patch=GetPatch(i,j); // can't fail
485 patch->InvalidateBounds();
486 patch->SetDirty(RENDERDATA_UPDATE_VERTICES);
487 }
488 }
489}
490
491
492///////////////////////////////////////////////////////////////////////////////
493// FlattenArea: flatten out an area of terrain (specified in world space
494// coords); return the average height of the flattened area
495float CTerrain::FlattenArea(float x0, float x1, float z0, float z1)
496{
497 const ssize_t tx0 = clamp(ssize_t(x0/CELL_SIZE), (ssize_t)0, m_MapSize-1);
498 const ssize_t tx1 = clamp(ssize_t(x1/CELL_SIZE)+1, (ssize_t)0, m_MapSize-1);
499 const ssize_t tz0 = clamp(ssize_t(z0/CELL_SIZE), (ssize_t)0, m_MapSize-1);
500 const ssize_t tz1 = clamp(ssize_t(z1/CELL_SIZE)+1, (ssize_t)0, m_MapSize-1);
501
502 size_t count=0;
503 double sum=0.0f;
504 for (ssize_t z=tz0;z<=tz1;z++) {
505 for (ssize_t x=tx0;x<=tx1;x++) {
506 sum+=m_Heightmap[z*m_MapSize + x];
507 count++;
508 }
509 }
510 const u16 avgY = u16(sum/count);
511
512 for (ssize_t z=tz0;z<=tz1;z++) {
513 for (ssize_t x=tx0;x<=tx1;x++) {
514 m_Heightmap[z*m_MapSize + x]=avgY;
515 }
516 }
517
518 MakeDirty(tx0, tz0, tx1, tz1, RENDERDATA_UPDATE_VERTICES);
519
520 return avgY*HEIGHT_SCALE;
521}
522
523///////////////////////////////////////////////////////////////////////////////
524
525void CTerrain::MakeDirty(ssize_t i0, ssize_t j0, ssize_t i1, ssize_t j1, int dirtyFlags)
526{
527 // flag vertex data as dirty for affected patches, and rebuild bounds of these patches
528 ssize_t pi0 = clamp((i0/PATCH_SIZE)-1, (ssize_t)0, m_MapSizePatches);
529 ssize_t pi1 = clamp((i1/PATCH_SIZE)+1, (ssize_t)0, m_MapSizePatches);
530 ssize_t pj0 = clamp((j0/PATCH_SIZE)-1, (ssize_t)0, m_MapSizePatches);
531 ssize_t pj1 = clamp((j1/PATCH_SIZE)+1, (ssize_t)0, m_MapSizePatches);
532 for (ssize_t j = pj0; j < pj1; j++) {
533 for (ssize_t i = pi0; i < pi1; i++) {
534 CPatch* patch = GetPatch(i,j); // can't fail (i,j were clamped)
535 if (dirtyFlags & RENDERDATA_UPDATE_VERTICES)
536 patch->CalcBounds();
537 patch->SetDirty(dirtyFlags);
538 }
539 }
540}
541
542void CTerrain::MakeDirty(int dirtyFlags)
543{
544 for (ssize_t j = 0; j < m_MapSizePatches; j++) {
545 for (ssize_t i = 0; i < m_MapSizePatches; i++) {
546 CPatch* patch = GetPatch(i,j); // can't fail
547 if (dirtyFlags & RENDERDATA_UPDATE_VERTICES)
548 patch->CalcBounds();
549 patch->SetDirty(dirtyFlags);
550 }
551 }
552}
553
554CBound CTerrain::GetVertexesBound(ssize_t i0, ssize_t j0, ssize_t i1, ssize_t j1)
555{
556 i0 = clamp(i0, (ssize_t)0, m_MapSize-1);
557 j0 = clamp(j0, (ssize_t)0, m_MapSize-1);
558 i1 = clamp(i1, (ssize_t)0, m_MapSize-1);
559 j1 = clamp(j1, (ssize_t)0, m_MapSize-1);
560
561 u16 minH = 65535;
562 u16 maxH = 0;
563
564 for (ssize_t j = j0; j <= j1; ++j)
565 {
566 for (ssize_t i = i0; i <= i1; ++i)
567 {
568 minH = std::min(minH, m_Heightmap[j*m_MapSize + i]);
569 maxH = std::max(maxH, m_Heightmap[j*m_MapSize + i]);
570 }
571 }
572
573 CBound bound;
574 bound[0].X = (float)(i0*CELL_SIZE);
575 bound[0].Y = (float)(minH*HEIGHT_SCALE);
576 bound[0].Z = (float)(j0*CELL_SIZE);
577 bound[1].X = (float)(i1*CELL_SIZE);
578 bound[1].Y = (float)(maxH*HEIGHT_SCALE);
579 bound[1].Z = (float)(j1*CELL_SIZE);
580 return bound;
581}
Note: See TracBrowser for help on using the repository browser.