This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm (Experimental)
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine.DecalMesh Class

Inherits: Decal

This class describes how to create and modify mesh decals.

See Also#

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

  • mesh_00
  • mesh_01
  • mesh_02

Creating a Mesh Decal#

The following code illustrates how to create a mesh decal, set its parameters and add the node to UnigineEditor.

Source code (C#)
using Unigine;

namespace UnigineApp
{
	class AppWorldLogic : WorldLogic
	{
        private DecalMesh decal_mesh;

        public override bool Init()
        {
            // create a mesh with a surface (e.g. a box primitive)
            Mesh mesh = new Mesh();
            mesh.addBoxSurface("box_0", new vec3(1.0f));

			// create a mesh decal using created mesh and setting its radius to 10, material to "decal_base"
            decal_mesh = new DecalMesh(mesh, 10.0f, "decal_base");

			// set the name and position of the decal
            decal_mesh.setName("Mesh Decal");
            decal_mesh.setWorldPosition(new Vec3(0.0f, 0.0f, 5.0f));
					
            return true;
        }
    	
		public override bool Shutdown()
		{
			// clear pointer
			decal_mesh.clearPtr();

			return true;
		}
	}
}

DecalMesh Class

Properties

float Radius#

The current height of the decal projection box along the z axis.
set
Sets the new height of the decal projection box along the Z axis.
set value - The height of the decal projection box along the Z axis, in units.

string MeshName#

The name of the mesh used as a base for the decal.
set
Sets a name for the mesh.
set value - A name to be set for the mesh.

Members


static DecalMesh ( Mesh mesh, float radius, string material_name ) #

Constructor. Creates a new mesh decal with the given properties.

Arguments

  • Mesh mesh - Pointer to Mesh.
  • float radius - The height of the decal projection box along the Z axis, in units.
  • string material_name - Material name.

static DecalMesh ( string mesh_path, float radius, string material_name ) #

Constructor. Creates a new mesh decal with the given properties.

Arguments

  • string mesh_path - Mesh name.
    Notice
    The mesh should contain a single surface. In case if the mesh contains several surfaces, only the one with the 0 index will be used. Thus, the area of the decal will differ from the initial mesh.
  • float radius - The height of the decal projection box along the Z axis, in units.
  • string material_name - Material name

int SetMesh ( Mesh mesh, bool unique = 1 ) #

Copies a given source mesh into the current decal mesh.
Source code (C#)
// create an empty decal mesh
DecalMesh decalMesh = new DecalMesh("",8.0f,"decal_base_0");
// create a mesh
Mesh mesh = new Mesh("decal.mesh");
// copy the mesh into the decal mesh
decalMesh.setMesh(mesh);

Arguments

  • Mesh mesh - Mesh to be set.
    Notice
    The mesh should contain a single surface. In case if the mesh contains several surfaces, only the one with the 0 index will be used. Thus, the area of the decal will differ from the initial mesh.
  • bool unique - Unique flag used when you create several objects out of a single Mesh instance:
    • 0 - An instance of source mesh geometry is created. If the source geometry is changed at runtime, its instances will be changed as well.
    • 1 - A copy of source mesh geometry is created and changes made to the source geometry do not affect the mesh.

Return value

1 if the mesh is copied successfully; otherwise, 0.

int GetMesh ( Mesh mesh ) #

Copies the current decal mesh into the received mesh. For example, you can obtain geometry of the decal mesh and then change it:
Source code (C#)
// a decal mesh from which geometry will be obtained
DecalMesh decalMesh = new DecalMesh("decal.mesh",8.0f,"decal_base_0");
// create a new mesh
Mesh mesh = new Mesh();
// copy geometry to the created mesh
if (decalMesh.getMesh(mesh) == 1) {
	// do something with the obtained mesh
}
else {
	Log.Error("Failed to copy a mesh\n");
}

Arguments

  • Mesh mesh - Current mesh.

Return value

1 if the mesh is copied successfully; otherwise, 0.

void SetMeshName ( string path, bool force_load = 0 ) #

Sets a new name for the mesh and forces loading of the mesh with the new name for the current decal mesh.
Notice
The mesh should contain a single surface. In case if the mesh contains several surfaces, only the one with the 0 index will be used. Thus, the area of the decal will differ from the initial mesh.

Arguments

  • string path - A new name to be set for the mesh.
  • bool force_load - Force flag.
    • If 1 is specified, the mesh with the new name will be loaded immediately with the unique flag set to 0.
    • If 0 is specified, only the mesh name will be updated.

void LoadMesh ( string path, bool unique = 0 ) #

Loads a mesh for the current mesh from the file. This function doesn't change the mesh name.

Arguments

  • string path - The name of the mesh file.
    Notice
    The mesh should contain a single surface. In case if the mesh contains several surfaces, only the one with the 0 index will be used. Thus, the area of the decal will differ from the initial mesh.
  • bool unique - Unique flag used when you create several objects out of a single .mesh file:
    • 0 - An instance of source mesh geometry is created. If the source geometry is changed at runtime, its instances will be changed as well.
    • 1 - A copy of source mesh geometry is created and changes made to the source geometry do not affect the mesh.

int SaveMesh ( string path ) #

Saves the decal mesh into a file.

Arguments

  • string path - Mesh file name.

Return value

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

static int type ( ) #

Returns a DecalMesh type identifier.

Return value

Type identifier.
Last update: 2020-11-24
Build: ()