HeightmapSample

Description

struct Tinman.Terrain.Heightmaps.HeightmapSample

Represents a single heightmap sample.

Public / Constants

Default


public static readonly attribute Default → (HeightmapSample)

An HeightmapSample value with full coverage and default sample values.

MaxValue30


public constant MaxValue30 → (1073741823:int32)

Maximum absolute value for signed 30-bit scalar heightmap sample values.

Scalar values are interpreted as normalized values in the range [-1..1], where -1 resp. 1 corresponds to the negative resp. positive value of MaxValue30. The normalized range is then mapped to some application-specific range (see VerticalRange).

Void


public static readonly attribute Void → (HeightmapSample)

An HeightmapSample value with zero coverage and default sample values.

Public / Constructors

HeightmapSample


public constructor HeightmapSample → (5)

elevation in : int32

The Elevation value.

texture opt : int64 = 0

The Texture value.

material opt : int64 = 0

The Material value.

coverage opt : int32 = HeightmapSample.MaxValue30

The Coverage value.

displacement opt : int32 = 0

The Displacement value.

Creates a new instance of HeightmapSample.

Public / Methods

ClearDefault


[Pure]
public method ClearDefault → (1)

layers in : HeightmapLayer

The heightmap layers to clear.

returns → HeightmapSample

The resulting heightmap sample value.

Clears the given heightmap layers to Default.

ClearVoid


[Pure]
public method ClearVoid → (1)

layers in : HeightmapLayer

The heightmap layers to clear.

returns → HeightmapSample

The resulting heightmap sample value.

Clears the given heightmap layers to Void.

Equals

2 overloads


[Pure]
public method Equals2 → (2)

other in : HeightmapSample

The other heightmap sample.

layers in : HeightmapLayer

The heightmap layers to compare.

returns → bool

true if all heightmap layers of this and the other in heightmap sample are equal,
false if some are different.

Compares this heightmap sample with the given other in one, taking into account only the specified layers in.

Merge


[Pure]
public method Merge → (2)

other in : HeightmapSample

The heightmap sample to merge with.

layers opt : HeightmapLayer = HeightmapLayer.All

The heightmap layers to merge;

returns → HeightmapSample

The resulting heightmap sample.

Merges this heightmap sample (first) with the given one (second).

Mix


[Pure]
public static method Mix → (5)

in : HeightmapSample

The zeroth heightmap sample to mix.

in : HeightmapSample

The first heightmap sample to mix.

in : HeightmapSample

The second heightmap sample to mix.

in : HeightmapSample

The third heightmap sample to mix.

in : int32

Mix factor for the heightmap samples in the range [0..65536].

returns → HeightmapSample

The resulting heightmap sample.

Mixes the given heightmap samples (interpolation between in and in).

This method uses discrete Catmull-Rom interpolation.


[Pure]
public method Mix → (2)

other in : HeightmapSample

The heightmap sample to mix with.

in : int32

Mix factor for heightmap samples in the range [0..65536] (0 = this sample, 65536 = other sample).

returns → HeightmapSample

The resulting heightmap sample.

Mixes this heightmap sample with the given one.

This method uses discrete linear interpolation.

Modulate


[Pure]
public method Modulate → (1)

coverage in : int32

The coverage sample to modulate with.

returns → HeightmapSample

The resulting heightmap sample.

Modulates this heightmap sample with the given coverage.

SetDisplacement


[Pure]
public method SetDisplacement → (1)

displacement in : int32

The displacement value.

returns → HeightmapSample

The resulting heightmap sample.

Sets the Displacement value.

SetElevation


[Pure]
public method SetElevation → (1)

elevation in : int32

The elevation value.

returns → HeightmapSample

The resulting heightmap sample.

Sets the Elevation value.

SetMaterial


[Pure]
public method SetMaterial → (1)

material in : int64

The material value.

returns → HeightmapSample

The resulting heightmap sample.

Sets the Material value.

SetTexture


[Pure]
public method SetTexture → (1)

texture in : int64

The texture value.

returns → HeightmapSample

The resulting heightmap sample.

Sets the Texture value.

Public / Attributes

Coverage


public readonly attribute Coverage → (int32)

The relative sample coverage value, ranging from 0 (no coverage) to MaxValue30 (full coverage).

Displacement


public readonly attribute Displacement → (int32)

The normalized displacement value along the terrain-space normal vector.

The default displacement value is 0.

Elevation


public readonly attribute Elevation → (int32)

The normalized elevation value along the terrain-space up vector.

The default elevation value is 0.

HasFullCoverage


public attribute HasFullCoverage → (get)

value : bool

true if Coverage is equal to MaxValue30,
false if not.

Has this heightmap sample full coverage?

LayerMask


public attribute LayerMask → (get)

value : HeightmapLayer

The heightmap layers.

The heightmap layers of this sample.

Material


public readonly attribute Material → (int64)

The token (see MaterialToken) value that describes the material of the terrain surface.

The default color value is 0 (no material).

Texture


public readonly attribute Texture → (int64)

The color (see Colors) value that describes the texture of the terrain surface.

The default color value is 0 (transparent black).

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<HeightmapSample>

[not-null]
The configurator object.

The configurator object for this type.

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<HeightmapSample>)

The serialization helper object for values of HeightmapSample.