Base interface for classes that represent buffers for heightmap sample values.
interface
|
ISampleBufferBase
|
extends
|
IMemoryConsumption
|
||
base of
|
HeightmapRegion
|
||||
ISampleBuffer
|
Subclasses provide an array that stores the buffer samples. This array can be accessed as follows:
Samples[Offset + y * Stride + x * TupleSize + z] := valuewhere
x
and
y
are
the
coordinates
of
the
buffer
sample
and
z
is
the
index
of
the
tuple
component
to
access.
The height of the buffer, in samples.
property
|
Height
{
get
}
|
||
type
|
int32
|
||
value
|
|
The height of the buffer, in samples. |
Returns if this sample buffer is densely packed.
property
|
IsPacked
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
buffer
is
densely
packed,
false
if
not. |
Remarks:
A packed sample buffer can be indexed with the following scheme:
Samples[(y * Width + x) * TupleSize + 0] := 1st value of sample at (x,y). Samples[(y * Width + x) * TupleSize + 1] := 2nd value of sample at (x,y). ... Samples[(y * Width + x) * TupleSize + TupleSize - 1] := last value of sample.Thus the samples of a densely packed buffer form a contiguous region in memory.
Returns the estimated memory consumption of this object.
property
|
MemoryConsumption
{
get
}
|
||
type
|
int64
|
||
value
|
|
The estimated memory consumption, in bytes. | |
inherited
|
IMemoryConsumption.MemoryConsumption
|
Index of top-left sample in the buffer.
property
|
Offset
{
get
}
|
||
type
|
int32
|
||
value
|
|
The buffer offset. |
Distance between two consecutive rows in the buffer.
property
|
Stride
{
get
}
|
||
type
|
int32
|
||
value
|
|
The buffer stride, in samples. |
The width of the buffer, in samples.
property
|
Width
{
get
}
|
||
type
|
int32
|
||
value
|
|
The width of the buffer, in samples. |
Computes the buffer index for the given heightmap sample.
[Pure]
|
||||
method
|
OffsetAt
(int32 y)
|
|||
type
|
int32
|
|||
params
|
y
|
[0..Height-1]
|
Y-coordinate of the row. | |
returns
|
|
Buffer index of the heightmap sample. |
Remarks:
The returned buffer index may only be used to access the heightmap samples in the specified row (see y).
Computes the buffer index for the given heightmap sample.
[Pure]
|
||||
method
|
OffsetAt
(int32 x,
int32 y)
|
|||
type
|
int32
|
|||
params
|
x
|
[0..Width-1]
|
X-coordinate of sample. | |
y
|
[0..Height-1]
|
Y-coordinate of sample. | ||
returns
|
|
Buffer index of the heightmap sample. |
Shifts the samples in this buffer by the given amount.
method
|
Shift
(int32 x,
int32 y,
ICollector<Box2I> callback = null)
|
||
params
|
x
|
Horizontal shift amount. | |
y
|
Vertical shift amount. | ||
callback
|
Collector for sample buffer regions that have been invalidated by the shift. |
Remarks:
This method allows sample buffers to be used in a toroidal manner (i.e. as a two-dimensional ringbuffer).
Specifying a positive value for x will create space for new samples at the left buffer border, a negative value for x will create space at the right border.
Specifying a positive value for y will create space for new samples at the top buffer border, a negative value for y will create space at the bottom border.
The contents of the samples in the additional space at the buffer border is unspecified and must be set by the application.