TerrainMaterial

Description

sealed class Tinman.Engine.Components.TerrainMaterial

Describes a terrain material for texturing.

A TerrainMaterial object represents an immutable description of a terrain material, for use with TerrainLayer.Material and TerrainLayerMaterial.Add. To define a terrain material, use one of the For constructors to obtain the initial descriptor. Then, use the H and V method to update the descriptor, as needed. Basically, these methods just update one or more properties and return the resulting descriptor. A terrain material encapsulates the following concepts:

  • Each terrain material is associated with a specific material ID (see MaterialToken) in the material layer of the terrain heightmap (see HeightmapLayer.Material).

  • Each terrain material has a color key, which is used to create the placeholder texture (see Placeholder), which is shown while the actual textures are being loaded in the background. Optionally, the color keys can be used to compute material tokens from the texture layer of the terrain heightmap (see HeightmapLayer.Texture), by using a MaterialKeys object to create a custom heightmap via IHeightmap.Material.

  • Each terrain material must have a horizontal component, defined by Horizontal, ScaleHorizontal and BlendHorizontal. If only the horizontal component is defined, the material will be applied using standard UV-mapping, which will create distortions when the terrain has steep slopes.

  • A terrain material may have a vertical component, defined by Vertical, ScaleVertical and BlendVertical. If present, the material will be applied using tri-planar texture mapping, using the vertical component for both vertical texturing planes and the horizontal component for the horizontal texturing plane.

Public / Constructors

For

2 overloads


[Pure]
public static method For1 → (3)

materialId in : int32

[0..255]
The material ID (see MaterialKey.Material of Key).

color opt : int64 = Colors.White

Optional material color key (see MaterialKey.Color of Key).

name opt : string = null

Human-readable name of this terrain material.

returns → TerrainMaterial

The TerrainMaterial object.

Creates a new instance of TerrainMaterial.


[Pure]
public static method For2 → (2)

material in : MaterialKey

The material key, see Key.

name opt : string = null

Human-readable name of this terrain material, see Name.

returns → TerrainMaterial

The TerrainMaterial object.

Creates a new instance of TerrainMaterial.

Public / Methods

H

4 overloads


[Pure]
public method H1 → (1)

scale in : Vec2F

The new scale value.

returns → TerrainMaterial

The resulting TerrainMaterial object.

Set the value of ScaleHorizontal.


[Pure]
public method H2 → (1)

blend in : TerrainMaterialBlend

The new blend value.

returns → TerrainMaterial

The resulting TerrainMaterial object.

Set the value of BlendHorizontal.


[Pure]
public method H3 → (1)

texture in : TerrainMaterialTexture

[not-null]
The new texture value.

returns → TerrainMaterial

The resulting TerrainMaterial object.

Set the value of Horizontal.


public method H4 → (3)

texture in : TerrainMaterialTexture

[not-null]
The new texture value.

scale in : Vec2F

The new scale value.

blend in : TerrainMaterialBlend

The new blend value.

returns → TerrainMaterial

The resulting TerrainMaterial object.

Set the value of Horizontal, ScaleHorizontal and BlendHorizontal.

V

4 overloads


[Pure]
public method V1 → (1)

scale in : Vec2F

The new scale value.

returns → TerrainMaterial

The resulting TerrainMaterial object.

Set the value of ScaleVertical.


[Pure]
public method V2 → (1)

blend in : TerrainMaterialBlend

The new blend value.

returns → TerrainMaterial

The resulting TerrainMaterial object.

Set the value of BlendVertical.


[Pure]
public method V3 → (1)

texture in : TerrainMaterialTexture

[not-null]
The new texture value.

returns → TerrainMaterial

The resulting TerrainMaterial object.

Set the value of Vertical.


public method V4 → (3)

texture in : TerrainMaterialTexture

[not-null]
The new texture value.

scale in : Vec2F

The new scale value.

blend in : TerrainMaterialBlend

The new blend value.

returns → TerrainMaterial

The resulting TerrainMaterial object.

Set the value of Vertical, ScaleVertical and BlendVertical.

Public / Attributes

Blend​Horizontal


public readonly attribute BlendHorizontal → (TerrainMaterialBlend)

Material color blend for Horizontal.

Blend​Vertical


public readonly attribute BlendVertical → (TerrainMaterialBlend)

Material color blend for Vertical.

Horizontal


public readonly attribute Horizontal → (TerrainMaterialTexture)

The horizontal terrain texture.

Key


public readonly attribute Key → (MaterialKey)

The material key.

The material key is used to extract material weights from the HeightmapLayer.Texture layer.

Name


public readonly attribute Name → (string)

Human-readable name of this terrain material or null if none.

Placeholder


public readonly attribute Placeholder → (IModelTexture)

A placeholder texture using the material key color (see MaterialKey.Color).

Scale​Horizontal


public readonly attribute ScaleHorizontal → (Vec2F)

Artificial scale factors to apply to the texture and displacement scales of Horizontal.

Scale​Vertical


public readonly attribute ScaleVertical → (Vec2F)

Artificial scale factors to apply to the texture and displacement scales of Vertical.

Vertical


public readonly attribute Vertical → (TerrainMaterialTexture)

The vertical terrain texture (for triplanar mapping) or null (for standard UV-mapping).