Triangulation

Description

sealed class Tinman.Terrain.Meshing.Triangulation

Derived from

MeshTraversal abstract

The Triangulation class traverses the filtered mesh (see IMeshFilters.FilterIn) and generates a TriangulationBatch for each mesh sector that has been marked explicitly (see MeshTree.SectorMark).

The output of triangulation is a sequence of index values, which represent graphics primitives of a uniform type (see TriangleMode). The index value sequence is divided into slices. Triangulation batch are built from slice ranges; this makes it possible to change the change triangle mode after triangulation has been performed.

Public / Constructors

Triangulation


public constructor Triangulation → ()

Creates a new instance of Triangulation.

Public / Methods

Decode


public method Decode → (3)

result in : TriangulationBuffer

The triangulation buffer that has been passed to Triangulate, in order to receive the triangulation results.

flip opt : bool = false

Flip triangle winding?

buffer opt : ArrayVector<int32> = null

Optional output buffer to use.

returns → ArrayVector<int32>

The decoded triangle list.

Decodes the triangulation result into a TriangleMode.TriangleList.

Get​Batch​For​Mesh


public method GetBatchForMesh → ()

returns → TriangulationBatch

The triangulation batch or TriangulationBatch.Empty if none.

Returns a TriangulationBatch for the whole mesh.

Get​Batch​For​Slice


[Pure]
public method GetBatchForSlice → (1)

slice in : RangeI

The triangulation slice range.

returns → TriangulationBatch

The triangulation batch or TriangulationBatch.Empty if none.

Returns a TriangulationBatch for the given slice range.

Get​Slice​For​Quadrant


[Pure]
public method GetSliceForQuadrant → (2)

sector in : int32

The mesh sector.

quadrant in : int32

The mesh sector quadrant index.

returns → RangeI

The triangulation slice range.

Returns the triangulation slice range for the given mesh sector quadrant.

Slice ranges are independent of the used triangle mode (see TriangleMode).

Get​Slice​For​Sector


[Pure]
public method GetSliceForSector → (1)

sector in : int32

The mesh sector.

returns → RangeI

The triangulation slice range.

Returns the triangulation slice range for the given mesh sector.

Slice ranges are independent of the used triangle mode (see TriangleMode).

Invalidate


public method Invalidate → ()

Invalidates the current triangulation, so that the next call to Validate returns false.

Triangulate


public method Triangulate → (1)

buffer in : TriangulationBuffer

[not-null]
The triangulation buffer to use.

Performs mesh triangulation while keeping track of vertex index ranges that can be used to render individual mesh sectors later.

Validate


public method Validate → (1)

buffer in : TriangulationBuffer

[not-null]
The triangulation buffer that holds the triangulation.

returns → bool

true if the mesh triangulation is still valid, false if the mesh must be triangulated again.

Checks if the current triangulation is still valid.

A mesh triangulation that has been created by calling Triangulate can be used as long as Validate returns true. Then it must be recreated. The return value of Validate can change because of mesh updates (see MeshBuffer.MeshUpdate) and because of mesh traversal (e.g. culling).

Public / Attributes

Batch​Primitive


public attribute BatchPrimitive → (get)

value : Primitive

The graphics primitive.

The graphics primitive of generated triangulation batches.

Filter​In


public attribute FilterIn → (get,set)

value : MeshTreeFilter

The filter or null.

The mesh tree input filter to use for querying sector culling and marks.

The default value is null (i.e. all mesh sectors are visited).

Is​Batch​Indirect


public attribute IsBatchIndirect → (get)

value : bool

true if indirect draw commands will be used, false if not.

Will generated triangulation batches issue indirect draw commands?

Slices


public attribute Slices → (get)

value : IArrayVector<int32>

[not-null]
The triangulation slices.

Returns the triangulation slices.