Click or drag to resize
DigitalRuneTerrainRoadLayer Class
Represents a road 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 TerrainRoadLayer : TerrainLayer

The TerrainRoadLayer type exposes the following members.

Constructors
  NameDescription
Public methodTerrainRoadLayer
Initializes a new instance of the TerrainRoadLayer class with the default material.
Top
Methods
  NameDescription
Public methodStatic memberClampRoadToTerrain
Clamps a road path to the terrain height.
Public methodStatic memberClampTerrainToRoad
Clamps the terrain height to the road ("carves the road into the terrain").
Public methodStatic memberCreateMesh
Creates a road mesh for use with a TerrainRoadLayer.
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.
(Overrides TerrainLayerDispose(Boolean).)
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 methodSetMesh
Sets the road mesh and related properties.
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 propertyBorderBlendRange
Gets or sets a value which determines how the sides of the road mesh fade out. (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 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 propertyRoadLength
Gets the length of the road in world space units. (This is a material parameter - see remarks.)
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 propertySubmesh
Gets the mesh that represents the road.
Public propertyTileSize
Gets or sets the tile size of the road textures in world space. (This is a material parameter - see remarks.)
Top
Remarks

The TerrainRoadLayer renders a mesh which represents a road (or other road-like structures, e.g. skid marks). The road is represented by a Submesh which can be set using SetMesh(Submesh, Aabb, Single, Boolean).

Material textures DiffuseTexture, SpecularTexture, NormalTexture and HeightTexture are rendered along the road. The u-axis of the texture is mapped to the width of the road; the v-axis is mapped to the direction of the road. The textures are repeated along the road direction. The property determines the scale of tiling. (Textures are not tiled along the u-axis.)

The helper methods CreateMesh(GraphicsDevice, Path3F, Single, Int32, Single, Submesh, Aabb, Single), ClampRoadToTerrain(Path3F, HeightField) and ClampTerrainToRoad(HeightField, Path3F, Single, Single, Int32, Single) can be used to create a road mesh and to clamp a road mesh to a terrain or to carve a road into a terrain.

Important: The terrain road layer is only rendered on tiles where the layer is added. If the road stretches over multiple tiles, it needs to be added to all tiles. (An instance of TerrainRoadLayer can be shared by multiple terrain tiles.)

See Also