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

struct TexturingBatch in Tinman.Terrain.Meshing

A batch for smooth texturing of a mesh sector.

struct TexturingBatch implements IComparable<TexturingBatch>
  IEquatable<TexturingBatch>

Remarks

TexturingBatch values have this sort order:

  1. TextureIndex of BaseTexture in Atlas (ascending)
  2. TextureIndex of Texture in Atlas (ascending)

Public / Attributes

Atlas

The associated TextureAtlas object.

public readonly field Atlas
type TextureAtlas

BaseSector

The parent mesh sector.

public readonly field BaseSector
type int32

BaseTexture

The base texture to use, as returned by TileLookup.

public readonly field BaseTexture
type int32

Batch

The mesh sector batch.

public readonly field Batch
type SectorBatch

Blend0

Coefficient vector for distance-based texture tile blending on the GPU.

public readonly field Blend0
type Vec4F

Remarks:

Tile blending is necessary in order to avoid visible artifacts due to swapping of texture tiles; it can be performed on the GPU with the Blend0 and Blend1 coefficients according to this formula:

        /    1 \
        |    u |
f     = |    v | * (Blend0 / x + Blend1)
        \  u*v /

pixel = (1 - f) * S0 + (factor) * S1;

Values on the GPU:

    u, v   : texture coordinates
    x      : Distance between camera and vertex
    S0     : Sample of parent texture tile
    S1     : Sample of child texture tile
    Blend0 : Shader constant (per-texture state)
    Blend1 : Shader constant (per-texture state)
The texture coordinates u and v have been set up with TileSetup and been computed on the GPU as described there. The blend factor f can optionally be modified by a smoothstep function (e.g. SmootherStep). This will make the transition slope steeper at the center. Additionally, the texture tile age (see TileFadeReset and TileFadeFactor) can be used to fade in freshly loaded tiles.

Blend1

Coefficient vector for distance-based texture tile blending on the GPU.

public readonly field Blend1
type Vec4F

Remarks:

See remarks of Blend0 for details.

Coords

The pyramid tile coordinates of this texturing batch.

public readonly field Coords
type PyramidCoords

Texture

The texture to use, as returned by TileLookup.

public readonly field Texture
type int32

Public / Methods

CompareTo

public method CompareTo (TexturingBatch other)
type int32
params other

Equals

public method Equals (TexturingBatch other)
type bool
params other