VertexFormat

Description

sealed class Tinman.Terrain.Vertices.Formats.VertexFormat

Derived from

VertexFormatBase abstract

Default implementation of the IVertexFormat interface.

Public / Constructors

Color


[Pure]
public static method Color → (3)

semantic in : Semantic

The Semantic to source data from. If null, Semantic.Texture will be used.

component opt : TupleComponent = TupleComponent.X

The tuple component to read.

element opt : VertexElement = null

The vertex element to write. If null, VertexElement.DefaultColor will be used.

returns → IVertexComponent

The vertex component.

Returns a IVertexComponent for a single vertex element that reads color values from the vertex array of the given semantic in, converts them to linear sRGB color values and passes them to IVertexElementWriterBase.WriteVertexElementFloat.

Color value are read from the given vertex array (see semantic in) using either:

The linear sRGB color values in the range [0..1] are passed to the vertex writer in the following order: red as x, green as y, blue as z. The linear alpha value is passed to w.

Coordinates


[Pure]
public static method Coordinates → (4)

semantic in : Semantic

[not-null]
The Semantic to source data from.

maximum in : int32

The maximum coordinate value.

mask in : int32

The bitmask that depicts the significant value bits.

element opt : VertexElement = null

The vertex element to write. If null, the following vertex element will be used:

returns → IVertexComponent

The vertex component.

Returns a IVertexComponent for a single vertex element that reads unsigned integer coordinates of type TupleType.Int from the vertex array of the given semantic in, applies a coordinate precision fix plus normalization and passes the resulting values to IVertexElementWriterBase.WriteVertexElementFloat.

Coordinate values are read from the vertex array using the IVertexArray.GetI method, clamped to the range [0..maximum], combined with the given mask in using bitwise AND and normalized to [0..1] by dividing them by maximum in. The resulting values are passed to IVertexElementWriterBase.WriteVertexElementFloat

Float


[Pure]
public static method Float → (2)

semantic in : Semantic

[not-null]
The Semantic to source data from.

element opt : VertexElement = null

The vertex element to write. If null, the following vertex element will be used:

returns → IVertexComponent

The vertex component.

Returns a IVertexComponent for a single vertex element which reads TupleType.Float values from the vertex array of the given semantic in and passes them to IVertexElementWriterBase.WriteVertexElementFloat.

Float​Delta


[Pure]
public static method FloatDelta → (2)

semantic in : Semantic

[not-null]
The Semantic to source data from.

element opt : VertexElement = null

The vertex element to write. If null, the following vertex element will be used:

returns → IVertexComponent

The vertex component.

Returns a IVertexComponent for a single vertex element which reads TupleType.Double values from the vertex array of the given semantic in, computes the float-deltas and passes them to IVertexElementWriterBase.WriteVertexElementFloat.

The float-delta of a TupleType.Double value is defined as follows:

delta = (float) (value - (float) value)

Heightmap​Coordinates


[Pure]
public static method HeightmapCoordinates → ()

returns → IVertexComponent

The vertex component.

Convenience method that calls Coordinates.

Semantic: Semantic.HeightmapCoords
Maximum: HeightmapsUtil.MaxCoord
Bitmask: ~0.

Heightmap​Coordinates​High


[Pure]
public static method HeightmapCoordinatesHigh → ()

returns → IVertexComponent

The vertex component.

Convenience method that calls Coordinates.

Semantic: Semantic.HeightmapCoords
Maximum: HeightmapsUtil.MaxCoord
Bitmask: ~0x7FFF.

Heightmap​Coordinates​Low


[Pure]
public static method HeightmapCoordinatesLow → ()

returns → IVertexComponent

The vertex component.

Convenience method that calls Coordinates.

Semantic: Semantic.HeightmapCoords
Maximum: HeightmapsUtil.MaxCoord
Bitmask: 0x7FFF.

Material


[Pure]
public static method Material → (5)

material0 opt : int32 = 0

The material weight to put into the first value.

material1 opt : int32 = 1

The material weight to put into the second value.

material2 opt : int32 = 2

The material weight to put into the third value.

material3 opt : int32 = 3

The material weight to put into the fourth value.

element opt : VertexElement = null

The vertex element to write. If null, the following vertex element will be used:

returns → IVertexComponent

The vertex component.

Returns a IVertexComponent for a single vertex element that reads material tokens from the Semantic.Material vertex array and passes the material weights for the given materials (see MaterialToken.WeightFor) to IVertexElementWriterBase.WriteVertexElementInt.

See also

MaterialToken

Material​Id


[Pure]
public static method MaterialId → (1)

element opt : VertexElement = null

The vertex element to write. If null, the following vertex element will be used:

returns → IVertexComponent

The vertex component.

Returns a IVertexComponent for a single vertex element that reads material tokens from the Semantic.Material vertex array and passes the material IDs (see MaterialToken.MaterialAt) to IVertexElementWriterBase.WriteVertexElementInt.

See also

MaterialToken

Material​Weight


[Pure]
public static method MaterialWeight → (1)

element opt : VertexElement = null

The vertex element to write. If null, the following vertex element will be used:

returns → IVertexComponent

The vertex component.

Returns a IVertexComponent for a single vertex element that reads material tokens from the Semantic.Material vertex array and passes the material weights (see MaterialToken.WeightAt) to IVertexElementWriterBase.WriteVertexElementInt.

See also

MaterialToken

Placeholder


[Pure]
public static method Placeholder → (1)

usage in : VertexElementUsage

The vertex element usage.

returns → IVertexComponent

The vertex component.

Returns an empty IVertexComponent that acts as a placeholder for the given usage.