Semantic

Description

[ShutdownSurvive]
sealed class Tinman.Terrain.Vertices.Semantic

Instances of the Semantic class are used as handles for vertex data container semantics (vertex position, normal vectors, etc.).

The Semantic class defines default semantic handles for common vertex data containers. Applications are free to instantiate additional semantic handles as needed.

See also

VertexArrays

Public / Constants

Area


public static readonly attribute Area → (Semantic)

Per-sector terrain-space area values.

Name: 'Area'
Tuple size: 2
Tuple type: TupleType.Float
Default usage: VertexElementUsage.TextureCoords

Each tuple stores two terrain-space areas, having the following meaning:

  • #0 : area of mesh sector of vertex
    This is the area of the triangles spanned between the center vertex and the left parent, right parent, grand parent and ancestor vertices.

  • #1 : area of mesh neighbourhood of vertex
    This is the area of the triangles spanned between the center vertex and the nearest vertices (according to the current mesh structure) towards the left parent, right parent, grand parent and ancestor vertices.

In addition to level-of-detail computations, the actual mesh sector areas of this semantic can be used instead of approximating them using the bounding sphere radii (see IMeshBoundMinSize, for example).

See also

XDag

Coverage​Flags


public static readonly attribute CoverageFlags → (Semantic)

Coverage flags per vertex.

Name: 'CoverageFlags'
Tuple size: 1
Tuple type: TupleType.Int

The following coverage flags are defined for this semantic:

  • 4 :
    The vertex is solid, i.e. it has been created for a heightmap sample with full coverage. If not preset, the vertex is void, i.e. it represents a heightmap sample with zero coverage. See HeightmapSample.Coverage.

  • 2 :
    The vertex is the center of a mesh sector and there is at least one void vertex in the mesh sector. See CoverageFlags.NotSolid.

  • 1 :
    The vertex is the center of a mesh sector and there is at least one solid vertex in the mesh sector. See CoverageFlags.NotEmpty.

Displacement


public static readonly attribute Displacement → (Semantic)

Terrain-space vertex displacement amount, along base vertex normal vector.

Name: 'Displacement'
Tuple size: 1
Tuple type: TupleType.Float

Displacement​Min​Max


public static readonly attribute DisplacementMinMax → (Semantic)

Holds minimum (see TupleComponent.X) and maximum (see TupleComponent.Y) terrain-space displacement values per mesh sector.

Name: 'DisplacementMinMax'
Tuple size: 2
Tuple type: TupleType.Float

Elevation


public static readonly attribute Elevation → (Semantic)

Terrain-space vertex elevation values.

Name: 'Elevation'
Tuple size: 1
Tuple type: TupleType.Float

Elevation​Min​Max


public static readonly attribute ElevationMinMax → (Semantic)

Holds minimum (see TupleComponent.X) and maximum (see TupleComponent.Y) terrain-space elevation values per mesh sector.

Name: 'ElevationMinMax'
Tuple size: 2
Tuple type: TupleType.Float

Error​Material


public static readonly attribute ErrorMaterial → (Semantic)

Enables the static per-vertex error term based on material tokens that describe the terrain surface (see Material).

Name: 'ErrorMaterial'
Tuple size: 1
Tuple type: TupleType.Float

The error term is given in squared terrain-space.

Error​Normal


public static readonly attribute ErrorNormal → (Semantic)

A static per-vertex error term based on the curvature of the terrain surface (see Normal).

Name: 'ErrorNormal'
Tuple size: 1
Tuple type: TupleType.Float

The error term is given in squared terrain-space.

Error​Position


public static readonly attribute ErrorPosition → (Semantic)

Enables the static per-vertex error term based on the terrain geometry (see Position).

Name: 'ErrorGeometry'
Tuple size: 1
Tuple type: TupleType.Float

The error term is given in squared terrain-space.

Error​Texture


public static readonly attribute ErrorTexture → (Semantic)

A static per-vertex error term based on diffuse colors that describe the terrain surface (see Texture).

Name: 'ErrorTexture'
Tuple size: 1
Tuple type: TupleType.Float

The error term is given in squared terrain-space.

Geographic


public static readonly attribute Geographic → (Semantic)

Geographic latitude (within [-90..90]°, stored in TupleComponent.Y) and longitude (within[-180..180]°, stored in TupleComponent.X).

Name: 'Geographic'
Tuple size: 2
Tuple type: TupleType.Double

Ellipsoid height can be obtained from the Elevation array.

Heightmap​Coords


public static readonly attribute HeightmapCoords → (Semantic)

Vertex heightmap coordinates.

Name: 'HeightmapCoords'
Tuple size: 3
Tuple type: TupleType.Int
Default usage: VertexElementUsage.TextureCoords

Heightmap coordinates are stored with respect to a heightmap of size HeightmapsUtil.MaxSize. Use bit-shifting to translate coordinates to smaller heightmap sizes (see HeightmapsUtil.ComputeShiftToMaxSize).

Horizon


public static readonly attribute Horizon → (Semantic)

Per-vertex horizon.

Name: 'Horizon'
Tuple size: 1
Tuple type: TupleType.Long

When this vertex array and Elevation are present, an ambient occlusion term into will be put into the alpha channel of the diffuse colors in Texture.

Material


public static readonly attribute Material → (Semantic)

Material tokens for the terrain surface (see MaterialToken).

Name: 'Material'
Tuple size: 1
Tuple type: TupleType.Long

Material​Mask


public static readonly attribute MaterialMask → (Semantic)

Nested bitflags of material tokens for the terrain surface.

Name: 'MaterialMask'
Tuple size: 1
Tuple type: TupleType.Long

For each material ID m in the range [0..63], the flag bit 2^m will be set in the bitflag of a vertex iff the material is present somewhere in its mesh sector.

Material​Range


public static readonly attribute MaterialRange → (Semantic)

Nested material weights for the terrain surface.

Name: 'MaterialRange'
Tuple size: 1
Tuple type: TupleType.Int

Please refer to MaterialToken.Range for details on how to interpret the bits of a material weight range value.

Normal


public static readonly attribute Normal → (Semantic)

Vertex normal vectors.

Name: 'Normal'
Tuple size: 3
Tuple type: TupleType.Float
Default usage: VertexElementUsage.Normal

Normal​Base


public static readonly attribute NormalBase → (Semantic)

Vertex base normal vectors.

Name: 'NormalBase'
Tuple size: 3
Tuple type: TupleType.Float
Default usage: VertexElementUsage.Normal

During rendering, an application may choose to interpolate between actual normal vectors and base normal vectors, according to Area, in order to avoid visual aliasing artefacts when zooming out from a highly detailed mesh.

Position


public static readonly attribute Position → (Semantic)

Vertex positions.

Name: 'Position'
Tuple size: 3
Tuple type: TupleType.Double
Default usage: VertexElementUsage.Position

Projected


public static readonly attribute Projected → (Semantic)

Projected coordinates, stored in TupleComponent.X (easting resp. westing) and TupleComponent.Y (northing resp. southing).

Name: 'Projected'
Tuple size: 2
Tuple type: TupleType.Double

Radius


public static readonly attribute Radius → (Semantic)

Vertex bounding sphere radii.

Name: 'Radius'
Tuple size: 1
Tuple type: TupleType.Float

The bounding sphere of a mesh sector contains all bounding spheres of its child mesh sectors (see MeshTree.GetChild.

Tangent​X


public static readonly attribute TangentX → (Semantic)

Vertex tangent vectors along the texture U-axis, not used by terrain meshes.

Name: 'TangentX'
Tuple size: 3
Tuple type: TupleType.Float
Default usage: VertexElementUsage.Tangent

Tangent​Y


public static readonly attribute TangentY → (Semantic)

Vertex tangent vectors along the texture V-axis, not used by terrain meshes.

Name: 'TangentY'
Tuple size: 3
Tuple type: TupleType.Float
Default usage: VertexElementUsage.Tangent

Texture


public static readonly attribute Texture → (Semantic)

Diffuse colors for terrain texture.

Name: 'Texture'
Tuple size: 1
Tuple type: TupleType.Long

Texture​Coords


public static readonly attribute TextureCoords → (Semantic)

Primary vertex texture coordinates.

Name: 'TextureCoords'
Tuple size: 2
Tuple type: TupleType.Float
Default usage: VertexElementUsage.TextureCoords

Texture​Coords​Extra


public static readonly attribute TextureCoordsExtra → (Semantic)

Secondary vertex texture coordinates.

Name: 'TextureCoords'
Tuple size: 2
Tuple type: TupleType.Float
Default usage: VertexElementUsage.TextureCoords

Version


public static readonly attribute Version → (Semantic)

Version counter that indicates structural changes of each terrain mesh sector.

Name: 'Version'
Tuple size: 1
Tuple type: TupleType.Int

The version of a vertex is incremented if one of the following happens inside of its mesh sector:

  • A new vertex is added.

  • An existing vertex is updated.

Public / Constructors

Semantic


public constructor Semantic → (4)

name in : string

[not-null]
The name of the semantic object.

tupleSize in : int32

[1..4]
The tuple size.

tupleType in : TupleType

The tuple type.

defaultUsage opt : VertexElementUsage = VertexElementUsage.Unknown

The default GPU usage or VertexElementUsage.Unknown if the semantic is not intended for being used on the GPU.

Creates a new instance of Semantic.

The maximum number of Semantic objects that may be created is 256.

Public / Methods

Create​Vertex​Data


public method CreateVertexData → (1)

capacity in : int32

[>0]
The capacity of the container, in vertices.

returns → IVertexArray

The created container.

Creates a new vertex data container for this semantic.

Public / Attributes

All


public static attribute All → (get)

value : Semantic [ ]

[not-null]
A list of all Semantic objects.

Returns all existing Semantic objects.

Default​Usage


public attribute DefaultUsage → (get)

value : VertexElementUsage

The default GPU usage or VertexElementUsage.Unknown if this Semantic is not intended for being used on the GPU.

Returns the default VertexElementUsage for this Semantic.

Id


public attribute Id → (get)

value : int32

[0..255]
The unique identifier of this semantic object.

The ID of this semantic object.

Name


public attribute Name → (get)

value : string

[not-null]
The semantic name.

The name of this vertex data container semantic.

Tuple​Size


public attribute TupleSize → (get)

value : int32

[1..4]
The tuple size.

The tuple size.

Tuple​Type


public attribute TupleType → (get)

value : TupleType

The tuple type.

The tuple element type.