Click or drag to resize
DigitalRuneTerrainDecalLayer Class
Represents a decal which is rendered onto the terrain.
Inheritance Hierarchy

Namespace: DigitalRune.Graphics
Assembly: DigitalRune.Graphics (in DigitalRune.Graphics.dll) Version: 1.2.0.0 (1.2.1.14562)
Syntax
public class TerrainDecalLayer : TerrainLayer

The TerrainDecalLayer type exposes the following members.

Constructors
  NameDescription
Public methodTerrainDecalLayer(IGraphicsService)
Initializes a new instance of the TerrainDecalLayer class with the default material.
Public methodTerrainDecalLayer(Material)
Initializes a new instance of the TerrainDecalLayer class with a custom material.
Top
Methods
  NameDescription
Public methodDispose
Releases all resources used by an instance of the TerrainLayer class.
(Inherited from TerrainLayer.)
Protected methodDispose(Boolean)
Releases the unmanaged resources used by an instance of the TerrainLayer class and optionally releases the managed resources.
(Inherited from TerrainLayer.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyAabb
Gets (or sets) the axis-aligned bounding box of the area that is influenced by this terrain layer.
(Inherited from TerrainLayer.)
Public propertyAlpha
Gets or sets the opacity (alpha). (This is a material parameter - see remarks.)
Public propertyDiffuseColor
Gets or sets the diffuse color.(This is a material parameter - see remarks.)
Public propertyDiffuseTexture
Gets or sets the diffuse texture. (This is a material parameter - see remarks.)
Public propertyFadeInEnd
Gets or sets the clipmap level where the fade-in ends and this terrain layer is fully visible. (This is a material parameter - see remarks.)
(Inherited from TerrainLayer.)
Public propertyFadeInStart
Gets or sets the clipmap level where this terrain layer starts to fade in. (This is a material parameter - see remarks.)
(Inherited from TerrainLayer.)
Public propertyFadeOutEnd
Gets or sets the clipmap level where the fade-out ends and this terrain layer is not rendered anymore. (This is a material parameter - see remarks.)
(Inherited from TerrainLayer.)
Public propertyFadeOutStart
Gets or sets the clipmap level where this terrain layer starts to fade out. (This is a material parameter - see remarks.)
(Inherited from TerrainLayer.)
Public propertyHeight
Gets or sets the height of the decal in world space.
Public propertyHeightTexture
Gets or sets the height texture. (This is a material parameter - see remarks.)
Public propertyHeightTextureBias
Gets or sets the bias that is added to samples of the height texture. (This is a material parameter - see remarks.)
Public propertyHeightTextureScale
Gets or sets the scale that is multiplied with samples of the height texture. (This is a material parameter - see remarks.)
Public propertyIsDisposed
Gets a value indicating whether this instance has been disposed of.
(Inherited from TerrainLayer.)
Public propertyMaterial
Gets (or sets) the material that is used to render this terrain layer.
(Inherited from TerrainLayer.)
Public propertyMaterialInstance
Gets the material instance.
(Inherited from TerrainLayer.)
Public propertyNormalTexture
Gets or sets the normal texture. (This is a material parameter - see remarks.)
Public propertyPose
Gets or sets the pose of the decal.
Public propertySpecularColor
Gets or sets the specular color. (This is a material parameter - see remarks.)
Public propertySpecularPower
Gets or sets the specular color exponent. (This is a material parameter - see remarks.)
Public propertySpecularTexture
Gets or sets the specular texture. (This is a material parameter - see remarks.)
Public propertyWidth
Gets or sets the width of the decal in world space.
Top
Remarks

The TerrainDecalLayer can be used to render decals, such as dirt, leaves, explosion marks, sewer grates, etc. onto the terrain.

The position and orientation of the texture is determined by the Pose. The decal is projected in "forward" (-z) direction. That means that the orientation will usually be a downward facing orientation and the y value of the position will be ignored. For example:

C#
var position = new Vector3F(positionX, 0, positionZ);
var orientation = Matrix33F.CreateRotationY(rotationAngle) * 
                  Matrix33F.CreateRotationX(-ConstantsF.PiOver2);
myDecalLayer.Pose = new Pose(position, orientation);

The decal is centered at the specified Pose. The extent is defined by Width and Height.

Important: The decal is only rendered on tiles where the decal layer is added. If the decal overlaps multiple terrain tiles, the decal layer needs to be added to all tiles. (An instance of TerrainDecalLayer can be shared by multiple terrain tiles.

Material:
Different TerrainDecalLayers can share the same material.

See Also