This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related 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.

Unigine.ObjectTerrain Class

Inherits: Object

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:

See Also#

A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/objects/ folder:

  • terrain_00
  • terrain_01
  • terrain_02

ObjectTerrain Class

Properties

Texture HeightTextureArray#

The terrain base height texture array.

string HeightTextureArrayName#

The name of the terrain base height texture array.
set
Sets the name of the terrain base height texture array.
set value - Height texture array name.

Texture NormalTextureArray#

The normal textures array.

string NormalTextureArrayName#

The name of the normal textures array.
set
Sets the new name of the normal textures array.
set value - Normal textures array name.

Texture AlbedoTextureArray#

The terrain base albedo texture array.

string AlbedoTextureArrayName#

The name of the terrain base albedo texture array.
set
Sets the name of the terrain base albedo texture array.
set value - Albedo texture array name.

Texture MaskTexture#

The terrain mask texture.

string MaskTextureName#

The name of the current terrain mask texture.
set
Sets the name of the terrain mask texture.
set value - Mask texture name.

Texture NormalTexture#

string NormalTextureName#

The name of the current terrain normal texture.
set
Sets the name of the terrain normal texture.
set value - Normal texture name.

Texture AlbedoTexture#

The terrain base albedo texture.

string AlbedoTextureName#

The name of the terrain base albedo texture.
set
Sets the name of the terrain base albedo texture.
set value - Albedo texture name.

int NumAllMaterials#

The total number of terrain materials.

int NumLayers#

The total number of terrain layers.

float ShadowDistance#

The Shadow distance parameter value (the distance up to which a terrain casts shadows).
set
Sets the Shadow distance parameter value (the distance up to which a terrain casts shadows).
set value - Shadow distance, in units.

float VisibleDistance#

The distance up to which terrain is rendered visible. the terrain would disappear on a per-surface basis.
set
Sets the distance up to which terrain is rendered visible. The terrain would disappear on a per-surface basis.
set value - Visibility distance, in units.

ObjectTerrain LodTerrainTop#

The top lod of the current terrain.
set
Sets the new top LOD for the current terrain.
set value - Top terrain LOD.

ObjectTerrain LodTerrainBottom#

The bottom lod of the current terrain.
set
Sets the new bottom LOD for the current terrain.
set value - Bottom terrain LOD.

ObjectTerrain LodTerrainRight#

The right lod of the current terrain.
set
Sets the new right LOD for the current terrain.
set value - Right terrain LOD.

ObjectTerrain LodTerrainLeft#

The left lod of the current terrain.
set
Sets the new left LOD for the current terrain.
set value - Left terrain LOD.

float LodProgression#

Lod progression value. default value is 2.0.
set
Sets LOD Progression value. This distance is used to calculate distances to the rest of levels of details.
set value - LOD Progression value.

float LodDistance#

The distance to the first level of detail. this distance is used to calculate distances to the rest of levels of details.
set
Sets the distance to the first level of detail. The default value is 2.0.
set value - Distance to the first LOD, in units.

int SurfacesY#

The number of the surfaces along the Y axis.

int SurfacesX#

The number of the surfaces along the X axis.

float Step#

The linear size of a grid cell, in units.

int SizeY#

The terrain length along the y axis, in grid cells.

int SizeX#

The terrain width along the x axis, in grid cells.

bool IsLoaded#

A value indicating whether the terrain is loaded or not.

string TerrainName#

The current terrain name.
set
Sets the name for the terrain.
set value - Terrain name (path to the .TER file).

Members


static ObjectTerrain ( ) #

Constructor. Creates a new terrain object with default properties.

static ObjectTerrain ( string name ) #

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

Arguments

  • string name - Name of the terrain file.

static ObjectTerrain Cast ( Node node ) #

Casts an ObjectTerrain out of the Node instance.

Arguments

  • Node node - Node instance.

Return value

ObjectTerrain instance.

static ObjectTerrain Cast ( Object base ) #

Casts an ObjectTerrain out of the Object instance.

Arguments

  • Object base - Object instance.

Return value

ObjectTerrain instance.

int SetAlbedoTextureImage ( Image image ) #

Sets the image of the terrain base albedo texture.

Arguments

  • Image image - Albedo texture image to be set.

Return value

1 if albedo texture image was successfully set; otherwise, 0.

int GetAlbedoTextureImage ( Image image ) #

Writes the current terrain base albedo texture into the given buffer.

Arguments

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

Return value

1 if the texture was successfully written to a buffer; otherwise, 0.

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

float GetHeight ( float x, float y ) #

Returns the height of a given terrain point.

Arguments

  • float x - Interpolated height value between two points.
  • float y - Interpolated height value between two points.

Return value

Height value.

float GetHeight ( int x, int y ) #

Returns the height of a given terrain point.

Arguments

  • int x - X coordinate of the point (exact grid point).
  • int y - Y coordinate of the point (exact grid point).

Return value

Height value.

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

Imports a new 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. The following formats are supported: R8, RG8, RGB8, R16, R16F, R32F.
  • float scale - Height map scale.

Return value

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

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

Exports a height map into the R16 image. The sum of the X coordinate of the point on the terrain grid and the 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 the 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. The following formats are supported: R8, RG8, RGB8, R16, R16F, R32F.
  • float scale - Height map scale.

Return value

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

void SetHole ( int x, int y, int hole ) #

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

int GetHole ( float x, float y, float x, float y ) #

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

Arguments

  • float x - X-coordinate of the point. Can be either int or float.
  • float y - Y-coordinate of the point. Must be of the same type as x.
  • float x - X coordinate of the point on the terrain grid in range from 0 to the maximum terrain width.
  • float y - Y coordinate of the point on the terrain grid in range from 0 to the maximum terrain length.

Return value

1 if there is a hole at a given point; otherwise, 0.

int GetHole ( int x, int y ) #

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

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.

Return value

1 if there is a hole at a given point; otherwise, 0.

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 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 - Holes texture. Only R8 format is acceptable.

Return value

1 if the holes texture is imported successfully; otherwise, 0.

int GetHoles ( int x, int y, int width, int height, Image image ) #

Exports a holes texture into the R8 image. The sum of the X coordinate of the point on the terrain grid and the 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 the 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 holes texture into.

Return value

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

void SetLayerEnabled ( int layer, int enable ) #

Enables or disables a given layer.

Arguments

  • int layer - Target layer ID.
  • int enable - 1 to enable a layer; 0 to disable it.

int GetLayerEnabled ( int layer ) #

Returns a value indicating if a given layer is enabled.

Arguments

  • int layer - Target layer ID.

Return value

1 if a given layer is enabled; otherwise, 0.

void SetLayerName ( int layer, string name ) #

Sets the name for a given layer.

Arguments

  • int layer - Target layer ID.
  • string name - Layer name.

string GetLayerName ( int layer ) #

Sets the name for a given layer.

Arguments

  • int layer - Target layer ID.

Return value

Layer name.

vec3 GetLocalPoint ( Vec3 position ) #

Returns the local coordinates of a given point.

Arguments

  • Vec3 position - World coordinates of the point.

Return value

Local coordinates of the point.

void SetLodThreshold ( float threshold, int force = 0 ) #

Sets the LOD height threshold.

Arguments

  • float threshold - LOD height threshold.
  • int force - Force flag. 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.

float GetLodThreshold ( ) #

Returns the LOD height threshold.

Return value

LOD height threshold.

int SetMaskTextureImage ( Image image ) #

Sets a new terrain mask texture from a given image.

Arguments

  • Image image - Mask texture image to be set.

Return value

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

int GetMaskTextureImage ( Image image ) #

Writes the current terrain mask texture into the given buffer.

Arguments

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

Return value

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

void SetMaterialAlbedoColor ( int layer, int material, vec4 color ) #

Sets the albedo color multiplier for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • vec4 color - Material albedo color multiplier.

vec4 GetMaterialAlbedoColor ( int layer, int material ) #

Returns the albedo color multiplier for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material albedo color multiplier.

void SetMaterialAlbedoScale ( int layer, int material, float scale ) #

Sets the albedo scale for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • float scale - Material albedo scale.

float GetMaterialAlbedoScale ( int layer, int material ) #

Returns the albedo scale for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material albedo scale.

void SetMaterialAlbedoTextureName ( int layer, int material, string name ) #

Sets the name of the albedo texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • string name - Material albedo texture name.

string GetMaterialAlbedoTextureName ( int layer, int material ) #

Returns the name of the albedo texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material albedo texture name.

void SetMaterialDetail ( int layer, int material, int detail ) #

Sets a value indicating if a given material of a given layer uses its parent's material mask (or generates own mask on its basis) or the layer's mask (or generates own mask on its basis).

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • int detail - 1 to use the parent material mask (or generate own mask on its basis); 0 to use the layer's mask (or generate own mask on its basis).

int GetMaterialDetail ( int layer, int material ) #

Returns a value indicating if a given material of a given layer uses its parent's material mask (or generates own mask on its basis) or the layer's mask (or generates own mask on its basis).

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

1 if the parent's material mask is used; otherwise, 0.

void SetMaterialEnabled ( int layer, int material, int enable ) #

Enables or disables a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • int enable - 1 to enable a given material of a given layer; 0 to disable it.

int GetMaterialEnabled ( int layer, int material ) #

Returns a value indicating if a given material of a given layer is enabled.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

1 if a given material of a given layer is enabled; otherwise, 0

void SetMaterialHeightTextureName ( int layer, int material, string name ) #

Sets the name of the height texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • string name - Material height texture name.

string GetMaterialHeightTextureName ( int layer, int material ) #

Returns the name of the height texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material height texture name.

void SetMaterialLayer ( int layer, int material, int layer_target ) #

Sets a new layer for a given material of a given layer.

Arguments

  • int layer - Current layer ID.
  • int material - Target material ID.
  • int layer_target - New layer ID.

void SetMaterialMaskThreshold ( int layer, int material, float threshold ) #

Sets the blending threshold for a given material of a given layer. This parameter controls smoothness of blending. Higher values provide smoother results. Blending is performed according to the layer's mask.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • float threshold - Blending threshold value within the [0.0f; 1.0f] range.

float GetMaterialMaskThreshold ( int layer, int material ) #

Returns the blending threshold for a given material of a given layer. This parameter controls smoothness of blending. Higher values provide smoother results. Blending is performed according to the layer's mask.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Blending threshold value within the [0.0f; 1.0f] range.

void SetMaterialMaskValue ( int layer, int material, float value ) #

Sets the blending value for a given material of a given layer. This parameter controls the spread intensity of the layer. Lower values provide bigger spread. Blending is performed according to the layer's mask.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • float value - Blending value within the [0.0f; 1.0f] range.

float GetMaterialMaskValue ( int layer, int material ) #

Returns the blending value for a given material of a given layer. This parameter controls the spread intensity of the layer. Lower values provide bigger spread. Blending is performed according to the layer's mask.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Blending value within the [0.0f; 1.0f] range.

void SetMaterialMaskWidth ( int layer, int material, float width ) #

Sets the blending width for a given material of a given layer. This parameter controls the width of blending with a layer. Higher values provide wider areas. Blending is performed according to the layer's mask.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • float width - Blending width value within the [0.0f; 1.0f] range.

float GetMaterialMaskWidth ( int layer, int material ) #

Returns the blending width for a given material of a given layer. This parameter controls the width of blending with a layer. Higher values provide wider areas. Blending is performed according to the layer's mask.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Blending width value within the [0.0f; 1.0f] range.

void SetMaterialName ( int layer, int material, string name ) #

Sets the name of a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • string name - Material name.

string GetMaterialName ( int layer, int material ) #

Returns the name of a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material name.

void SetMaterialNormalScale ( int layer, int material, float scale ) #

Sets the intensity scale of the normal texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • float scale - Material normal texture scale value within the [0.0f; 1.0f] range.

float GetMaterialNormalScale ( int layer, int material ) #

Returns the intensity scale of the normal texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material normal scale value within the [0.0f; 1.0f] range.

void SetMaterialNormalTextureName ( int layer, int material, string name ) #

Sets the name of the normal texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • string name - Material normal texture name.

string GetMaterialNormalTextureName ( int layer, int material ) #

Returns the name of the normal texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material normal texture name.

void SetMaterialOverlap ( int layer, int material, int overlap ) #

Enables or disables overlap blending mode for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • int overlap - 1 to enable overlap blending mode; 0 to disable it and use overlay mode.

int GetMaterialOverlap ( int layer, int material ) #

Returns a value indicating if overlap blending mode is enabled for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

1 if overlap blending mode for a given material is enabled; otherwise, 0.

void SetMaterialRoughness ( int layer, int material, float roughness ) #

Sets the roughness value multiplier for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • float roughness - Material roughness value multiplier within the [0.0f; 1.0f] range.

float GetMaterialRoughness ( int layer, int material ) #

Returns the roughness value multiplier for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material roughness value multiplier within the [0.0f; 1.0f] range.

void SetMaterialRoughnessScale ( int layer, int material, float scale ) #

Sets the intensity scale of the roughness texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • float scale - Material roughness scale value within the [0.0f; 1.0f] range.

float GetMaterialRoughnessScale ( int layer, int material ) #

Returns the intensity scale of the roughness texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material roughness scale value within the [0.0f; 1.0f] range.

void SetMaterialRoughnessTextureName ( int layer, int material, string name ) #

Sets the name of the roughness texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • string name - Material roughness texture name.

string GetMaterialRoughnessTextureName ( int layer, int material ) #

Returns the name of the roughness texture for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Material roughness texture name.

void SetMaterialTransform ( int layer, int material, vec4 transform ) #

Sets the transformation parameters for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.
  • vec4 transform - Vec4 transformation vector with the following components:
    • X - Tiling X - tile of the textures along the X axis.
    • Y - Tiling Y - tile of the textures along the Y axis.
    • Z - Offset X - texture offset along the X axis.
    • W - Offset Y - texture offset along the Y axis.

vec4 GetMaterialTransform ( int layer, int material ) #

Returns the transformation parameters for a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

Vec4 transformation vector with the following components:
  • X - Tiling X - tile of the textures along the X axis.
  • Y - Tiling Y - tile of the textures along the Y axis.
  • Z - Offset X - texture offset along the X axis.
  • W - Offset Y - texture offset along the Y axis.

vec3 GetNormal ( float x, float y ) #

Returns the normal vector for a given terrain point.

Arguments

  • float x - X coordinate of the point on the terrain grid in range from 0 to the maximum terrain width.
  • float y - Y coordinate of the point on the terrain grid in range from 0 to the maximum terrain length.

Return value

Normal vector.

vec3 GetNormal ( int x, int y ) #

Returns the normal vector for a given terrain point.

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.

Return value

Normal vector.

int GetNormals ( int x, int y, int width, int height, Image image ) #

Exports a normal map into the RG8 image. The sum of the X coordinate of the point on the terrain grid and the 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 the 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 normal map into.

Return value

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

int SetNormalTextureImage ( Image image ) #

Sets a new terrain normal texture from a given image.

Arguments

  • Image image - Texture image.

Return value

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

int GetNormalTextureImage ( Image image ) #

Writes the current terrain normal texture 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 GetNumMaterials ( int layer ) #

Returns the number of materials for a given layer.

Arguments

  • int layer - Target layer ID.

Return value

Number of layer's materials.

Texture GetSurfaceAlbedoTexture ( int x, int y ) #

Returns the albedo 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

Surface albedo texture.

int SetSurfaceAlbedoTextureImage ( int x, int y, Image image ) #

Sets the albedo texture 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 - Albedo texture image.

int GetSurfaceAlbedoTextureImage ( int x, int y, Image image ) #

Writes the current surface albedo texture 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 write a texture into.

Return value

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

void SetSurfaceAlbedoTextureName ( int x, int y, string name ) #

Sets the albedo 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 - Albedo texture name.

string GetSurfaceAlbedoTextureName ( int x, int y ) #

Returns the albedo 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.

Return value

Albedo texture name.

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

Surface bounding box.

BoundSphere GetSurfaceBoundSphere ( int x, int y ) #

Returns the bounding sphere 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

Surface bounding sphere.

void SetSurfaceCastShadow ( int x, int y, int cast_shadow ) #

Sets a value indicating whether terrain geometry across the specified 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 to cast shadows; 0 not to cast.

int IsSurfaceCastShadow ( int x, int y ) #

Returns a value indicating whether terrain geometry across the specified 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 surface casts shadows; otherwise, 0.

void SetSurfaceEnabled ( int x, int y, bool enabled ) #

Sets a value indicating whether the specified 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.
  • bool enabled - Enabled flag. 1 to enable the surface; 0 to disable it.

int IsSurfaceEnabled ( int x, int y ) #

Returns a value indicating whether the specified 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 GetSurfaceIntersection ( 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:
    • ObjectIntersection point — The intersection point.
    • ObjectIntersectionNormal normal — The intersection point normal.
    • ObjectIntersectionTexCoord texcoord — The intersection point texture coordinates along theX 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

1 if the intersection is found; otherwise - 0.

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

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.

Texture GetSurfaceMaskTexture ( int x, int y ) #

Returns the mask texture 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

Mask texture.

int SetSurfaceMaskTextureImage ( int x, int y, Image image ) #

Sets a mask texture 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 - Surface mask texture image.

Return value

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

int GetSurfaceMaskTextureImage ( int x, int y, Image image ) #

Writes the current mask texture 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 write a mask texture into.

Return value

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

void SetSurfaceMaskTextureName ( int x, int y, string name ) #

Sets the 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 - Surface mask texture name.

string GetSurfaceMaskTextureName ( int x, int y ) #

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

Return value

Surface mask texture name.

Texture GetSurfaceNormalTexture ( int x, int y ) #

Returns the normal texture 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

Normal texture.

int SetSurfaceNormalTextureImage ( int x, int y, Image image ) #

Sets a normal texture 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 - Surface normal texture image to be set.

Return value

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

int GetSurfaceNormalTextureImage ( int x, int y, Image image ) #

Writes the current normal texture 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 write a texture into.

Return value

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

void SetSurfaceNormalTextureName ( int x, int y, string name ) #

Sets the normal 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 - Surface normal texture name.

string GetSurfaceNormalTextureName ( int x, int y ) #

Returns the normal 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.

Return value

Surface normal texture name.

int GetTopologyData ( float x, float y, out vec3 point, out vec3 normal, out vec3 up, int force = 0 ) #

Returns topology data for a given terrain point.

Arguments

  • float x - X coordinate of the point on the terrain grid in range from 0 to the maximum terrain width.
  • float y - Y coordinate of the point on the terrain grid in range from 0 to the maximum terrain length.
  • out vec3 point - World coordinates of the point.
  • out vec3 normal - Normal coordinates.
  • out vec3 up - "Up" vector coordinates.
  • int force - Force flag. Use 1 to load the terrain height file in any case or generate default height values (-1); otherwise, 0.

Return value

1 if the topology data is retrieved successfully; otherwise, 0.

float GetWorldHeight ( Vec3 position ) #

Returns the height of a given terrain point in world coordinates.

Arguments

  • Vec3 position - World coordinates of the point.

Return value

Height (Z-coordinate) in world coordinates.

int AddLayer ( string name ) #

Adds a new terrain layer. New layer is enabled by default.

Arguments

  • string name - New layer name.

Return value

New total number of terrain layers.

int AddMaterial ( int layer, string name ) #

Adds a new terrain material to a given layer.

Arguments

  • int layer - Target layer ID.
  • string name - New material name.

Return value

Number of layer's materials.

void AllocateLayers ( int num ) #

Allocates memory for the specified number of layers. All layers are empty by default.

Arguments

  • int num - Number of layers.

void AllocateMaterials ( int layer, int num ) #

Allocates memory for the specified number of materials of a given layer. All materials are initialized with default parameters.

Arguments

  • int layer - Target layer ID.
  • int num - Number of materials.

int CloneLayer ( int layer ) #

Clones a given layer.

Arguments

  • int layer - Target layer ID.

Return value

New number of terrain layers.

int CloneMaterial ( int layer, int material ) #

Clones a given material of a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

Return value

New number of materials of a given layer.

int Create ( int size_x, int size_y, float step ) #

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

Arguments

  • int size_x - Terrain width in grid cells along the X axis in range [257;32679], in units.
  • int size_y - Terrain length in grid cells along the Y axis in range [257;32679], in units.
  • float step - Step of terrain grid cell in units.

Return value

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

int Create ( Image image, float step, float scale = 1.0f ) #

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

Arguments

  • Image image - Pointer to a height map.
  • float step - A step of the terrain grid cell, in units.
  • float scale - The maximum height value, in units.

Return value

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

int LoadHeights ( BoundSphere bs, BoundBox bb, int force = 0 ) #

Sets a diffuse texture name for the specified layer.

Arguments

  • BoundSphere bs - Bounding sphere (terrain-relative coordinate system).
  • BoundBox bb - Bounding box (terrain-relative coordinate system).
  • int force - Force data loading with possible stall.

int LoadTerrain ( string name ) #

Loads a terrain from a file.

Arguments

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

Return value

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

void RemoveLayer ( int layer ) #

Removes a given layer.

Arguments

  • int layer - Target layer ID.

void RemoveMaterial ( int layer, int material ) #

Removes a given material from a given layer.

Arguments

  • int layer - Target layer ID.
  • int material - Target material ID.

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

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

void SwapLayer ( int layer_0, int layer_1 ) #

Swaps given terrain layers.

Arguments

  • int layer_0 - First layer ID.
  • int layer_1 - Second layer ID.

void SwapMaterial ( int layer_0, int material_0, int layer_1, int material_1 ) #

Swaps given terrain materials.

Arguments

  • int layer_0 - Layer ID for the first material.
  • int material_0 - First material ID.
  • int layer_1 - Layer ID for the second material.
  • int material_1 - Second material ID.

static int type ( ) #

Returns the type of the object.

Return value

Object Terrain type identifier

int SaveStateMaterials ( Stream stream ) #

Saves the state of terrain's materials to the specified stream.

Arguments

  • Stream stream - Stream instance.

int RestoreStateMaterials ( Stream stream ) #

Restores the state of terrain's materials from the specified stream.

Arguments

  • Stream stream - Stream instance.
Last update: 2019-08-16
Build: ()