This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine.ObjectLandscapeTerrain Class

Inherits from: Object

This class is used to create and manage Landscape Terrain object and its detail masks.

ObjectLandscapeTerrain Class

Properties

float IntersectionPrecision#

The Precision for intersection detection as a fraction of maximum precision in the [0; 1] range. The default value is 0.5f. Maximum precision is determined by the Engine on the basis of the data of your Landscape Terrain.

int NumDetailMasks#

The total number of detail masks of the landscape terrain.

bool ActiveTerrain#

The value indicating if the landscape terrain is active.

long LastStreamingFrame#

The number of the frame when the last commit to the Virtual Texture was performed. This method enables you to check if the Landscape Terrain data is loaded completely at the moment (the Virtual Texture is created and the last commit to it is already applied).
Source code (C#)
ObjectLandscapeTerrain terrain;
	
	void Init()
	{
		terrain = World.GetNodeByName("ObjectLandscapeTerrain") as ObjectLandscapeTerrain;
	}
	
	void Update()
	{
		if (!terrain)
			return;
		long last_commit_frame = terrain.LastStreamingFrame;
		if (last_commit_frame == -1)
		{
			Log.Message("The Virtual Texture is not created yet\n");
			return;
			// not ready
		}
		if ((Game.Frame - last_commit_frame) > 45)
		{
			Log.Message("Virtual Texture update is completed (all commits are applied)\n");
			// ...
		}
		else
		{
			Log.Message("Virtual Texture update is pending (commit_frame = %d)\n", last_commit_frame);
			// ...
		}
		
	}

Members


ObjectLandscapeTerrain ( ) #

The ObjectLandscapeTerrain constructor.

TerrainDetailMask GetDetailMask ( int num ) #

Returns the detail mask by its index. The number of detail masks is fixed and is equal to 20.

Arguments

  • int num - Detail mask index in the [0; 19] range.

Return value

Detail mask having the specified index.

TerrainDetailMask GetDetailMaskSortRender ( int num ) #

Returns the detail mask by its rendering order. The number of detail masks is fixed and is equal to 20, masks rendering order is back to front.

Arguments

  • int num - Detail mask rendering order, in the [0; 19] range.

Return value

Detail mask having the specified rendering order.

TerrainDetailMask FindChild ( string name ) #

Returns a child detail's number by its name. The search is performed among the immediate children only.

Arguments

  • string name - Detail mask name.

Return value

Detail mask having the specified name (if it exists); otherwise, nullptr.

void GetDetailMasks ( TerrainDetailMask[] masks ) #

Builds the list of all detail masks of the landscape terrain and puts them to the specified buffer. The number of detail masks is fixed and is equal to 20.

Arguments

void GetDetailMasksSortRender ( TerrainDetailMask[] masks ) #

Builds the list of all detail masks of the landscape terrain according to their rendering order (back to front) and puts them to the specified buffer. The number of detail masks is fixed and is equal to 20.

Arguments

long GetLastStreamingFrame ( ) #

Returns the number of the frame when the last commit to the Virtual Texture was performed. This method enables you to check if the Landscape Terrain data is loaded completely at the moment (the Virtual Texture is created and the last commit to it is already applied).
Source code (C++)
#include "AppWorldLogic.h"
#include <UnigineWorld.h>
#include <UnigineGame.h>

using namespace Unigine;
ObjectLandscapeTerrainPtr terrain;

int AppWorldLogic::init()
{
	terrain = checked_ptr_cast<ObjectLandscapeTerrain>(World::getNodeByName("ObjectLandscapeTerrain"));
	return 1;
}

int AppWorldLogic::update()
{
	if (!terrain.isValid())
		return 1;
	int64_t last_commit_frame = terrain->getLastStreamingFrame();
	if (last_commit_frame == -1)
	{
		Log::message("The Virtual Texture is not created yet\n");
		return 1;
		// not ready
	}
	if ((Game::getFrame() - last_commit_frame) > 45)
	{
		Log::message("Virtual Texture update is completed (all commits are applied)\n");
		// ...
	}
	else
	{
		Log::message("Virtual Texture update is pending (commit_frame = %d)\n", last_commit_frame);
		// ...
	}
	return 1;
}

Return value

Number of the last streaming frame.

static int type ( ) #

Returns the type of the node.

Return value

ObjectLandscapeTerrain type identifier.
Last update: 2024-04-19
Build: ()