ElevationBuffer

Description

sealed class Tinman.Terrain.Buffers.ElevationBuffer

Derived from

SampleBufferInt32 abstract

An implementation of the ISampleBuffer interface that stores normalized elevation values (see HeightmapSample.MaxValue30).

Public / Constants

Scanline​Range​Default


public static readonly attribute ScanlineRangeDefault → (PixelRange)

The default value of ISampleBuffer.ScanlineRange.

For image coding, the raw pixel value corresponds to the elevation value (see HeightmapSample.Elevation).

The default pixel range maps the elevation values -/+ HeightmapSample.MaxValue30 to black resp. white.

Scanline​Range​Half


public static readonly attribute ScanlineRangeHalf → (PixelRange)

The pixel range to use for reading heightmap images that store elevation values equal to or greater than zero.

Public / Constructors

Create


public static method Create → (2)

width in : int32

[>0]
Width of the elevation buffer.

height in : int32

[>0]
Height of the elevation buffer.

returns → ElevationBuffer

The created ElevationBuffer object.

Creates a new instance of ElevationBuffer.

Instances of ElevationBuffer can be pooled by calling IDeletable.Delete.

From​Image

3 overloads


public static method FromImage1 → (1)

image in : Path

[not-null]
The source image.

returns → ElevationBuffer

The created ElevationBuffer.

Creates a new instance of ElevationBuffer.

IOException

If an I/O error has occurred.

ValidatingException

If the image reader has reported an error, for example because of an unsupported file format feature.


public static method FromImage2 → (1)

image in : IImage

[not-null]
The source image.

returns → ElevationBuffer

The created ElevationBuffer.

Creates a new instance of ElevationBuffer.

IOException

If an I/O error has occurred.

ValidatingException

If the image reader has reported an error, for example because of an unsupported file format feature.


public static method FromImage3 → (1)

image in : IImageReader own

[not-null]
The source image.

returns → ElevationBuffer

The created ElevationBuffer.

Creates a new instance of ElevationBuffer.

IOException

If an I/O error has occurred.

Public / Methods

Elevation​At​Wrap


[Pure]
public method ElevationAtWrap → (2)

in : float64

Normalized X-coordinate of sample.

in : float64

Normalized Y-coordinate of sample.

returns → int32

The interpolated sample.

Samples an elevation value, using linear interpolation.

The given coordinates are wrapped at the buffer edges. The given coordinates are normalized, i.e. 0 refers to the top-left edge and 1 refers to the bottom-right edge.