TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

interface IPixelLayer in Tinman.Terrain.Heightmaps.Painting

Base interface for pixel layers.

interface IPixelLayer extends IConfigurable
  IHeightmapLayers
  IPixelLayerOps
  base of PixelLayer

Attributes

LayerMask

The mask of heightmap layers this object uses.

property LayerMask { get }
type HeightmapLayer
value Bitwise combination of HeightmapLayer values.
inherited IHeightmapLayers.LayerMask

Remarks:

These heightmap layers store actual terrain data:

Missing data is represented with the Coverage layer. It describes how much information is present in a stored heightmap sample. The semantics of coverage with heightmap samples is the same as premultiplied alpha with texture samples. A LayerMask without Coverage means that all samples are fully solid. If a LayerMask contains the Coverage layer but no others, the coverage values are used to represent 'holes' in the terrain (e.g. creating holes for caves, tunnels, etc.).

Padding

The amount of padding pixels this layer requires.

property Padding { get }
type int32
value [>=0] The number of padding pixels.

Methods

ComputeLayerPixels

Computes the pixels of this layer using the given buffers.

method ComputeLayerPixels (PixelLayerBuffers buffers)
params buffers [not-null] The pixel layer buffers.

LightAmbient

Applies a lambertian lighting term to the target pixels in Pixels.

method LightAmbient (int64 lightColor)
type IPixelLayer
params lightColor The ambient light color (the alpha channel is ignored).
returns [not-null] The resulting pixel layer.
inherited IPixelLayerOps.LightAmbient

See also:

Colors

LightDirectional

Applies a lambertian lighting term to the target pixels in Pixels.

method LightDirectional (Vec3F lightDirection, int64 lightColor)
type IPixelLayer
params lightDirection The light direction vector.
  lightColor The directional light color (the alpha channel is ignored).
returns [not-null] The resulting pixel layer.
inherited IPixelLayerOps.LightDirectional

Remarks:

The X and Y refer to pixel coordinates, Z is pointing downwards.

See also:

Colors

ToConfig

Returns the configuration value that describes this object.

method ToConfig ()
type ConfigValue
returns [not-null] The configuration value.
inherited IConfigurable.ToConfig

Remarks:

All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.

The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.

Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.

Extensions

Adjust

Adjust the brightness and saturation of the target pixels in Pixels.

method Adjust (int32 brightness, int32 saturation = 0, bool slopeBased = false)
type IPixelLayer
params brightness The adjustment factor for image brightness in the range [-1000..1000].
  saturation The adjustment factor for image saturation in the range [-1000..1000]. Defaults to 0.
  slopeBased Modulate color adjustment factors with terrain slope?
returns [not-null] The resulting pixel layer.

Remarks:

If slopes have been computed (i.e. Slopes is not null), the adjustment factors for each pixel are computed as follows:

90° >= slope >= 0°
b' = slope / 90 * b
s' = slope / 90 * s
where slope is the slope angle of the pixel, b is the brightness parameter, s is the saturation parameter. The values b' and s' are then passed to Adjust.

See also:

Colors.Adjust

Combine

Combines the result of this pixel layer with the result of the given one.

method Combine (IPixelLayer other, ColorOp colorOp = ColorOp.Blend)
type IPixelLayer
params other [not-null] The other pixel layer.
  colorOp The color operation to use. Defaults to Blend.
returns [not-null] The resulting pixel layer.

ComputeLayerPixels

Computes the pixels of this layer.

method ComputeLayerPixels (HeightmapRegion input, int32 step = 1, ColorBuffer output = null)
type ColorBuffer
params input [not-null] The input heightmap region.
  step The sample step that has been used to fill input. This will always be a power of two. Defaults to 1.
  output Optional output buffer. If null a new buffer will be created. Defaults to null.
returns [not-null] The resulting color buffer.

Contour

Renders contour lines onto the target pixel buffer.

method Contour (ContourValue value, ContourRange range, int64 fillColor = 0, int64 lineColor = 0, int32 lineStrength = 0, int32 materialId = 0)
type IPixelLayer
params value The contour values.
  range The contour settings.
  fillColor Color of contour fill. Set to 0 to disable contour fill. Defaults to 0.
  lineColor Color of contour lines. Set to 0 to disable contour lines. Defaults to 0.
  lineStrength [0..31] The strength of contour lines: 0 is light and 31 is heavy. Defaults to 0.
  materialId The material ID to use if value is Material. Defaults to 0.
returns [not-null] The resulting pixel layer.

Modulate

Modulates the alpha channel of Pixels with the Coverage layer of Heightmap.

method Modulate ()
type IPixelLayer
returns [not-null] The resulting pixel layer.

Shade

Applies a color shade to the target pixels, depending on the elevation values in Heightmap

method Shade (int64 colorFrom, int64 colorTo, float64 elevationFrom, float64 elevationTo, float64 falloff, float64 power = 1)
type IPixelLayer
params colorFrom The color shade at elevationFrom.
  colorTo The color shade at elevationTo.
  elevationFrom The altitude value at the start of the shade interval, according to Vertical of Heightmap.
  elevationTo The altitude value at the start of the shade interval, according to Vertical of Heightmap.
  falloff Length of falloff interval, according to Vertical of Heightmap.
  power Optional exponent to use for transforming the linear blending factor. Defaults to 1.
returns [not-null] The resulting pixel layer.

Remarks:

For shading, terrain altitude values in vertical units are used (see Vertical).