Functions |
BBDECL Entity *BBCALL | xCreateTerrain (int size, Entity *parent=NULL) |
| Creates a terrain entity and returns its handle.
|
BBDECL void BBCALL | xFreeTerrainTexture (TerrainTexture *texture) |
| Frees the streaming terrain texture.
|
BBDECL Entity *BBCALL | xLoadTerrain (const char *path, Entity *parent=NULL) |
| Loads a terrain from an image file and returns the terrain's handle.
|
BBDECL TerrainTexture *BBCALL | xLoadTerrainTexture (const char *path) |
| Loads the streaming texture for terrains.
|
BBDECL void BBCALL | xModifyTerrain (Terrain *terrain, int x, int y, float height, bool realtime=false) |
| Sets the height of a point on a terrain.
|
BBDECL void BBCALL | xTerrainDetail (Terrain *terrain, int detail) |
| Sets the detail level for a terrain.
|
BBDECL float BBCALL | xTerrainHeight (Terrain *terrain, int x, int y) |
| Returns the height of the terrain at terrain grid coordinates x, z.
|
BBDECL void BBCALL | xTerrainLODs (int lodsCount) |
| Sets the number of LOD levels for the terrains.
|
BBDECL void BBCALL | xTerrainShading (Terrain *terrain, bool state=false) |
| Enables or disables terrain shading.
|
BBDECL int BBCALL | xTerrainSize (Terrain *terrain) |
| Returns terrain size.
|
BBDECL void BBCALL | xTerrainSplatting (Terrain *terrain, bool state) |
| Enables or disables terrain splatting.
|
BBDECL void BBCALL | xTerrainTexture (Terrain *terrain, TerrainTexture *texture) |
| Applies the streaming texture for the terrain.
|
BBDECL void BBCALL | xTerrainTextureLightmap (TerrainTexture *texture, bool state) |
| Enables or disables lightmap used for the streaming texture.
|
BBDECL void BBCALL | xTerrainViewZone (Terrain *terrain, int viewZone, int texturingZone=-1) |
| Sets a view zone for the streaming terrain.
|
BBDECL float BBCALL | xTerrainX (Terrain *terrain, float x, float y, float z) |
| Returns the interpolated x coordinate on a terrain.
|
BBDECL float BBCALL | xTerrainY (Terrain *terrain, float x, float y, float z) |
| Returns the interpolated y coordinate on a terrain.
|
BBDECL float BBCALL | xTerrainZ (Terrain *terrain, float x, float y, float z) |
| Returns the interpolated z coordinate on a terrain.
|
BBDECL Entity* BBCALL 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 |
BBDECL Entity* BBCALL 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 |