UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials

Decal Class

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

This class inherits from Node

Members


int getDecalMask ()

Returns a mask that specifies objects, onto which the decal can be projected. An object can receive the decal, if its mask corresponds to this mask.

Return value

Integer, each bit of which is a mask.

float getFadeTime ()

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

Return value

Time in seconds.

float getLifeTime ()

Returns a 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 getLightMask ()

Returns the current bit mask for lighting the decal with the light source. The decal is lit, if its mask matches the source's one.

Return value

Integer, each bit of which is a mask.

Material getMaterialInherit ()

Inherits material for the decal (i.e. creates a material instance). Modifications made in a new material instance will not affect the source material.

Return value

The inherited material.

string getMaterialName ()

Returns the name of a decal material.

Return value

Material name.

Material getMaterial ()

Returns a material used for the decal.

Return value

Material used for the decal.

float getMaxFadeDistance ()

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.

float getMaxVisibleDistance ()

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

Return value

Distance value, in units.

float getMinFadeDistance ()

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.

float getMinVisibleDistance ()

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

Return value

Distance value, in units.

vec4 getTexCoord ()

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 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 X and Y axes. For example, by the offset of 0.5 along X axis the texture is repositioned to the right (so that the edge of the texture is rendered in the center).

Return value

Texture coordinates for the decal.

int getViewportMask ()

Returns the current bit mask for rendering into the viewport. The decal is rendered, if its mask matches the player's one. The material mask should also match.

Return value

Integer, each bit of which is a mask.

int isDecalDeferred ()

Returns a value indicating if a given decal is of Deferred type.

Return value

Positive number if the decal is deferred; otherwise, 0.

int isDecalObject ()

Returns a value indicating if a given decal is of Object type.

Return value

Positive number if the decal is object; otherwise, 0.

int isDecalTerrain ()

Returns a value indicating if a given decal is of Terrain type.

Return value

Positive number if the decal is terrain; otherwise, 0.

int isMaterialInherited ()

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

Return value

Positive number if the material is inherited; otherwise, 0.

void setDecalMask (int mask)

Sets a mask that specifies objects, onto which the decal can be projected. An object can receive the decal, if its mask corresponds to this mask.

Arguments

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

void setFadeTime (float time)

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

Arguments

  • float time - Time in seconds.

void setLifeTime (float time)

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

Arguments

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

void setLightMask (int mask)

Sets a bit mask for lighting the decal with the light source. The decal is lit, if its mask matches the source's one.

Arguments

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

void setMaterial (string material)

Sets a material for the decal.

Arguments

  • string material - Name of a material.

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. The default is 0.

Arguments

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

void setMaxVisibleDistance (float distance)

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

Arguments

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

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. The default value is 0.

Arguments

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

void setMinVisibleDistance (float distance)

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

Arguments

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

void setTexCoord (vec4 texcoord)

Sets texture coordinates for the decal (a texture atlas can be used).
  • The first pair of coordinates (x and y) set texture scale by 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 X and Y axes. For example, by the offset of 0.5 along X axis the texture is repositioned to the right (so that the edge of the texture is rendered in the center).
The default is vec4(1,1,0,0).

Arguments

  • vec4 texcoord - Texture coordinates for the decal.

void setViewportMask (int mask)

Sets a bit mask for rendering into the viewport. The decal is rendered, if its mask matches the player's one. The material mask should also match.

Arguments

  • int mask - Integer, each bit of which is a mask.
Last update: 2017-07-03