Terrain

A class that access some general variables of the Terrain.

Method Summary
 nilcommit ()
 nilflatten (MediaItem brush, int area, int strength, array{} points)
 intgetAlphamapSize ()
 intgetHeightmapSize ()
 MediaItemgetNormalMap (int index)
 unsignedgetPhysicsMaterial (int index)
 intgetPixelError ()
 MediaItemgetTexture (int index)
 intgetTileSize ()
 floatgetTiling (int index)
 intgetWorldHeight ()
 intgetWorldSize ()
 nilinit ()
 booleanisEnabled ()
 booleanisLODActive ()
 booleanisNormalMappingActive ()
 nilloadFromMediaItem (MediaItem terrrain)
 nillower (MediaItem brush, int area, int strength, array{} points)
 nilpaint (int layer, MediaItem brush, int area, int strength, array{} points)
 nilraise (MediaItem brush, int area, int strength, array{} points)
 nilsetAlphamap (int layer, MediaItem alphamap)
 nilsetAlphamapSize (int size)
 nilsetDefault ()
 nilsetEnabled (boolean enable)
 nilsetHeightmap (MediaItem heightmap)
 nilsetHeightmapSize (int size)
 nilsetLODActive (boolean set)
 nilsetNormalMap (int index, MediaItem normalmap)
 nilsetNormalMappingActive (boolean set)
 nilsetPixelError (int error)
 nilsetTexture (int index, MediaItem texture)
 nilsetTileSize (int size)
 nilsetTiling (int index, number tiling)
 nilsetWorldHeight (int height)
 nilsetWorldSize (int size)
 nilsmooth (MediaItem brush, int area, int strength, array{} points)

Method Detail

commit

nil commit ()
Commits the changes made to the terrain configuration


flatten

nil flatten (MediaItem brush, int area, int strength, array{} points)
Flattens the terrain at the given points with the given brush

Parameters:
MediaItem brush - Brush image media item
int area - Brush size
int strength - Brush strength
array{} points - The points (x,z) where the brush will be applied.


getAlphamapSize

int getAlphamapSize ()
Returns the terrain alphamap image size.

Returns:
int - size Size of the alphamap


getHeightmapSize

int getHeightmapSize ()
Returns the terrain heightmap image size.

Returns:
int - size Size of the heightmap


getNormalMap

MediaItem getNormalMap (int index)
Returns the Media Item containing the terrain normal map at index.

Parameters:
int index - Normal Map index.

Returns:
MediaItem - Media Item containing the terrain normal map at index.


getPhysicsMaterial

unsigned getPhysicsMaterial (int index)
Returns the ID of the terrain physics material at index.

Parameters:
int index - Layer index.

Returns:
unsigned - int ID of the terrain physics material at index.


getPixelError

int getPixelError ()
Returns the terrain LOD max error.

Returns:
int - error Max pixel error


getTexture

MediaItem getTexture (int index)
Returns the Media Item containing the terrain texture at index.

Parameters:
int index - Texture index.

Returns:
MediaItem - Media Item containing the terrain texture at index.


getTileSize

int getTileSize ()
Returns the terrain tiles size.

Returns:
int - size Size of the tiles


getTiling

float getTiling (int index)
Returns the tiling of the terrain texture at index.

Parameters:
int index - Texture index.

Returns:
float - tiling of the terrain texture at index.


getWorldHeight

int getWorldHeight ()
Returns the terrain height in world units.

Returns:
int - height Height of the terrain


getWorldSize

int getWorldSize ()
Returns the terrain size in world units.

Returns:
int - size Size of the terrain


init

nil init ()


isEnabled

boolean isEnabled ()
Checks if the terrain is enabled or not.

Returns:
boolean - Whether the terrain is enabled or not.


isLODActive

boolean isLODActive ()
Checks if the terrain LOD is active or not.

Returns:
boolean - Whether the terrain LOD is active or not.


isNormalMappingActive

boolean isNormalMappingActive ()
Checks if the terrain normal mapping is active or not.

Returns:
boolean - Whether the terrain normal mapping is active or not.


loadFromMediaItem

nil loadFromMediaItem (MediaItem terrrain)
Loads a terrain from a MediaItem.

Parameters:
MediaItem terrrain - Terrain Mediaitem.


lower

nil lower (MediaItem brush, int area, int strength, array{} points)
Lowers the terrain at the given points with the given brush

Parameters:
MediaItem brush - Brush image media item
int area - Brush size
int strength - Brush strength
array{} points - The points (x,z) where the brush will be applied.


paint

nil paint (int layer, MediaItem brush, int area, int strength, array{} points)
Paints the terrain layer at the given points with the given brush

Parameters:
int layer - Layer
MediaItem brush - Brush image media item
int area - Brush size
int strength - Brush strength
array{} points - The points (x,z) where the brush will be applied.


raise

nil raise (MediaItem brush, int area, int strength, array{} points)
Raises the terrain at the given points with the given brush

Parameters:
MediaItem brush - Brush image media item
int area - Brush size
int strength - Brush strength
array{} points - The points (x,z) where the brush will be applied.


setAlphamap

nil setAlphamap (int layer, MediaItem alphamap)
Sets the selected terrain layer alphamap image

Parameters:
int layer - Layer
MediaItem alphamap - Alphamap image media item


setAlphamapSize

nil setAlphamapSize (int size)
Sets the size of the terrain alphamaps images

Parameters:
int size - Alphamap size


setDefault

nil setDefault ()
Resets the terrain configuration to it's default


setEnabled

nil setEnabled (boolean enable)
Enables or disables the terrain.

Parameters:
boolean enable - Whether the terrain is enable or not.


setHeightmap

nil setHeightmap (MediaItem heightmap)
Sets the terrain heightmap image

Parameters:
MediaItem heightmap - Heightmap image media item


setHeightmapSize

nil setHeightmapSize (int size)
Sets the size of the terrain heightmap image

Parameters:
int size - Heightmap size


setLODActive

nil setLODActive (boolean set)
Activate or deactivate the terrain LOD.

Parameters:
boolean set - the terrain LOD active or not.


setNormalMap

nil setNormalMap (int index, MediaItem normalmap)
Sets the normal map of the layer at index.

Parameters:
int index - Normal map index.
MediaItem normalmap - Media Item containing the normal map for the terrain.


setNormalMappingActive

nil setNormalMappingActive (boolean set)
Activate or deactivate the terrain normal mapping.

Parameters:
boolean set - the terrain normal mapping active or not.


setPixelError

nil setPixelError (int error)
Sets the max error of the terrain LOD

Parameters:
int error - Max pixel error


setTexture

nil setTexture (int index, MediaItem texture)
Sets the texture of the layer at index.

Parameters:
int index - Texture index.
MediaItem texture - Media Item containing the texture for the terrain.


setTileSize

nil setTileSize (int size)
Sets the size of the terrain tiles

Parameters:
int size - Tile size


setTiling

nil setTiling (int index, number tiling)
Sets the tiling of the texture of the layer at index.

Parameters:
int index - Texture index.
number tiling - tiling value of the texture for the terrain.


setWorldHeight

nil setWorldHeight (int height)
Sets the height of the terrain in world units.

Parameters:
int height - World height.


setWorldSize

nil setWorldSize (int size)
Sets the size of the terrain in world units.

Parameters:
int size - World size.


smooth

nil smooth (MediaItem brush, int area, int strength, array{} points)
Smooths the terrain at the given points with the given brush

Parameters:
MediaItem brush - Brush image media item
int area - Brush size
int strength - Brush strength
array{} points - The points (x,z) where the brush will be applied.