TerrainChunk

Description

sealed class Tinman.AddOns.Export.TerrainChunk

Full source code is included in the Tinman 3D SDK download.

Provides information about a terrain mesh chunk.

Public / Methods

Compute​Blend


[Pure]
public method ComputeBlend → (2)

distance in : float32

The distance between the camera and the point for which to compute the blend factor.

uv in : Vec2F

The texture coordinates of the point for which to compute the blend factor.

returns → float32

The blend factor: 0 means that the terrain mesh chunk is not visible at the point, 1 means that the terrain mesh chunk is fully visible.

Computes the blend factor for the given camera distance and texture coordinates.

Compute​UV


[Pure]
public method ComputeUV → (1)

point in : Vec3F

The point, in the local coordinate system of the terrain mesh chunk.

returns → Vec2F

The UV texture coordinates.

Computes the texture coordinates of the given point.

Public / Attributes

Blend0


public readonly attribute Blend0 → (Vec4F)

Blend1


public readonly attribute Blend1 → (Vec4F)

Heightmap​Coordinates


public readonly attribute HeightmapCoordinates → (Mat4D)

The transformation matrix texture coordinates for unique texturing to cubemap heightmap coordinates (see Cubemap) relative to the maximum size (see MappingUtil.MaxSize)).

Material​Coordinates


public readonly attribute MaterialCoordinates → (Mat4F)

The transformation matrix from the local coordinate system of the terrain mesh chunk to texture coordinates for material-based texturing.

Terrain​Coordinates


public readonly attribute TerrainCoordinates → (Mat4D)

The transformation matrix from the local coordinate system of the given terrain mesh chunk to the terrain coordinate system.

The local coordinate system of a terrain mesh chunk is defined as follows:

  • X+
    Aligned with terrain side-vector at the given coordinates.
    side = cross(up, north).
    The side vector points westwards for CartesianHandedness.RightHanded and eastwards for CartesianHandedness.LeftHanded.

  • Y+
    Aligned with terrain up-vector at the given coordinates.

  • Z+
    Perpendicular to side-vector and up-vector, pointing northwards.

  • The coordinate origin is near to the center of the pyramid tile, but does not necessarily coincide with it.

Texture​Coordinates


public readonly attribute TextureCoordinates → (Mat4F)

The transformation matrix from the local coordinate system of the terrain mesh chunk to approximated texture coordinates for unique texturing.

The matrix transforms a point (X,Y,Z) in the local coordinate system into a point (U,E,V) in the unit-cube, where U and V are the approximated texture coordinates (suitable for rendering, potentially unsuited for accurate geo-referencing) and E represents the relative elevation (0 for minimum possible elevation, 1 for maximum possible elevation).

Tile


public readonly attribute Tile → (PyramidCoords)

The pyramid tile coordinates of the terrain mesh chunk.