UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm (Experimental)
使用编辑器工具执行特定任务
Extending Editor Functionality
编程
基本原理
搭建开发环境
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

Unigine::Decal Class

Header: #include <UnigineDecals.h>
Inherits: Node

Decal class is used for base decals operation. To create, modify or get information on special types of the decals, use decal-related classes.

Decal Class

Members


void setFadeTime ( float time ) #

Sets a time period during which the decal will fade away (after its life time expires). Fade time is ignored if the decal does not disappear.

Arguments

  • float time - Time in seconds.

float getFadeTime ( ) const#

Returns the time period during which the decal will fade away (after its life time expires).

Return value

Time in seconds.

void setInitTime ( float time ) #

Sets a time period during which the decal will be projected.

Arguments

  • float time - Time in seconds. If a negative value is provided, the decal will be permanent.

float getInitTime ( ) const#

Returns a time period of render initialization.

Return value

Time in seconds.

void setLifeTime ( float time ) #

Sets a time period during which the decal will be projected. By default the decal will not disappear and setFadeTime() will be ignored.

Arguments

  • float time - Time in seconds. If a negative value is provided, the decal will be permanent.

float getLifeTime ( ) const#

Returns the time period during which the decal will be projected.

Return value

Time in seconds. If a negative value is returned, the decal is permanent.

int setMaterial ( const char * name ) #

Sets a new material for the decal.

Arguments

  • const char * name - Name of a new material.

Return value

1 if the material is set successfully; otherwise, 0.

int setMaterial ( const Ptr<Material> & mat ) #

Sets a new material for the decal.

Arguments

  • const Ptr<Material> & mat - Smart pointer to the material to be used for the decal.

Return value

1 if the material is set successfully; otherwise, 0.

int setMaterial ( const UGUID & guid ) #

Sets a new material for the decal.

Arguments

Return value

1 if the material is set successfully; otherwise, 0.

Ptr<Material> getMaterial ( ) const#

Returns the material used for the decal.

Return value

Smart pointer to the material used for the decal.

Ptr<Material> getMaterialInherit ( ) const#

Inherits material for the decal (i.e. creates a material instance). Modifications made in a new material instance will not affect the source material.
Notice
A child material will be created only once, all subsequent calls to this method will return the first created child material.

Return value

Smart pointer to the inherited material.

int isMaterialInherited ( ) const#

Returns the value indicating if a given material is inherited (instanced). Modifications made in a material instance do not affect the source material.

Return value

1 if the material is inherited successfully; otherwise, 0.

const char * getMaterialName ( ) const#

Returns the name of a decal material.

Return value

The material name.

void setMaxFadeDistance ( float distance ) #

Updates a maximum fade-out distance, across which the decal smoothly becomes invisible due to the alpha fading. It is counted starting from the maximum visibility distance value.

Arguments

  • float distance - A new minimum fade-out distance, in units. If a negative value is provided, 0 will be used instead.

float getMaxFadeDistance ( ) const#

Returns a maximum fade-out distance, across which the decal smoothly becomes invisible due to the alpha fading. It is counted starting from the maximum visibility distance value.

Return value

Distance value, in units.

void setMaxVisibleDistance ( float distance ) #

Updates the maximum visibility distance, starting at which the decal begins to fade out until becomes completely invisible.

Arguments

  • float distance - A maximum visibility distance, in units. If a negative value is provided, 0 will be used instead.

float getMaxVisibleDistance ( ) const#

Returns a maximum visibility distance, starting at which the decal begins to fade out until becomes completely invisible.

Return value

Distance value, in units.

void setMinFadeDistance ( float distance ) #

Updates a minimum fade-in distance, across which the decal smoothly becomes visible due to the alpha fading. It is counted starting from the minimum visibility distance value.

Arguments

  • float distance - A new minimum fade-in distance, in units. If a negative value is provided, 0 will be used instead.

float getMinFadeDistance ( ) const#

Returns a minimum fade-in distance, across which the decal smoothly becomes visible due to the alpha fading. It is counted starting from the minimum visibility distance value.

Return value

Distance value, in units.

void setMinVisibleDistance ( float distance ) #

Updates a minimum visibility distance, starting at which the decal begins to fade in and then becomes completely visible.

Arguments

  • float distance - A new minimum visibility distance, in units. If a negative value is provided, 0 will be used instead.

float getMinVisibleDistance ( ) const#

Returns the minimum visibility distance, starting at which the decal begins to fade in and then becomes completely visible.

Return value

Distance value, in units.

void setTexCoord ( const Math::vec4 & coord ) #

Sets texture coordinates for the decal (a texture atlas can be used).
  • The first pair of coordinates (x and y) set texture scale by the X and Y axes. For example, by the scale of 2 the texture is repeated twice on one decal.
  • The second pair (z and w) set texture offset along the X and Y axes. For example, by the offset of 0.5 along the X axis the texture is repositioned to the right (so that the edge of the texture is rendered in the center).

Arguments

  • const Math::vec4 & coord - Texture coordinates for the decal.

Math::vec4 getTexCoord ( ) const#

Returns the texture coordinates for the decal (a texture atlas can be used).
  • The first pair of coordinates (x and y) set texture scale by the X and Y axes. For example, by the scale of 2 the texture is repeated twice on one decal.
  • The second pair (z and w) set texture offset along the X and Y axes. For example, by the offset of 0.5 along the X axis the texture is repositioned to the right (so that the edge of the texture is rendered in the center).

Return value

Current texture coordinates for the decal.

void setViewportMask ( int mask ) #

Sets a bit mask for rendering a decal into the viewport. The decal is rendered, if its mask matches the camera viewport mask and the viewport mask of the decal's material.

Arguments

  • int mask - An integer value, each bit of which is used to set a mask.

int getViewportMask ( ) const#

Returns the current bit mask for rendering into the viewport. The decal is rendered, if its mask matches the camera viewport mask and the viewport mask of the decal's material.

Return value

The integer value, each bit of which is used to set a mask.

void setIntersectionMask ( int mask ) #

Sets a new intersection mask for the decal. This mask can be used to cut out areas intersected by the decal from grass, mesh clutter and world clutter (e.g. to remove grass or forest from the surface of roads projected using decals).
Notice
The areas will be cut out only if intersection masks of grass and clutter objects matches this mask (one bit at least).

Arguments

  • int mask - Integer, each bit of which is a mask.

int getIntersectionMask ( ) const#

Returns the current intersection mask of the decal. This mask can be used to cut out areas intersected by the decal from grass, mesh clutter and world clutter (e.g. to remove grass or forest from the surface of roads projected using decals).
Notice
The areas will be cut out only if intersection masks of grass and clutter objects matches this mask (one bit at least).

Return value

Integer, each bit of which is a mask.

int isTerrainHole ( ) const#

Returns a value indicating if the decal is used to create a hole in the terrain.

Return value

1 if the decal is used to create a terrain hole; otherwise, 0.

int inside ( const Math::vec3 & p ) #

Returns a value indicating if the point with the given coordinates is inside the decal (in object-space).

Arguments

  • const Math::vec3 & p - Point coordinates.

Return value

1 if the point is inside the decal; otherwise, 0.
Last update: 2020-06-16