IBrush
Description
- Derived from
- Extended by
-
Brush abstract
Base interface for heightmap brushes.
Basically, a heightmap brush computes a rectangular block of heightmap samples, usually using input data that has been fetched from a IHeightmap object. The working data is provided as a PaintingBuffer wrapper object, which allows to perform additional computations (e.g. normals / slopes) on the input and to share the results between IBrush instances.
Depending on the input / output layers, brushes can be categorized as follows:
-
Input : LayerMaskInput == HeightmapLayer.None
An input brush provides initial data, for example by fetching it from a heightmap, loading an image or by copying buffered samples. -
Output : LayerMaskOutput == HeightmapLayer.None
An output brush consumes the samples of another brush, for example by writing them back to a heightmap dataset. -
Mask : LayerMaskOutput == HeightmapLayer.Coverage
A mask brush computes only the coverage layer, which is usually used to modulate the output of other brushes (e.g. via Modulate).
A brush implementation may choose to cache sample buffers in order to improve performance. cached data can be discarded at any time by calling the Flush method on the brush. Flushing brushes must not introduce any side-effects.
Public / Methods
Average
Fills PaintingBuffer.Samples with the average heightmap sample value per output layer of this brush.
Combine
Combines the output of this brush with the output of the given brush ( other in augmenting this with additional detail).
ComputeSamples
Computes the output samples of this brush.
The PaintingBuffer.Samples region of the given buffer in must contain all layers of this brush (see IHeightmapLayers.LayerMask), and its dimensions must be equal to or greater than the dimensions of this brush (only applies to fixed brushes).
- IOException
-
If an I/O error has occurred.
- GeorefException
-
If the available geo-reference information is incomplete or malformed and brush samples must be projected to resp. from another coordinate system.
Invert
Inverts this brush.
Implementing classes can choose to provide a meaningful inverse operation, for example:
-
Raise terrain vs. lower terrain
-
Add material vs. remove material
-
Add terrain holes vs. remove terrain holes
Public / Attributes
IsFlexible
Is this brush flexible?
IsInvariant
Is this brush invariant?
An invariant brush will produce the same output, regardless of the given BrushBounds value.
LayerMaskInput
The input heightmap layers that are read from PaintingBuffer.Samples when ComputeSamples is called.
The ComputeSamples method may only read from those layers of PaintingBuffer.Samples that are included in this input layer set.
LayerMaskOutput
The output heightmap layers that are written to PaintingBuffer.Samples when ComputeSamples is called.
The ComputeSamples method may only write to those layers of PaintingBuffer.Samples that are included in this output layer set.
Extensions
CreateBuffer
Creates a new instance of PaintingBuffer that is suitable for being used as the input buffer when calling IBrush.ComputeSamples on this IBrush object.