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

Inherits:Decal

This class describes how to create and modify mesh decals.

DecalMesh Class

Members


static DecalMesh(Mesh mesh, float radius, string 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 name - Material name.

static DecalMesh(string mesh_name, float radius, string name)

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

Arguments

  • string mesh_name - 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 name - Material name

DecalMesh cast(Node node)

Casts a mesh decal out of the Node instance.

Arguments

  • Node node - Node instance.

Return value

DecalMesh instance.

DecalMesh cast(Decal base)

Casts a DecalMesh out of the Decal instance.

Arguments

  • Decal base - Decal instance.

Return value

DecalMesh instance.

int setMesh(Mesh mesh, int 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.
  • int 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 name, int 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 name - A new name to be set for the mesh.
  • int 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.

string getMeshName()

Returns the name of the mesh used as a base for the decal.

Return value

The mesh name.

void setRadius(float radius)

Sets the new height of the decal projection box along the Z axis.

Arguments

  • float radius - The height of the decal projection box along the Z axis, in units.

float getRadius()

Returns the current height of the decal projection box along the Z axis.

Return value

The height of the decal projection box along the Z axis, in units.

void loadMesh(string name, int unique = 0)

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

Arguments

  • string name - 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.
  • int 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 name)

Saves the decal mesh into a file.

Arguments

  • string name - Mesh file name.

Return value

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

int type()

Returns a DecalMesh type identifier.

Return value

Type identifier.
Last update: 2018-08-10
Build: ()