Brush

Description

abstract class Tinman.Terrain.Heightmaps.Painting.Brush

Derived from

Disposable abstract
IBrush

Extended by

CompositeBrushOne abstract
CompositeBrushTwo abstract

Abstract base class for IBrush implementations.

Public / Constructors

Input​Copy


[OwnerReturn]
public static method InputCopy → (1)

buffer in : HeightmapRegion

[not-null]
The samples to copy.

returns → IBrush

The brush.

A fixed input brush that copies the samples in the given buffer into PaintingBuffer.Samples.

Input​Heightmap


[OwnerReturn]
public static method InputHeightmap → (2)

heightmap in : IHeightmap own

[not-null]
The heightmap to copy samples from.

layers opt : HeightmapLayer = HeightmapLayer.All

The heightmap layers to copy.

returns → IBrush

The brush.

A flexible input brush that fetches heightmap samples into PaintingBuffer.Samples.

Input​Image


[OwnerReturn]
public static method InputImage → (4)

image in : IImage

[not-null]
The image to read.

range opt : PixelRange = default(PixelRange)

The scanline range to use for reading the image (see ISampleBuffer.ScanlineRange). Defaults to the following:

materials opt : Vec4I = default(Vec4I)

The scanline materials to use for reading the image (see MaterialBuffer.ScanlineMaterials). Will be ignored if IImageInfo.Layer is not HeightmapLayer.Material.

geo opt : bool = true

Use ReadImageFlags.Geo when reading image in?

returns → IBrush

The brush.

A fixed input brush that copies image pixels into a layer of PaintingBuffer.Samples.

IOException

If an I/O error has occurred while reading the image metadata.

ValidatingException

If validation of the resulting IImageReader has failed, for example because of an unsupported file format feature.

GeorefException

If the image contains unsupported geo-referencing metadata and geo opt is true.

Input​Uniform


[OwnerReturn]
public static method InputUniform → (2)

sample in : HeightmapSample

The uniform sample value.

layers opt : HeightmapLayer = HeightmapLayer.All

The layers to fill.

returns → IBrush

The brush.

A flexible input brush that fills the output layers with the given uniform sample value.

Mask​Radial


[OwnerReturn]
public static method MaskRadial → (4)

size in : int32

[>0]
The brush size (both width and height).

power opt : float64 = 1

[>=0]
The power to raise the coverage value (see remarks).

inner opt : float64 = 0

[0..1]
Normalized radius of inner circle that has full coverage.

shape opt : float64 = 2

[>0]
The power to use for computing the distance to the center sample:
< 1 : star shape
< 2 : egg shape
= 2 : circle shape (Euclidean distance)
> 2 : balloon shape

returns → IBrush

The brush.

A fixed mask brush that creates a radial coverage mask.

The center sample has full coverage, the border samples have zero coverage. The coverage of the samples in-between is computed like this:

half     = size / 2
value    = max(0, half - length(x - half, y - half)) / half
coverage = pow(value, power)

If power opt is 0, the following formula is used:

coverage = smoothstep(value)

where smoothstep is implemented via Maths.SmootherStep1.

Protected / Constructors

Brush


protected constructor Brush → (2)

width opt : int32 = 0

[>=0]
The brush width or 0 if flexible.

height opt : int32 = 0

[>=0]
The brush height or 0 if flexible.

Creates a new instance of Brush.

Protected / Methods

Do​Compute​Samples


protected abstract method DoComputeSamples → (3)

bounds in : BrushBounds

The brush bounds (will never be null).

buffer in : PaintingBuffer

The brush buffer. The PaintingBuffer.Samples region will contain all heightmap layers (input + output) of this brush.

layers in : HeightmapLayer

The output layers. Always a subset of the output layers of this brush.

Computes the output samples of this brush.

This method is called by IBrush.ComputeSamples, after all arguments have been validated and buffer in has been prepared to contain the given heightmap passing layers in.

The PaintingBuffer.SamplesDirty methods will be called on buffer in passing layers in, after this method has returned.

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.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<IBrush>

[not-null]
The configurator object.

The configurator object for this type.