36 inline float* GetHeightmap(){
return heightfield;};
51 bool CreatePlane(
int gridSize,
float fHeight,
float fVertexSpacing_=1 );
56 bool CreatePlane(
const char* filename,
float fVertexSpacing = 1);
59 void SetHeight(
int x,
int y,
float fValue);
67 float GetVertexSpacing();
68 void SetVertexSpacing(
float fSpacing);
71 void SetMinHeight(
float fMinHeight);
85 int GetGridHeight(){
return height;}
113 this->pTerrain = pTerrain;
114 this->nHitCount = 1<<31;
118 this->pHeightmap = pHeightmap;
119 this->nHitCount = 1<<31;
123 this->pTerrain = NULL;
124 this->nHitCount = 1<<31;
128 this->nHitCount |= 1<<31;
132 if(this->nHitCount<0x0000ffff)
135 this->nHitCount = this->nHitCount>>1;
void SetNormalized(bool bSet)
set whether the heightfield data is normalized.
Definition: TTerrain.cpp:135
Definition: SceneObject.h:15
temp height field terrain data used by terrain filters.
Definition: TTerrain.h:16
different physics engine has different winding order.
Definition: EventBinding.h:32
float GetHeightFinal(int x, int y)
get the unnormalized (final) height at the specified gird position.
Definition: TTerrain.cpp:117
void Recover()
recover normalized data back: i.e.
Definition: TTerrain.cpp:200
void Normalize()
it is good practice to normalize terrain height field before computation, this will increase floating...
Definition: TTerrain.cpp:140
void FrameMove()
this is called every rendering frame.
Definition: TTerrain.h:131
void SetHeight(int x, int y, float fValue)
set the height at the specified gird position.
Definition: TTerrain.cpp:107
a cached Terrain tile item
Definition: TTerrain.h:98
bool IsNormalized()
whether height field data is normalized
Definition: TTerrain.cpp:131
float sealevel
sea level
Definition: TTerrain.h:34
void OnHit()
on hit
Definition: TTerrain.h:127
int width
size of the terrain.
Definition: TTerrain.h:28
TTerrain()
TTerrain class.
Definition: TTerrain.cpp:23
void NormalizeHeight(float &height)
normalize a height using current setting
Definition: TTerrain.cpp:175
float GetHeight(int x, int y)
Get the height at the specified gird position.
Definition: TTerrain.cpp:112
int GetGridWidth()
get the grid size
Definition: TTerrain.h:84
DWORD nHitCount
a bits mask of number of times that this tile is hit in the last 32 render frames.
Definition: TTerrain.h:110
This class represents a single, contiguous chunk of terrain and is the primary public interface to De...
Definition: Terrain.h:386
Perform filtering on a terrain height field.
Definition: TerrainFilters.h:12
void Cleanup()
delete terrain data
Definition: TTerrain.cpp:34
float GetYScale()
Note: if 0 is returned, it means that there is no scale.
Definition: TTerrain.cpp:102
bool CreatePlane(int gridSize, float fHeight, float fVertexSpacing_=1)
create an unnormalized plane containing gridSize*gridSize number of vertices
Definition: TTerrain.cpp:40