This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine 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
IG Plugin
CIGIConnector 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.

LandscapeLayerMap Class

Warning
UnigineScript is deprecated and will be removed in future releases. Please consider using C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt is not guaranteed, as the current level of support assumes only fixing critical issues.
Inherits: Node

This class is used to manage landscape layer maps of the Landscape Terrain object. Landscape layer map data (height, albedo, masks, settings) is stored in a .lmap file (see the LandscapeMapFileCreator and LandscapeMapFileSettings classes). A landscape map has a single resolution and density, and cannot have insets. Insets are created by adding a high-resolution landscape layer map above the low-resolution one.

Several maps can be blended with each other. Blending parameters for the landscape layer map are controlled via the corresponding methods of the LandscapeMapFilesettings class.

Maximum and Minimum Terrain Height#

This example demonstrates how to obtain minimum and maximum height values for the whole Landscape Terrain (all layer maps) along with the enclosing bounding box. For this puprose we should find all LandscapeLayerMap objects in the World, extend a bounding box to enclose all of them, and use the getExtremumHeight() method to get minimum and maximum height values.

Source code (C++)
WorldBoundBox b;
float min = 99999, max = -9999;
Vector<NodePtr> v;
World::getNodes(v);
for (auto & it : v)
{
	if (it->getType() == Node::LANDSCAPE_LAYER_MAP)
	{
		b.expand(it->getWorldBoundBox());
		auto ext = checked_ptr_cast<LandscapeLayerMap>(it)->getExtremumHeight();
		if (ext.x < min)
			min = ext.x;
		if (ext.y > max)
			max = ext.y;
	}
}
vec3 minp = vec3(b.getMin());
vec3 maxp = vec3(b.getMax());
minp.z = min;
maxp.z = max;
BoundBox bb = BoundBox(minp, maxp);
Visualizer::renderBoundBox(bb, Mat4_identity, vec4_red);

LandscapeLayerMap Class

Members


LandscapeLayerMap ( ) #

The LandscapeLayerMap constructor.

void setPath ( string path ) #

Sets a new path to the *.lmap file containing landscape map data.

Arguments

  • string path - New path to the *.lmap file with landscape map data.

string getPath ( ) #

Returns the current path to the *.lmap file containing landscape map data.

Return value

Path to the *.lmap file containing landscape map data.

UGUID getGUID ( ) #

Returns the GUID of the LandscapeLayerMap node.

Return value

GUID of the LandscapeLayerMap node.

void setIntersection ( int intersection ) #

Sets a value indicating if intersection detection is enabled for the landscape layer map.

Arguments

  • int intersection - 1 to enable intersection detection for the landscape layer map, 0 - to disable it.

int isIntersection ( ) #

Returns a value indicating if intersection detection is enabled for the landscape layer map.

Return value

1 if intersection detection for the landscape layer map is enabled; otherwise, 0.

void setCollision ( int collision ) #

Sets a value indicating if collision detection is enabled for the landscape layer map.

Arguments

  • int collision - 1 to enable collision detection for the landscape layer map, 0 - to disable it.

int isCollision ( ) #

Returns a value indicating if collision detection is enabled for the landscape layer map.

Return value

1 if collision detection for the landscape layer map is enabled; otherwise, 0.

void setCulling ( int culling ) #

Sets a value indicating if heights data of the layer map is to be used for culling precalculation. In order to define which parts of the terrain are to be rendered a culling test is required. This test is performed on the basis of a precalculated low-detail height map, combining heights data of all landscape layer maps having a significant impact on the result. Precalculation is performed on the CPU side, so processing a large number of landscape layer maps may reduce performance. Moreover, some layer maps may be used as decals (i.e. their impact on the resulting height map is insignificant). For such cases you can simply disable this option to avoid unnecessary calculations.
Notice
Disabling this option for a single

Arguments

  • int culling - 1 to use the layer map for culling, 0 - to ignore it.

int isCulling ( ) #

Returns a value indicating if heights data of the layer map is to be used for culling precalculation. In order to define which parts of the terrain are to be rendered a culling test is required. This test is performed on the basis of a precalculated low-detail height map, combining heights data of all landscape layer maps having a significant impact on the result. Precalculation is performed on the CPU side, so processing a large number of landscape layer maps may reduce performance. Moreover, some layer maps may be used as decals (i.e. their impact on the resulting height map is insignificant). For such cases you can simply disable this option to avoid unnecessary calculations.

Return value

1 if heights data of the layer map is to be used for culling precalculation; otherwise, 0.

void setOrder ( int order ) #

Returns a new rendering order for the landscape layer map. A map with a higher order value shall be rendered above the ones with lower ones.

Arguments

  • int order - New rendering order to be set for the landscape layer map.

int getOrder ( ) #

Sets the current rendering order for the landscape layer map. A map with a higher order value shall be rendered above the ones with lower ones.

Return value

Current rendering order of the landscape layer map.

void setSize ( Vec2 size ) #

Sets a new size for the landscape layer map.

Arguments

  • Vec2 size - Two-component vector (X, Y) defining the size of the landscape layer map along X and Y axes, in units.

Vec2 getSize ( ) #

Returns the current size of the landscape layer map.

Return value

Two-component vector (X, Y) defining the size of the landscape layer map along X and Y axes, in units.

void setHeightScale ( float scale ) #

Sets a new scale factor to be used for heights data. Height values of landscape layer map are multiplied by this value during terrain rendering.

Arguments

  • float scale - Scale factor used for heights data.

float getHeightScale ( ) #

Returns the current scale factor used for heights data. Height values of landscape layer map are multiplied by this value during terrain rendering.

Return value

Scale factor used for heights data.

Vec2 getTexelSize ( ) #

Returns the current texel size for the landscape layer map textures.

Return value

Two-component vector (X, Y) defining the size of the texel of the landscape layer map textures along X and Y axes.

int isInit ( ) #

Returns a value indicating if the landscape layer map is initialized.

Return value

1 if async operation is completed; otherwise, 0.

Vec2 getExtremumHeight ( float precision = 1.0f ) #

Returns the minimum and maximum height of the landscape layer map as a two-component vector.

Arguments

  • float precision - Precision value in the [0.0f, 1.0f] range. The default value is 1.0f (maximum).

Return value

Two-component vector (X, Y) defining the minimum (X) and maximum (Y) height of the landscape layer map.
Last update: 2020-04-10
Build: ()