TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class HeightmapSamples in Tinman.Terrain.Heightmaps

The HeightmapSamples class is a container for storing unrelated heightmap samples.

sealed class HeightmapSamples implements ICapacity
  IHeightmapBuffer
  IMemoryConsumption

Public / Attributes

Capacity

Returns the capacity of this object.

public property Capacity { get }
type int32
value [>=0] The capacity, in elements.
implements ICapacity.Capacity

Coverage

The relative sample coverage values or null if LayerMask does not contain the Coverage flag.

public field Coverage
type int32[]

See also:

HeightmapSample.MaxValue30
HeightmapLayer.Coverage
HeightmapSample.Coverage
HeightmapRegion.Coverage

Displacement

The normalized displacement values or null if LayerMask does not contain the Displacement flag.

public field Displacement
type int32[]

See also:

HeightmapSample.MaxValue30
HeightmapLayer.Displacement
HeightmapSample.Displacement
HeightmapRegion.Displacement

Elevation

The normalized elevation values or null if LayerMask does not contain the Elevation flag.

public field Elevation
type int32[]

See also:

HeightmapSample.MaxValue30
HeightmapLayer.Elevation
HeightmapSample.Elevation
HeightmapRegion.Elevation

Helper

A helper object that is attached to this heightmap sample buffer.

public field Helper
type HeightmapSamplesHelper

Remarks:

Heightmaps can attach private helper objects to heightmap samples buffers in order to optimize subsequent heightmap accesses using the same buffer.

See also:

Clone

LayerMask

The mask of heightmap layers this object uses.

public property LayerMask { get }
type HeightmapLayer
value Bitwise combination of HeightmapLayer values.
implements IHeightmapLayers.LayerMask

Remarks:

These heightmap layers store actual terrain data:

Missing data is represented with the Coverage layer. It describes how much information is present in a stored heightmap sample. The semantics of coverage with heightmap samples is the same as premultiplied alpha with texture samples. A LayerMask without Coverage means that all samples are fully solid. If a LayerMask contains the Coverage layer but no others, the coverage values are used to represent 'holes' in the terrain (e.g. creating holes for caves, tunnels, etc.).

Material

The token (see MaterialToken) values that describe the material of the terrain surface or null if LayerMask does not contain the Material flag.

public field Material
type int64[]

See also:

HeightmapLayer.Material
HeightmapSample.Material
HeightmapRegion.Material

MemoryConsumption

Returns the estimated memory consumption of this object.

public property MemoryConsumption { get }
type int64
value [>=0] The estimated memory consumption, in bytes.
implements IMemoryConsumption.MemoryConsumption

Texture

The color (see Colors) values that describe the texture of the terrain surface or null if LayerMask does not contain the Texture flag.

public field Texture
type int64[]

See also:

HeightmapLayer.Texture
HeightmapSample.Texture
HeightmapRegion.Texture

Public / Constructors

HeightmapSamples

Creates a new instance of HeightmapSamples.

public constructor HeightmapSamples (int32 capacity, HeightmapLayer layers = HeightmapLayer.All)
params capacity [>0] The capacity, in heightmap samples.
  layers The heightmap layers. Defaults to All.

Public / Methods

AddLayers

Adds the given heightmap layers this buffer.

public method AddLayers (HeightmapLayer layers)
params layers The set of heightmap layers this buffer shall be able to store.
implements IHeightmapBuffer.AddLayers

Clear

Clears heightmap samples to their default values.

public method Clear (bool voidOrDefault = true, int32 offset = 0, int32 count = -1, HeightmapLayer layers = HeightmapLayer.All)
params voidOrDefault Clear to Void (true) or to Default (false)?
  offset [0..Capacity] Offset of first sample to clear.
  count [-1..Capacity-offset] Number of heightmap samples to clear.
  layers The heightmap layers to clear. Defaults to All

Clone

Returns a clone of this HeightmapSamples buffer.

public method Clone ()
type HeightmapSamples
returns [not-null] The cloned buffer.

Remarks:

The data arrays are shared between this buffer and the returned one. The helper objects are independent.

GetAt

Returns a single heightmap sample.

[Pure]
public method GetAt (int32 offset)
type HeightmapSample
params offset [>=0] The heightmap sample offset.
returns The heightmap sample value.
implements IHeightmapBuffer.GetAt

Remarks:

The maximum valid sample offset is defined by the implementing class.

SetAt

Sets a single heightmap sample.

public method SetAt (int32 offset, HeightmapSample sample, HeightmapLayer layers = HeightmapLayer.All)
params offset [>=0] The heightmap sample offset.
  sample The heightmap sample value.
  layers The heightmap layers to set. Defaults to All.
implements IHeightmapBuffer.SetAt

Remarks:

Passing a heightmap sample with partial coverage to a buffer that does not contain the Coverage layer will result in that layer being added to this buffer via a call to AddLayers.

The maximum valid sample offset is defined by the implementing class.