sealed class Tinman.Engine.Scenes.Entities.TextureDecal

A scene entity that puts a decal onto the terrain.

The following figured shows the mapping between decal vertex coordinates and decal texture coordinates.

(A)---------(B)            Vertex          Texture
 |           |             coordinates:    coordinates:
 |           |     A :=    (-0.5, -0.5)    (0, 0)
 |           |     B :=    (+0.5, -0.5)    (1, 0)
 |           |     C :=    (+0.5, +0.5)    (1, 1)
 |           |     D :=    (-0.5, +0.5)    (0, 1)

The decal vertex transformation is defined as follows:

  1. The input decal vertex coordinates v_in are translated according to the decal texture center (see Center), so that subsequent scaling and rotation is relative to the decal texture center.
    v := v_in - Center + (0.5, 0.5)

  2. The decal vertex coordinates v are scaled, according to Scale:
    v := v * Scale

  3. The decal vertex coordinates v are rotated, according to Yaw:
    v := RotateClockwiseRightHanded(v, Yaw)

  4. The output decal vertex coordinates v_out result from applying the final offset translation, according to Offset:
    v_out := v + Offset

The resulting vertex coordinates are used as map coordinates with respect to the specified coordinate system (see Coordinates). From there, the decal texture is put onto the terrain at the corresponding position.

The default value for the ILightingProperty.Lighting property is false.

See also


Public / Constructors


public constructor TextureDecal → (1)

entityViewMask opt : int64 = ~0

The value for IEntityViewMask.EntityViewMask.

Creates a new instance of TextureDecal.

Public / Attributes


public attribute Center → (get,set)

value : Vec2D

The texture coordinates of the decal center.

The texture coordinates that represent the center of the decal texture.

The scaling (see Scale) and rotation (see Yaw) of the decal texture is applied relative to this center.

Defaults to (0.5, 0.5).


public attribute Content → (get,set)

value : IModelTexture

The texture content or null.

The decal texture content.

Defaults to null.


public attribute Coordinates → (get,set)

value : CoordinateSystem

The coordinate system or null.

The coordinate system of the transformed decal vertices.

Defaults to null.


public attribute Matrix → (get)

value : Mat3D

The transformation matrix.

Returns the homogeneous transformation matrix from input decal vertex coordinates to output decal vertex coordinates.


public attribute Offset → (get,set)

value : Vec2D

The translation offset, in map-space.

The translation offset of the decal vertex transformation.

The translation offset is added to the vertex coordinates of the decal texture, after applying scaling (see Scale) and rotation (see Yaw). Use it to move the decal texture center (see Center) to a desired point in map-space.

Defaults to Vec2D.Zero.


public attribute Scale → (get,set)

value : Vec2D

The scale values.

The scale factors per axis of the decal vertex transformation.

Scaling is applied relative to the decal texture center (see Center).

The texture coordinates for the horizontal U and vertical V axis of the given decal texture (see Content) are within the range [0..1], where 0 represents the left resp. top edge and 1 represents the right resp. bottom edge. The Vec2D.X resp. Vec2D.Y scale factor transforms the range [0..1] to map space, as defined by the specified coordinate system (see Coordinates).

Defaults to Vec2D.Zero.


public attribute SortIndex → (get,set)

value : int32

The sort index, see TerrainDecal.SortIndex.

The terrain layer sort index of this texture decal.


public attribute Yaw → (get,set)

value : float64

The rotation angle, in degrees.

The rotation angle of the decal vertex transformation.

The rotation is applied relative to the decal texture center (see Center). Positive angles rotate clockwise for right-handed map-space and counter-clockwise for left-handed map-space.

Defaults to 0.