Heightmap
Description
- Derived from
-
Disposable abstract
IHeightmap - Extended by
-
CompositeHeightmapOne abstract
CompositeHeightmapTwo abstract
MandelbrotHeightmap sealed
RandomHeightmap sealed
TestPatternHeightmap sealed
Abstract base class for IHeightmap implementations.
Public / Constructors
Builder
4 overloads
Builds a heightmap of type MapType.Cube with PixelCoverage.PixelIsPoint.
Builds a heightmap of type MapType.Rect.
Builds a heightmap for the given map raster.
Builds a heightmap similar to heightmap in.
Protected / Methods
BlockCoords
Computes cubemap coordinate for the given face coordinates, wrapping resp. clamping them as required.
DoGetRegion
Fetches a rectangular region of heightmap samples.
The default implementation fetches each sample individually, which is slow. Subclasses are encouraged to provide an optimized implementation for this method.
The heightmap coordinate range given by region in will always be fully inside of the valid coordinate range of this heightmap.
The given buffer in is guaranteed to contain at least all layers of the intersection of the specified layers in and the IHeightmapLayers.LayerMask of this heightmap.
- IOException
-
If an I/O error has occurred.
DoGetSample
Returns a single heightmap sample.
The default implementations of DoGetSamples and DoGetRegion use of this method. This is convenient but will most likely be very slow. It is better to also provide optimized implementations for DoGetSamples and DoGetRegion.
The x in, and y in and z in coordinates will always be within the valid bounds of this heightmap.
- IOException
-
If an I/O error has occurred.
DoGetSamples
Fetches a series of heightmap samples.
The default implementation fetches each sample individually, which is slow. Subclasses are encouraged to provide an optimized implementation for this method.
The given buffer in is guaranteed to contain at least all layers of the intersection of the specified layers in and the IHeightmapLayers.LayerMask of this heightmap.
- IOException
-
If an I/O error has occurred.
DoHasRegion
Checks if this heightmap contains samples in the given region.
The given region in will never be empty (see CubemapFaceRect.IsEmpty) and its bounds will always be inside of its cubemap face (see CubemapFaceRect.Face).
- IOException
-
If an I/O error has occurred.
DoSetRegion
Stores a rectangular region of heightmap samples.
The heightmap coordinate range given by region in will always be fully inside of the valid coordinate range of this heightmap.
The given buffer in is guaranteed to contain at least all layers of the intersection of the specified layers in and the IHeightmapLayers.LayerMask of this heightmap.
- IOException
-
If an I/O error has occurred.
DoSplit
Filters this heightmap by retaining only the given heightmap layers.
The given layers in will never be HeightmapLayer.None and will always be a subset of this heightmaps IHeightmapLayers.LayerMask.
Initialize
2 overloads
Initializes the map to the size and type of the given IHeightmap object.
Initializes the heightmap to the given type and size.
The internal size of this heightmap will be set to the maximum of size in, width opt and height opt, clamped to the next power of two plus one between HeightmapsUtil.MinSize and HeightmapsUtil.MaxSize.
Protected / Attributes
maxSizeMask
Bitmask for aligning coordinates to the size of this heightmap.
This value is set by Initialize2.
A binary and
with this bitmask has the same effect as doing a right-shift of maxSizeShift bits followed by a left-shift of the same bit count.
maxSizeScale
Scale factor to apply to coordinates of this map in order to translate them to HeightmapsUtil.MaxSize.
This value is set by Initialize2.
maxSizeShift
Shift amount to apply to coordinates of this map in order to translate them to HeightmapsUtil.MaxSize.
This value is set by Initialize2.
According to HeightmapsUtil.MinSize and HeightmapsUtil.MaxSize, this value will always be in the range [0..22]
.