Functions |
Entity * | xCreateTerrain (int size, Entity *parent=NULL) |
| Creates a terrain entity and returns its handle.
|
void | xFreeTerrainTexture (TerrainTexture *texture) |
| Frees the streaming terrain texture.
|
Entity * | xLoadTerrain (const char *path, Entity *parent=NULL) |
| Loads a terrain from an image file and returns the terrain's handle.
|
TerrainTexture * | xLoadTerrainTexture (const char *path) |
| Loads the streaming texture for terrains.
|
void | xModifyTerrain (Terrain *terrain, int x, int y, float height, bool realtime=false) |
| Sets the height of a point on a terrain.
|
void | xTerrainDetail (Terrain *terrain, int detail) |
| Sets the detail level for a terrain.
|
float | xTerrainHeight (Terrain *terrain, int x, int y) |
| Returns the height of the terrain at terrain grid coordinates x, z.
|
void | xTerrainLODs (int lodsCount) |
| Sets the number of LOD levels for the terrains.
|
void | xTerrainShading (Terrain *terrain, bool state=false) |
| Enables or disables terrain shading.
|
int | xTerrainSize (Terrain *terrain) |
| Returns terrain size.
|
void | xTerrainSplatting (Terrain *terrain, bool state) |
| Enables or disables terrain splatting.
|
void | xTerrainTexture (Terrain *terrain, TerrainTexture *texture) |
| Applies the streaming texture for the terrain.
|
void | xTerrainTextureLightmap (TerrainTexture *texture, bool state) |
| Enables or disables lightmap used for the streaming texture.
|
void | xTerrainViewZone (Terrain *terrain, int viewZone, int texturingZone=-1) |
| Sets a view zone for the streaming terrain.
|
float | xTerrainX (Terrain *terrain, float x, float y, float z) |
| Returns the interpolated x coordinate on a terrain.
|
float | xTerrainY (Terrain *terrain, float x, float y, float z) |
| Returns the interpolated y coordinate on a terrain.
|
float | xTerrainZ (Terrain *terrain, float x, float y, float z) |
| Returns the interpolated z coordinate on a terrain.
|
Entity* xLoadTerrain |
( |
const char * |
path, |
|
|
Entity * |
parent = NULL |
|
) |
| |
Loads a terrain from an image file and returns the terrain's handle.
The image's red channel is used to determine heights. Terrain is initially the same width and depth as the image, and 1.0 unit high.
Tips on generating nice terrain:
Smooth or blur the height map
Reduce the y scale of the terrain
Increase the x/z scale of the terrain
Reduce the camera range
When texturing an entity, a texture with a scale of 1, 1, 1 (default) will cover the whole terrain.
The parent parameter allows you to specify a parent entity for the terrain so that when the parent is moved the child terrain will move with it. However, this relationship is one way; applying movement commands to the child will not affect the parent. Specifying a parent entity will still result in the terrain being created at position 0, 0, 0 rather than at the parent entity's position. A heightmaps dimensions (width and height) must be the same and must be a power of 2 (e.g. 64, 128, 256, 512, 1024) or a power of 2 + 1 (e.g. 65, 129, 257, 513, 1025).
- Parameters:
-
path | Filename of image file to be used as height map |
parent | Parent entity handle |
Entity* xCreateTerrain |
( |
int |
size, |
|
|
Entity * |
parent = NULL |
|
) |
| |
Creates a terrain entity and returns its handle.
The terrain extends from 0, 0, 0 to size, 1, size. The parent parameter allows you to specify a parent entity for the terrain so that when the parent is moved the child terrain will move with it. However, this relationship is one way; applying movement commands to the child will not affect the parent. Specifying a parent entity will still result in the terrain being created at position 0, 0, 0 rather than at the parent entity's position.
- Parameters:
-
size | Number of grid squares along each side of terrain, and must be a power of 2 value, e.g. 32, 64, 128, 256, 512, 1024 |
parent | Parent entity handle |