IHeightmapFormat

Description

interface Tinman.Terrain.Heightmaps.Formats.IHeightmapFormat

Base interface for classes that convert heightmap samples to byte sequences and vice versa.

Public / Methods

Collect


public method Collect → (1)

components in : ICollector<IHeightmapFormat>

[not-null]
The output component list.

Converts this heightmap format to a list of atomic IHeightmapFormat components (i.e. format components that provide a single heightmap layer).

Dataset​To​Heightmap


public method DatasetToHeightmap → (3)

buffer in : ByteBuffer

[not-null]
The input buffer.

region in : HeightmapRegion

[not-null]
The output heightmap region.

range in : VerticalRange

The vertical range.

Converts the given bytes into heightmap samples.

This method will read a chunked array of bytes from the given buffer:

Source (chunked array, multiple samples per byte):

+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | 1 |...| 2 | 3 | 4 |...| 5 |...| 6 | 7 |...| 8 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+
 \_____________/ \_____________/     \_____________/
  Samples 0-N     Sample 0-N          Samples 0-N
  Byte 0          Byte 1              Byte M

Target (interleaved array, multiple bytes per sample):

+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | 3 |...| 6 | 1 | 4 |...| 7 |...| 2 | 5 |...| 8 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+
 \_____________/ \_____________/     \_____________/
  Sample 0        Sample 1            Sample N
  Bytes 0-M       Bytes 0-M           Bytes 0-M

Running through the samples of the given heightmap region in in packed row-major order for each value byte will yield the source array. The elements of the target array will be written to the given buffer in.

Heightmap​To​Dataset


public method HeightmapToDataset → (3)

region in : HeightmapRegion

[not-null]
The input heightmap region.

buffer in : ByteBuffer

[not-null]
The output buffer.

range in : VerticalRange

The vertical range.

Converts the given heightmap samples into bytes.

This method will write a chunked array of bytes to the given buffer:

Source (interleaved array, multiple bytes per sample):

+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | 1 |...| 2 | 3 | 4 |...| 5 |...| 6 | 7 |...| 8 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+
 \_____________/ \_____________/     \_____________/
  Sample 0        Sample 1            Sample N
  Bytes 0-M       Bytes 0-M           Bytes 0-M

Target (chunked array, multiple samples per channel):

+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | 3 |...| 6 | 1 | 4 |...| 7 |...| 2 | 5 |...| 8 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+
 \_____________/ \_____________/     \_____________/
  Samples 0-N     Samples 0-N         Samples 0-N
  Channel 0       Channel 1           Channel M

Running through the samples of the given heightmap region in in packed row-major order will yield the source array. The elements of the target array will be written to the given buffer in.

Public / Attributes

Byte​Count


public attribute ByteCount → (get)

value : int32

[>0]
The number of channels.

The number of dataset channels.

Has​Alpha


public attribute HasAlpha → (get)

value : bool

true if this heightmap format stores alpha values, false if not.

Does this heightmap format store the alpha channel of the HeightmapLayer.Texture layer?

Extensions

Append


public static method Append → (1)

format in : IHeightmapFormat

[not-null]
The other heightmap format.

returns → IHeightmapFormat

The concatenated heightmap format.

Collects the atomic component list of thisformat and the given other format in and concatenates the lists (this first).