Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins

ObjectTerrain Class

This class is used to create terrains. The terrain is rendered using grid-based surfaces, each of which has has a unique set of textures. The following textures are created automatically:

ObjectTerrain Class

This class inherits from Object

Members


ObjectTerrain ()

Constructor. Creates a new terrain object with default properties.

ObjectTerrain (string file_name)

Constructor. Creates a new terrain object from a given file.

Arguments

  • string file_name - Name of the terrain file.

int addMaterial (string name)

Adds a new layer to the terrain.

Arguments

  • string name - Name of the layer.

Return value

Number of the added layer.

int create (Image image, float step)

Creates a new terrain with the specified step from a loaded height map.

Arguments

  • Image image - Height map.
  • float step - Step of terrain grid cell in units.

Return value

Returns 1 if the terrain is created successfully; otherwise, 0.

int create (variable a0, variable a1, variable a2)

Creates a new terrain. Depending on the variables passed as arguments, the terrain is created in one of the following ways:
  • int size_x, int size_y and float step - a flat terrain of the specified size and step.
  • Image image, float step and float scale - a terrain with already defined relief based on a height map.

Arguments

  • variable a0 - A variable of one of the following types:
    • int size_x - the width of the terrain along the X axis in range [257;32679], in grid cells.
    • Image image - a height map.
  • variable a1 - A variable of one of the following types:
    • int size_y - the length of the terrain along the Y axis in range [257;32679], in grid cells.
    • float step - the step of terrain grid cell, in units.
  • variable a2 - A variable of one of the following types:
    • float step - the step of the terrain grid cell, in units.
    • float scale - the maximum height, in units.

Return value

Returns 1 if the terrain is created successfully; otherwise, 0.

string getDiffuseTextureArrayName ()

Returns the name of the diffuse textures array.

Return value

Name of the array.

int getDiffuseTextureImage (Image image)

Writes the image that is currently used as a diffuse texture for a whole terrain into the given buffer.

Arguments

  • Image image - Image buffer to write a texture into.

Return value

1 if the texture has been successfully written into the buffer; otherwise, 0.

string getDiffuseTextureName ()

Returns the path to the current terrain diffuse texture.

Return value

Path to the diffuse texture.

float getHeight (variable x, variable y)

Returns a height of a given terrain point.

Arguments

  • variable x - X coordinate of the point. Can be either int (exact grid point) or float (interpolated height value between two points).
  • variable y - Y coordinate of the point. Can be either int (exact grid point) or float (interpolated height value between two points).

Return value

Height.

int getHeights (int x, int y, int width, int height, Image image, int format, float scale = 1.0f)

Exports a height map into an image of the specified format. The sum of the X coordinate of the point on the terrain grid and width of the exported image must be less than or equal to the maximum terrain width. The sum of the Y coordinate of the point on the terrain grid and height of the exported image must be less than or equal to the maximum terrain length.

Arguments

  • int x - X coordinate of the point on the terrain grid.
  • int y - Y coordinate of the point on the terrain grid.
  • int width - Width of the exported image in grid points.
  • int height - Height of the exported image in grid points.
  • Image image - Image to export a height map into.
  • int format - Image format.
  • float scale - Height map scale. The default is 1.0f

Return value

Returns 1 if the height map is exported successfully; otherwise, 0.

int getHole (variable x, variable y)

Returns a value indicating if there is a hole at a given point.

Arguments

  • variable x - X-coordinate of the point. Can be either int or float.
  • variable y - Y-coordinate of the point. Must be of the same type as x.

Return value

Positive number if there is a hole; otherwise, 0.

int getHoles (int x, int y, int width, int height, Image image)

Exports a holes texture into an R8 image.

Arguments

  • int x - X coordinate of the point on the terrain grid.
  • int y - Y coordinate of the point on the terrain grid.
  • int width - Width of the exported image in grid points.
  • int height - Height of the exported image in grid points.
  • Image image - Image to export a holes texture into.

Return value

1 if the holes texture was successfully exported; otherwise, 0.

int getIndexTextureImage (Image image)

Writes the index texture into the given buffer.

Arguments

  • Image image - Image buffer to put the texture into.

Return value

1 if the texture has been written into the buffer successfully; otherwise - 0.

string getIndexTextureName ()

Returns the current name of the index texture.

Return value

Name of the index texture.

int getIntersection (vec3 p0, vec3 p1, variable v, int surface, int holes)

Performs the search for the intersection of the given terrain surface with the given traced line. Depending on the variable, passed as the third argument, the return value can be the intersection point, the intersection point normal or the intersection point texture coordinates.

Notice
Terrain local space coordinates are used for this function.

Arguments

  • vec3 p0 - Start point coordinates.
  • vec3 p1 - End point coordinates.
  • variable v - Variable defining the return array content. It can be one of the following:
    • vec3 point - The intersection point.
    • vec3 normal - The intersection point normal.
    • vec4 texcoord - The intersection point texture coordinates along the X and the Y axes (the Z and the W values are always equal to zero).
  • int surface - The number of the terrain surface.
  • int holes - 0 is to return the intersection with a terrain even if it hits the hole; otherwise, 1.

Return value

The return array ID.

float getLodDistance ()

Returns a distance to the first level of details. This distance is used to calculate distances to the rest of levels of details.

Return value

Base LOD distance in units.

float getLodProgression ()

Returns LOD progression value. Default value is 2.0.

Return value

LOD Progression value.

ObjectTerrain getLodTerrainBottom ()

Returns the bottom LOD of the current terrain.

Return value

Bottom terrain LOD.

ObjectTerrain getLodTerrainLeft ()

Returns the left LOD of the current terrain.

Return value

Left terrain LOD.

ObjectTerrain getLodTerrainRight ()

Returns the right LOD of the current terrain.

Return value

Right terrain LOD.

ObjectTerrain getLodTerrainTop ()

Returns the top LOD of the current terrain.

Return value

Top terrain LOD.

float getLodThreshold ()

Returns the LOD height threshold.

Return value

LOD height threshold.

int getMaskTextureImage (Image image)

Writes the image that is currently used as a mask for a whole terrain into the given buffer.

Arguments

  • Image image - Image buffer to write the mask into.

Return value

1 if the mask image is successfully written into the buffer; otherwise, 0.

string getMaskTextureName ()

Returns a name of the the mask texture used for the whole terrain.

Return value

Name (path) of the terrain mask texture.

float getMaterialDiffuseScale (int num)

Returns the visibility scale of a diffuse texture assigned to the specified layer. The default is 0.5.

Arguments

  • int num - Layer number.

Return value

Visibility scale.

string getMaterialDiffuseTextureName (int num)

Returns the diffuse texture name of the specified layer.

Arguments

  • int num - Layer number.

Return value

Diffuse texture name (path).

int getMaterialMaskBase (int num)

Returns a value indicating that a Mask Base parameter is set for the layer (the mask of the parent layer is used).

Arguments

  • int num - Layer number.

Return value

1 is the Mask Base parameter is set; otherwise - 0.

float getMaterialMaskThreshold (int num)

Returns the mask blending threshold.

Arguments

  • int num - Layer number.

Return value

Layer mask blending threshold.

float getMaterialMaskValue (int num)

Returns the layer blending value.

Arguments

  • int num - Layer number.

Return value

Blending value.

float getMaterialMaskWidth (int num)

Returns the mask blending width.

Arguments

  • int num - Layer number.

Return value

Layer mask blending width.

string getMaterialName (int num)

Returns the name of the specified layer.

Arguments

  • int num - Layer number.

Return value

Layer name.

float getMaterialNormalScale (int num)

Returns the visibility scale of a normal map assigned to the specified layer. The default is 0.5.

Arguments

  • int num - Layer number.

Return value

Visibility scale.

string getMaterialNormalTextureName (int num)

Returns the normal map name of the specified layer.

Arguments

  • int num - Layer number.

Return value

Normal map name (path).

int getMaterialOverlap (int num)

Returns the number indicating if the Overlap mode is enabled for the given layer.

Arguments

  • int num - Layer number.

Return value

1 if the Overlap mode is enabled, otherwise - 0.

int getMaterialParent (int num)

Returns the number of the parent layer.

Arguments

  • int num - Layer number.

Return value

Number of the parent layer.

float getMaterialSpecularScale (int num)

Returns the visibility scale of a specular texture assigned to the specified layer.

Arguments

  • int num - Layer number.

Return value

Visibility scale value.

string getMaterialSpecularTextureName (int num)

Returns the visibility scale of a specular texture assigned to the specified layer.

Arguments

  • int num - Layer number.

Return value

Visibility scale value.

vec4 getMaterialTransform (int num)

Returns the texture coordinate transformations of the layer.

Arguments

  • int num - Layer number.

Return value

Texture coordinates transformation of the layer (tile and offset).

string getNormalTextureArrayName ()

Returns the name of the normal textures array.

Return value

Name of the normal textures array.

int getNormalTextureImage (Image image)

Writes the image that is currently used as a normal texture for a terrain into the given buffer.

Arguments

  • Image image - Image buffer to write a texture into.

Return value

1 if the texture has been successfully written into the buffer; otherwise, 0.

string getNormalTextureName ()

Returns the name of the normal map texture, which is used for the whole terrain.

Return value

Name (path) of the normal map texture.

vec3 getNormal (int x, int y)

Returns a normal vector at a given terrain point.

Arguments

  • int x - X coordinate of the point on the terrain grid.
  • int y - Y coordinate of the point on the terrain grid.

Return value

Normal vector if the operation was successful, otherwise - 0.

vec3 getNormal (vec3 float v)

Returns a normal vector at a given terrain point.

Arguments

  • vec3 float v - Coordinates of the point on the terrain grid.

Return value

Normal vector if the operation was successful, otherwise - 0.

int getNormals (int x, int y, int width, int height, Image image)

Exports a selected area of the normal map into the RG8 image.

Arguments

  • int x - X coordinate of the point on the terrain grid.
  • int y - Y coordinate of the point on the terrain grid.
  • int width - Width of the exported image in grid points.
  • int height - Height of the exported image in grid points.
  • Image image - Image to export a normal map into.

Return value

1 if the normal map was successfully exported; otherwise, 0.

int getNumMaterials ()

Returns the total number of terrain layers.

Return value

The total number of layers.

vec3 getPoint (vec3 point)

Returns the point on the terrain grid.

Arguments

  • vec3 point - Point coordinates.

Return value

Returns the point if it's found; otherwise, 0.

float getShadowDistance ()

Returns the Shadow distance parameter value (the distance up to which a terrain casts shadows).

Return value

Distance, in units.

float getShadowRadius ()

Returns the Off-camera shadow extension parameter value (the distance up to which additional terrain polygons outside the viewing frustum are rendered).

Return value

Distance, in units.

int getSizeX ()

Returns terrain width, in grid cells.

Return value

Terrain width along X axis.

int getSizeY ()

Returns terrain length, in grid cells.

Return value

Terrain length along Y axis.

string getSpecularTextureArrayName ()

Returns the name of the specular textures array.

Return value

Name of the array.

float getStep ()

Returns the linear size of a cell, in units.

Return value

Cell size.

BoundBox getSurfaceBoundBox (int x, int y)

Returns the bounding box of the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.

Return value

Bounding box of the surface.

BoundSphere getSurfaceBoundSphere (int x, int y)

Returns the bounding sphere of the surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.

Return value

Bounding sphere of the surface.

int getSurfaceDiffuseTextureImage (int x, int y, Image image)

Exports a diffuse texture of the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • Image image - Image to export a surface diffuse texture into.

Return value

1 if the surface diffuse texture was successfully exported; otherwise, 0.

string getSurfaceDiffuseTextureName (int x, int y)

Returns the name of the diffuse texture for the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.

Return value

Texture name (path).

int getSurfaceIndexTextureImage (int x, int y, Image image)

Writes the index image of the specified surface into the given buffer.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • Image image - Image buffer to put the texture into.

Return value

1 if the texture has been written into the buffer successfully; otherwise - 0.

string getSurfaceIndexTextureName (int x, int y)

Returns the name of the index texture for the given terrain surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.

Return value

Name of the texture.

float getSurfaceLodThreshold (int x, int y)

Returns the threshold value for the first LOD of the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.

Return value

Threshold value.

int getSurfaceMaskTextureImage (int x, int y, Image image)

Exports a mask texture of the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • Image image - Image to export a surface mask texture into.

Return value

1 if the surface mask texture was successfully exported; otherwise, 0.

string getSurfaceMaskTextureName (int x, int y)

Returns a mask texture name of the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.

Return value

Name (path) of the surface mask texture.

int getSurfaceNormalTextureImage (int x, int y, Image image)

Exports a normal map of the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • Image image - Image to export a surface normal map into.

Return value

1 if the surface normal map was successfully exported; otherwise, 0.

string getSurfaceNormalTextureName (int x, int y)

Returns a normal map name of the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.

Return value

Name (path) of the surface normal map.

int getSurfacesX ()

Returns the number of the surface along the X axis.

Return value

Number of the surface along the X axis.

int getSurfacesY ()

Returns the number of the surface along the Y axis.

Return value

Number of the surface along the Y axis.

string getTerrainName ()

Returns a name of the terrain.

Return value

Terrain name (path to the .TER file).

float getVisibleDistance ()

Returns the distance up to which terrain is rendered visible. The terrain would disappear on the per-surface basis.

Return value

Visibility distance, in units.

int isLoaded ()

Returns a value indicating whether terrain is loaded.

Return value

1 if the terrain is loaded; otherwise, 0.

int isSurfaceCastShadow (int x, int y)

Returns a value indicating whether terrain geometry across the current surface casts shadows (from all types of light sources).

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.

Return value

1 if the refined surface casts shadows; otherwise, 0.

int isSurfaceEnabled (int x, int y)

Returns a value indicating whether a specified refined surface is enabled or disabled for rendering.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.

Return value

1 if the surface is enabled; otherwise, 0.

int loadHeights (vec3 center, float radius, vec3 max, vec3 min, int force = 0)

Force the loading of the specified terrain region.

Arguments

  • vec3 center - Bounding sphere center.
  • float radius - Bounding sphere radius.
  • vec3 max - Bounding box maximum.
  • vec3 min - Bounding box minimum.
  • int force - 1 to force loading of the terrain region.

Return value

1 if the specified terrain region is loaded successfully; otherwise 0.

int loadTerrain (string name)

Loads a terrain from a given file.

Arguments

  • string name - Path to the terrain file (*.ter).

Return value

Returns 1 if the terrain is loaded successfully; otherwise, 0.

void removeMaterial (int num)

Removes the specified layer.

Arguments

  • int num - Layer number.

int saveTerrain (string name, int force = 0)

Saves the terrain.

Arguments

  • string name - Path to the terrain file (*.ter).
  • int force - Force flag. Use 1 to save the terrain file in any case or 0 to save the terrain file only if any changes were made.

Return value

Returns 1 if the terrain is saved successfully; otherwise, 0.

void setDiffuseTextureArrayName (string name)

Sets the new name for the diffuse textures array.

Arguments

  • string name - Name of the diffuse textures array.

int setDiffuseTextureImage (Image Image)

Imports a diffuse texture for a whole terrain.

Arguments

  • Image Image - Image.

Return value

1 if the texture image is successfully set; otherwise, 0.

void setDiffuseTextureName (string name)

Sets the name of a diffuse texture used for the whole terrain.

Arguments

  • string name - Name (path) of the diffuse texture.

void setHeight (int grid_x, int grid_y, float height)

Changes the height of a given terrain point.

Arguments

  • int grid_x - X coordinate of the point on the terrain grid.
  • int grid_y - Y coordinate of the point on the terrain grid.
  • float height - Height, in units.

int setHeights (int x, int y, Image image, float scale = 1.0f)

Imports a height map for the terrain.

Arguments

  • int x - X coordinate of the point on the terrain grid in range from 0 to the maximum terrain width.
  • int y - Y coordinate of the point on the terrain grid in range from 0 to the maximum terrain length.
  • Image image - Height map.
  • float scale - Maximum height value.

Return value

Returns 1 if the height map is imported successfully; otherwise, 0.

void setHole (int grid_x, int grid_y, int hole)

Adds or removes holes to the terrain.

Arguments

  • int grid_x - X coordinate of the point on the terrain grid.
  • int grid_y - Y coordinate of the point on the terrain grid.
  • int hole - 1 to add a hole, 0 to remove a hole.

int setHoles (int x, int y, Image image)

Imports a holes texture for the terrain.

Arguments

  • int x - X coordinate of the point on the terrain grid.
  • int y - Y coordinate of the point on the terrain grid.
  • Image image - Holes texture.

Return value

1 if the holes image was successfully set; otherwise, 0.

int setIndexTextureImage (Image image)

Sets the new coarse index texture.

Arguments

  • Image image - Texture to be set.

Return value

1 if the texture has been set successfully; otherwise, 0.

void setIndexTextureName (string name)

Sets the new index texture name.

Arguments

  • string name - Texture name.

void setLodDistance (float distance)

Sets a distance to the first level of details.

Arguments

  • float distance - Distance, in units.

void setLodProgression (float progression)

Sets LOD Progression value. This distance is used to calculate distances to the rest of levels of details.

Arguments

  • float progression - LOD Progression value.

void setLodTerrainBottom (ObjectTerrain terrain)

Sets the new bottom LOD for the current terrain.

Arguments

  • ObjectTerrain terrain - Bottom LOD.

void setLodTerrainLeft (ObjectTerrain terrain)

Sets the new left LOD for the current terrain.

Arguments

  • ObjectTerrain terrain - Left LOD.

void setLodTerrainRight (ObjectTerrain terrain)

Sets the new right LOD for the current terrain.

Arguments

  • ObjectTerrain terrain - Right LOD.

void setLodTerrainTop (ObjectTerrain terrain)

Sets the new top LOD for the current terrain.

Arguments

  • ObjectTerrain terrain - Top LOD.

void setLodThreshold (float threshold, int force = 0)

Sets the LOD height threshold.

Arguments

  • float threshold - LOD height threshold.
  • int force - Force flag. The terrain will load all height maps into the memory and will perform height map relaxation for the smooth LOD transition for the given threshold level.

int setMaskTextureImage (Image Image)

Sets an image that will be used as a mask texture for a whole terrain.

Arguments

  • Image Image - Pointer to the image.

Return value

1 if the mask image is successfully set; otherwise, 0.

void setMaskTextureName (string name)

Sets a mask texture name that is used for the whole terrain.

Arguments

  • string name - Name (path) of the terrain mask texture.

void setMaterialDiffuseScale (int num, float scale)

Sets the visibility scale of a diffuse texture assigned to the specified layer. The default is 0.5.

Arguments

  • int num - Layer number.
  • float scale - Diffuse texture visibility scale. The provided value is saturated in range [0.0;1.0].

void setMaterialDiffuseTextureName (int num, string name)

Sets a diffuse texture name for the specified layer.

Arguments

  • int num - Layer number.
  • string name - Diffuse texture name (path).

void setMaterialMaskBase (int num, int base)

Sets the mask base parameter.

Arguments

  • int num - Layer number.
  • int base - Mask base flag.

void setMaterialMaskThreshold (int num, float threshold)

Sets the new blending threshold for a layer.

Arguments

  • int num - Layer number.
  • float threshold - Threshold value.

void setMaterialMaskValue (int num, float value)

Sets the new blending value for a layer.

Arguments

  • int num - Layer number.
  • float value - Blending value.

void setMaterialMaskWidth (int num, float width)

Sets the new width for a layer.

Arguments

  • int num - Layer number.
  • float width - Width value.

void setMaterialName (int num, string name)

Sets a new name for the layer.

Arguments

  • int num - Layer number.
  • string name - Name.

void setMaterialNormalScale (int num, float scale)

Sets the visibility scale of a normal map assigned to the specified layer. The provided value is saturated in range [0.0;1.0]. The default is 0.5.

Arguments

  • int num - Layer number.
  • float scale - Visibility scale.

void setMaterialNormalTextureName (int num, string name)

Sets a normal map name for the specified layer.

Arguments

  • int num - Layer number.
  • string name - Normal map name (path).

void setMaterialOverlap (int num, int overlap)

Sets the Overlap mode for a layer.

Arguments

  • int num - Layer number.
  • int overlap - 1 to enable the Overlap mode.

void setMaterialParent (int num, int parent)

Sets the new parent layer for the given layer.

Arguments

  • int num - Layer number.
  • int parent - Parent layer number.

void setMaterialSpecularScale (int num, float scale)

Sets the visibility scale of a specular texture assigned to the specified layer. The default is 0.5.

Arguments

  • int num - Layer number.
  • float scale - Visibility scale value. The provided value is saturated in range [0.0;1.0].

void setMaterialSpecularTextureName (int num, string name)

Sets a specular texture name for the specified layer.

Arguments

  • int num - Layer number.
  • string name - Specular texture name (path).

void setMaterialTransform (int num, vec4 transform)

Sets the texture coordinate transformations for the layer (diffuse texture and normal map).

Arguments

  • int num - Layer number.
  • vec4 transform - Texture coordinates transformation of layer (tile and offset).

void setNormalTextureArrayName (string name)

Sets the new name of the normal textures array.

Arguments

  • string name - Normal textures array name.

int setNormalTextureImage (Image Image)

Sets the new normal texture for a whole terrain.

Arguments

  • Image Image - Pointer to the image.

Return value

1 if the texture image is successfully set; otherwise, 0.

void setNormalTextureName (string name)

Sets the new name of a normal map used for the whole terrain.

Arguments

  • string name - Name (path) of the normal map texture.

void setNumMaterials (int num)

Adds the specified number of layers to the terrain.

Arguments

  • int num - Number of the layers.

void setShadowDistance (float distance)

Sets the new Shadow distance parameter value (the distance up to which a terrain casts shadows).

Arguments

  • float distance - Distance, in units.

void setShadowRadius (float radius)

Sets the new the Off-camera shadow extension parameter value (the distance up to which additional terrain polygons outside the viewing frustum are rendered).

Arguments

  • float radius - Distance, in units.

void setSpecularTextureArrayName (string name)

Sets the new name of the specular textures array.

Arguments

  • string name - Name of the array.

void setSurfaceCastShadow (int x, int y, int cast_shadow)

Sets a value indicating whether terrain geometry across the current surface should cast shadows (from all types of light sources).

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • int cast_shadow - 1 is to cast shadows; 0 not to cast.

int setSurfaceDiffuseTextureImage (int x, int y, Image image)

Imports a diffuse texture to the specified refined surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • Image image - Surface diffuse texture image.

Return value

1 if the surface diffuse texture was successfully set; otherwise, 0.

void setSurfaceDiffuseTextureName (int x, int y, string name)

Sets a new diffuse texture name for the specified refined surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • string name - Name (path) of the surface diffuse texture.

void setSurfaceEnabled (int x, int y, int enable)

Sets a value indicating whether a specified refined surface is enabled or disabled for rendering.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • int enable - Enabled flag. 1 to enable the surface; 0 to disable it.

int setSurfaceIndexTextureImage (int x, int y, Image image)

Sets the new index image for the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • Image image - Texture to be set.

Return value

1 if the texture has been set successfully; otherwise - 0.

void setSurfaceIndexTextureName (int x, int y, string name)

Sets the new name for the index texture of the given terrain refined surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • string name - Name of the texture.

void setSurfaceLodThreshold (int x, int y, float threshold, int force = 0)

Sets the height threshold value for the LOD of the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • float threshold - Threshold of the surface LOD.
  • int force - The force flag. The terrain will load all height maps into the memory and will perform a height map relaxation for the smooth LOD transition for the given threshold level.

int setSurfaceMaskTextureImage (int x, int y, Image image)

Imports a mask texture to the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • Image image - Surface mask texture image.

Return value

1 if the surface mask texture was successfully set; otherwise, 0.

void setSurfaceMaskTextureName (int x, int y, string name)

Sets a mask texture name for the specified surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • string name - Name (path) of the surface mask texture.

int setSurfaceNormalTextureImage (int x, int y, Image image)

Imports a normal map for the specified refined surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • Image image - Surface normal map image.

Return value

1 if the surface normal map was successfully set; otherwise, 0.

void setSurfaceNormalTextureName (int x, int y, string name)

Sets a new normal map name for the specified refined surface.

Arguments

  • int x - Number of the surface along the X axis.
  • int y - Number of the surface along the Y axis.
  • string name - Name (path) of the surface normal map.

void setTerrainName (string name)

Sets the name for the terrain.

Arguments

  • string name - Terrain name (path to the .TER file).

void setVisibleDistance (float distance)

Sets the distance up to which terrain is rendered visible. The terrain would disappear on per-surface basis.

Arguments

  • float distance - Visibility distance, in units.
Last update: 2017-07-03