My Project
|
temp height field terrain data used by terrain filters. More...
#include <TTerrain.h>
Public Member Functions | |
float * | GetHeightmap () |
void | Normalize () |
it is good practice to normalize terrain height field before computation, this will increase floating point accuracy, especially for those which have large average height value. More... | |
void | NormalizeHeight (float &height) |
normalize a height using current setting | |
void | Recover () |
recover normalized data back: i.e. More... | |
bool | CreatePlane (int gridSize, float fHeight, float fVertexSpacing_=1) |
create an unnormalized plane containing gridSize*gridSize number of vertices | |
bool | CreatePlane (const char *filename, float fVertexSpacing=1) |
load height field from file More... | |
void | SetHeight (int x, int y, float fValue) |
set the height at the specified gird position. More... | |
float | GetHeight (int x, int y) |
Get the height at the specified gird position. More... | |
float | GetHeightFinal (int x, int y) |
get the unnormalized (final) height at the specified gird position. More... | |
float | GetVertexSpacing () |
void | SetVertexSpacing (float fSpacing) |
float | GetMinHeight () |
void | SetMinHeight (float fMinHeight) |
float | GetMaxHeight () |
float | GetYScale () |
Note: if 0 is returned, it means that there is no scale. More... | |
int | GetGridSize () |
void | SetNormalized (bool bSet) |
set whether the heightfield data is normalized. More... | |
bool | IsNormalized () |
whether height field data is normalized | |
int | GetGridWidth () |
get the grid size | |
int | GetGridHeight () |
TTerrain () | |
TTerrain class. | |
void | Cleanup () |
delete terrain data | |
Public Attributes | |
int | width |
size of the terrain. More... | |
int | height |
float | fVertexSpacing |
float * | heightfield |
float * | selection |
float | sealevel |
sea level | |
Friends | |
class | CTerrainFilters |
temp height field terrain data used by terrain filters.
the Input and Output of terrain filters will be passed in this structure. terrain data may be saved in normalized space.
bool TTerrain::CreatePlane | ( | const char * | filename, |
float | fVertexSpacing = 1 |
||
) |
load height field from file
filename | : the raw elevation or gray scale image file that contains the height field. |
float TTerrain::GetHeight | ( | int | x, |
int | y | ||
) |
Get the height at the specified gird position.
No boundary check is performed. the height value returned is the same as what is stored in the height field. It may be normalized or unnormalized.
float TTerrain::GetHeightFinal | ( | int | x, |
int | y | ||
) |
get the unnormalized (final) height at the specified gird position.
No boundary check is performed.
float TTerrain::GetYScale | ( | ) |
Note: if 0 is returned, it means that there is no scale.
void TTerrain::Normalize | ( | ) |
it is good practice to normalize terrain height field before computation, this will increase floating point accuracy, especially for those which have large average height value.
it normalized terrain and unnormalized terrain are the same. the terrain height data [fMin, fMax] is normalized to [0,1] i.e. Normalize(h) = (h-fMin)/y_scale_factor; fMin,fMax, y_scale_factor will be recomputed.
void TTerrain::Recover | ( | ) |
recover normalized data back: i.e.
Recover(h) = (h*y_scale_factor+fMin)
void TTerrain::SetHeight | ( | int | x, |
int | y, | ||
float | fValue | ||
) |
set the height at the specified gird position.
No boundary check is performed.
void TTerrain::SetNormalized | ( | bool | bSet | ) |
set whether the heightfield data is normalized.
int ParaEngine::TTerrain::width |
size of the terrain.
Usually Width equals to Height