NormalBuffer

Description

sealed class Tinman.Terrain.Buffers.NormalBuffer

Derived from

SampleBufferFloat32 abstract

An implementation of the ISampleBuffer interface that stores normal vectors.

Each normal buffer sample is a tuple of three floating-point values, representing the unit-length normal vector component along the X, Y and Z axis.

Public / Constants

Scanline​Range​Default


public static readonly attribute ScanlineRangeDefault → (PixelRange)

The default value of ISampleBuffer.ScanlineRange.

Public / Constructors

Normal​Buffer


public constructor NormalBuffer → (2)

width in : int32

[>0]
The buffer width, in samples.

height in : int32

[>0]
The buffer height, in samples.

Creates a new instance of NormalBuffer.

Public / Methods

Compute​Normals

2 overloads


public method ComputeNormals1 → (5)

geometry in : IGeometry

[not-null]
The terrain-space geometry to use.

modifier in : IMeshModifier

Optional mesh modifier to use on top of geometry in.

region in : HeightmapRegion

[not-null]
The heightmap region for which to compute terrain-space normal vectors. The region must contain the HeightmapLayer.Elevation layer as well as at least all heightmap layers that are declared by modifier in, if present.

coords in : CubemapFaceCoordsI

The heightmap coordinates of the top-left sample of region in.

step in : int32

The heightmap coordinate step between adjacent samples in region in.

Computes the normal buffer samples (in terrain-space) from the given data.

The relative pixel intensities (red, green, blue) in the range [0..1] are mapped to the unit cube:

red  :[0..1] => X:[-1 .. +1]
green:[0..1] => Y:[-1 .. +1]
blue :[0..1] => Z:[-1 .. +1]

where X, Y and Z correspond to the terrain-space axes, as defined by geometry in.


public method ComputeNormals2 → (2)

buffer in : ElevationBuffer

[not-null]
The elevation buffer.

slope in : SlopeInfo

The slope info to use.

Computes the normal buffer samples (in tangent-space) from the given elevation buffer.

The relative pixel intensities (red, green, blue) in the range [0..1] are mapped to the unit cube:

red  :[0..1] => X:[-1 .. +1]
green:[0..1] => Y:[-1 .. +1]
blue :[0..1] => Z:[-1 .. +1]

where X+ is the tangent direction (positive X-axis), Y+ is the bitangent direction (buffer Y-axis) and Z+ is direction of the surface normal vector.