interface Tinman.Terrain.Kernel.IMeshDynamic

Derived from


Base interface for dynamic continuous level-of-detail terrain meshes that perform view-dependent refinement at runtime.

The terrain mesh version (see IVersioned.Version) is incremented during MeshBuffer.MeshUpdate if the mesh structure has changed since the last call.

Dynamic CLOD meshes can be used to generate static terrain meshes: an application may create an instance of IMeshDynamic, poll until it reaches the RefinementStatus.Finished status and then extract vertex data (see IMesh.Vertices) and triangulation data (see IMesh.Triangulator). Refinement of CLOD meshes is not always deterministic, please refer to MeshBuffer for details. For fully deterministic behaviour (for example in a content pipeline), consider using MeshChunkBuilder instead.

Public / Methods


public method DirtyRegion → (6)

x1 in : int32

Minimum heightmap X-coordinate (inclusive).

x2 in : int32

Maximum heightmap X-coordinate (inclusive).

y1 in : int32

Minimum heightmap Y-coordinate (inclusive).

y2 in : int32

Maximum heightmap Y-coordinate (inclusive).

z1 opt : int32 = 0

Minimum heightmap Z-coordinate (inclusive).

z2 opt : int32 = 0

Maximum heightmap Z-coordinate (inclusive).

Marks the given heightmap coordinate region as dirty.


public method Resume → ()

Resumes background refinement.

This method must be called iff AutoPause has been set to true and background refinement has finished (i.e. when Status is RefinementStatus.Paused). Otherwise, refinement will not continue and the mesh structure will remain unchanged, even if the parameters of the visibility criterion are changed.

If this method is called in other cases it performs no action and silently returns.

Public / Attributes


public attribute AutoPause → (get,set)

value : bool

true if refinement shall be paused when it has finished, false to keep background refinement active even if an optimal mesh structure has been reached.

Shall refinement be paused when it has finished?

When the background refinement has been paused, the application must explicitly resume it by calling Resume (usually when the visibility criterion parameters have changed).

Defaults to false.


public attribute Buffer → (get)

value : MeshBuffer

The owning mesh buffer.

The mesh buffer that owns this mesh.


public attribute Locality → (get)

value : float64

The cache-locality, see remarks.

Returns the estimate cache-locality of the terrain.

A hypothetical cache page size of 64 vertices is assumed. During mesh refinement, the number of hit cache pages are counted, as well as the number of visited vertices. The cache-locality is then computed as follows:

Locality = PageCount * PageSize / VertexCount


public attribute Progress → (get)

value : int32

The refinement progress, in percent.

Returns the estimate progress of the refinement, in percent.

A value of 100 means that refinement has reached an optimal mesh structure, i.e. no more vertices will be added to or removed from any terrain meshes.


public attribute QualityThreshold → (get,set)

value : float64

The quality threshold value.

The quality setting for mesh refinement.

The quality threshold value is passed to the IVisibleCheck.IsVertexVisible method of the meshes Visibility check. Quality increases with smaller threshold values. The interpretation of this value depends on the used visibility check (e.g. screen-space pixels or terrain-space units). The default value is 2.5.


public attribute Status → (get)

value : RefinementStatus

The current refinement status.

Returns the current refinement status.


public attribute Visibility → (get,set)

value : IVisibleCheck

The visibility check.

The vertex visibility check that is used for mesh refinement.

The given IVisibleCheck object will be handed over to the refinement thread in a thread-safe manner. Then the IVertexArraysDependent.SetVertexArrays will be called once and the IVisibleCheck.IsVertexVisible method will be called repeatedly by the refinement thread. The implementation of IVisibleCheck should not allow modifications (thus making instances inherently thread-safe). Otherwise, the implementation is responsible for providing proper thread synchronization.


public attribute VisibleCount → (get)

value : int32

The number of visible mesh vertices.

Returns the number of visible mesh vertices.


public attribute VisibleThreshold → (get,set)

value : int32

The target visible count.

Specifies the target visible vertex count for mesh refinement.

When the target visible vertex count is greater than zero, mesh refinement automatically adjusts the internal quality threshold value, in order to reach resp. maintain the target visible vertex count. In this case, the configured quality threshold (see QualityThreshold) is used as the lower boundary; i.e. the internal value will always be greater than or equal to the configured value.

Defaults to 0.



2 overloads

public static method DirtyRegion1 → (1)

region in : Box2I

The heightmap coordinate region.

Marks the given heightmap coordinate region as dirty.

public static method DirtyRegion2 → (1)

region in : Box3I

The heightmap coordinate region.

Marks the given heightmap coordinate region as dirty.