ISampleBufferBase
Description
- Derived from
- Extended by
-
HeightmapRegion sealed
ISampleBuffer
Base interface for classes that represent buffers for heightmap sample values.
Subclasses provide an array that stores the buffer samples. This array can be accessed as follows:
Samples[Offset + y * Stride + x * TupleSize + z] := value
where x
and y
are the coordinates of the buffer sample and z
is the index of the tuple component to access.
Public / Methods
OffsetAt
2 overloads
Computes the buffer index for the given heightmap sample.
The returned buffer index may only be used to access the heightmap samples in the specified row (see y in).
Computes the buffer index for the given heightmap sample.
Shift
Shifts the samples in this buffer by the given amount.
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 in will create space for new samples at the left buffer border, a negative value for x in will create space at the right border.
Specifying a positive value for y in will create space for new samples at the top buffer border, a negative value for y in 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.
Public / Attributes
IsPacked
Returns if this sample buffer is densely packed.
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.
IsPooled
Is this sample buffer being held in a pool?
Using a sample buffer that is being held in a pool is an error and indicates incorrect use of IDeletable.Delete.
After calling IDeletable.Delete, a sample buffer is considered to be in a pool and IsPooled will return true
.
After taking a sample buffer out of the pool, Restore must be called.