This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

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

Members


ObjectTerrain ()

Constructor. Creates a new terrain object with default properties.

ObjectTerrain (string name)

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

Arguments

  • string name - Name of the terrain file.

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.

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.

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 create (Image image, float step, variable a0, variable a1, variable a2)

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.
  • variable a0 - A variable of one of the following types:
    • intsize_x - the width of the terrain along the X axis in range [257;32679], in grid cells.
    • Imageimage - a height map.
  • variable a1 - A variable of one of the following types:
    • intsize_y - the length of the terrain along the Y axis in range [257;32679], in grid cells.
    • floatstep - the step of terrain grid cell, in units.
  • variable a2 - A variable of one of the following types:
    • floatstep - the step of the terrain grid cell, in units.
    • floatscale - the maximum height, in units.

Return value

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

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].

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.

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.

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].

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.

void setLodTerrainTop (ObjectTerrain top)

Sets the new top LOD for the current terrain.

Arguments

  • ObjectTerrain top - Top LOD.

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.

ObjectTerrain getLodTerrainLeft ()

Returns the left LOD of the current terrain.

Return value

Left terrain LOD.

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 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.

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.

float getLodProgression ()

Returns LOD progression value. Default value is 2.0.

Return value

LOD Progression value.

string getSpecularTextureArrayName ()

Returns the name of the specular textures array.

Return value

Name of the array.

float getLodThreshold ()

Returns the LOD height threshold.

Return value

LOD height threshold.

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).

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 setLodDistance (float distance)

Sets a distance to the first level of details.

Arguments

  • float distance - Distance, in units.

void setTerrainName (string name)

Sets the name for the terrain.

Arguments

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

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.

ObjectTerrain getLodTerrainRight ()

Returns the right LOD of the current terrain.

Return value

Right terrain LOD.

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.

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.

void removeMaterial (int num)

Removes the specified layer.

Arguments

  • int num - Layer number.

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.

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 setIndexTextureName (string name)

Sets the new index texture name.

Arguments

  • string name - Texture name.

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.

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 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.

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.

ObjectTerrain getLodTerrainBottom ()

Returns the bottom LOD of the current terrain.

Return value

Bottom terrain LOD.

float getShadowDistance ()

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

Return value

Distance, in units.

ObjectTerrain getLodTerrainTop ()

Returns the top LOD of the current terrain.

Return value

Top terrain LOD.

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.

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.

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.

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.

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 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 setMaterialMaskValue (int num, float value)

Sets the new blending value for a layer.

Arguments

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

float getMaterialMaskValue (int num)

Returns the layer blending value.

Arguments

  • int num - Layer number.

Return value

Blending value.

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.

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.

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

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 enabled - Enabled flag. 1 to enable the surface; 0 to disable it.

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 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.

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.

void setMaterialMaskWidth (int num, float width)

Sets the new width for a layer.

Arguments

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

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.

float getMaterialMaskWidth (int num)

Returns the mask blending width.

Arguments

  • int num - Layer number.

Return value

Layer mask blending width.

float getMaterialMaskThreshold (int num)

Returns the mask blending threshold.

Arguments

  • int num - Layer number.

Return value

Layer mask blending threshold.

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.

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.

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 create (Image image, float step, variable a0, variable a1, variable a2)

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.
  • variable a0 - A variable of one of the following types:
    • intsize_x - the width of the terrain along the X axis in range [257;32679], in grid cells.
    • Imageimage - a height map.
  • variable a1 - A variable of one of the following types:
    • intsize_y - the length of the terrain along the Y axis in range [257;32679], in grid cells.
    • floatstep - the step of terrain grid cell, in units.
  • variable a2 - A variable of one of the following types:
    • floatstep - the step of the terrain grid cell, in units.
    • floatscale - the maximum height, in units.

Return value

Returns

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).

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.

string getNormalTextureArrayName ()

Returns the name of the normal textures array.

Return value

Name of the normal textures array.

int getIntersection (vec3 p0, vec3 p1, vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, 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.
  • vec3 * ret_point - Variable defining the return array content. It can be one of the following:
    • ObjectIntersectionpoint - The intersection point.
    • ObjectIntersectionNormalnormal - The intersection point normal.
    • ObjectIntersectionTexCoordtexcoord - The intersection point texture coordinates along the X and the Y axes (the Z and the W values are always equal to zero).
  • vec3 * ret_normal - The number of the terrain surface.
  • vec4 * ret_texcoord - 0 is to return the intersection with a terrain even if it hits the hole; otherwise, 1.
  • int surface - Number of the 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.

string getDiffuseTextureName ()

Returns the path to the current terrain diffuse texture.

Return value

Path to the diffuse texture.

void setDiffuseTextureArrayName (string name)

Sets the new name for the diffuse textures array.

Arguments

  • string name - Name of the diffuse textures array.

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.

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.

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.

void setLodTerrainLeft (ObjectTerrain left)

Sets the new left LOD for the current terrain.

Arguments

  • ObjectTerrain left - Left LOD.

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.

void setHeight (int x, int y, float height)

Changes the height of 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.
  • float height - Height, in units.

int getMaterialParent (int num)

Returns the number of the parent layer.

Arguments

  • int num - Layer number.

Return value

Number of the parent layer.

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.

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 loadHeights (vec3 center, float radius, vec3 max, vec3 min, int force)

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.

string getMaterialNormalTextureName (int num)

Returns the normal map name of the specified layer.

Arguments

  • int num - Layer number.

Return value

Normal map name (path).

void setMaterialMaskBase (int num, int base)

Sets the mask base parameter.

Arguments

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

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 getSizeY ()

Returns terrain length, in grid cells.

Return value

Terrain length along Y axis.

int getPoint (float x, float y, float & height, vec3 & normal)

Returns the point on the terrain grid.

Arguments

  • float x - Point coordinates.
  • float y - Y coordinate of the point on the terrain grid.
  • float & height - Height of the point.
  • vec3 & normal - Normal vector.

Return value

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

int getSurfacesX ()

Returns the number of the surface along the X axis.

Return value

Number of the surface along the X axis.

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).

float getStep ()

Returns the linear size of a cell, in units.

Return value

Cell size.

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 getMaskTextureName ()

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

Return value

Name (path) of the terrain mask texture.

void setHole (int x, int y, int hole)

Adds or removes holes to 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.
  • int hole - 1 to add a hole, 0 to remove a hole.

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.

int getSurfacesY ()

Returns the number of the surface along the Y axis.

Return value

Number of the surface along the Y axis.

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 setLodTerrainBottom (ObjectTerrain bottom)

Sets the new bottom LOD for the current terrain.

Arguments

  • ObjectTerrain bottom - Bottom LOD.

void setSpecularTextureArrayName (string name)

Sets the new name of the specular textures array.

Arguments

  • string name - Name of the array.

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.

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.

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.

int getNumMaterials ()

Returns the total number of terrain layers.

Return value

The total number of layers.

void setMaterialMaskThreshold (int num, float threshold)

Sets the new blending threshold for a layer.

Arguments

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

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.

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).

string getTerrainName ()

Returns a name of the terrain.

Return value

Terrain name (path to the .TER file).

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.

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).

string getDiffuseTextureArrayName ()

Returns the name of the diffuse textures array.

Return value

Name of the array.

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.

void setNumMaterials (int materials)

Adds the specified number of layers to the terrain.

Arguments

  • int materials - Number of the layers.

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.

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.

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.

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 getSizeX ()

Returns terrain width, in grid cells.

Return value

Terrain width along X axis.

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 setMaterialName (int num, string name)

Sets a new name for the layer.

Arguments

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

string getIndexTextureName ()

Returns the current name of the index texture.

Return value

Name of the index texture.

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.

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.

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 isLoaded ()

Returns a value indicating whether terrain is loaded.

Return value

1 if the terrain is loaded; otherwise, 0.

void setLodTerrainRight (ObjectTerrain right)

Sets the new right LOD for the current terrain.

Arguments

  • ObjectTerrain right - Right LOD.

void setNormalTextureArrayName (string name)

Sets the new name of the normal textures array.

Arguments

  • string name - Normal textures array 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.

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 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.
Last update: 2017-07-03
Build: ()