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

class Texturing in Tinman.Terrain.Meshing

The Texturing class traverses the filtered mesh (see FilterIn), generates zero or more TexturingBatch values for each mesh sector and puts an explicit mark on it (see SectorMark), if it has at least one batch.

sealed class Texturing implements IBatchRenderer<TexturingBatch, TexturingBatch>
  IMeshBoundDistance
  IOpaque
  ITextureCacheDependent
  IViewportDependent
  extends MeshTraversal

Remarks

The mesh sector hierarchy is analysed and TexturingBatch es are assigned to mesh sectors. Each mesh sector that receives a TexturingBatch also gets an explicit mark via SectorMark on the output filter ( FilterOut).

The following vertex data semantics are used by this class:

Public / Attributes

BatchCount

Returns the current number of rendering batches that are buffered by this object.

public property BatchCount { get }
type int32
value [>=0] The number of rendering batch elements.
implements IBatchContainerBase.BatchCount

See also:

IBatchContainer.GetBatch

CameraInfo

The object that provides the current camera position.

public property CameraInfo { get set }
type CameraInfo
value [not-null] The camera position provider.
implements ICameraInfoDependent.CameraInfo

Distance

Skips mesh sectors that are outside of the specified distance range.

public property Distance { get set }
type float64
value The distance value (see remarks).
implements IMeshBoundDistance.Distance

Remarks:

A mesh sector is skipped if:

sign(Distance) * length(C - P) - R > Distance
where C is the camera position, P is the position of the mesh sector center vertex and R is the radius of the bounding sphere of the mesh sector.

FilterIn

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

public property FilterIn { get set }
type MeshTreeFilter
value The filter or null.
inherited MeshTraversal.FilterIn

Remarks:

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

See also:

MeshTree.GetRoot
MeshTree.GetChild
MeshTree.GetDown

FilterOut

The mesh tree output filter to use for performing sector culling and marking.

public property FilterOut { get set }
type MeshTreeFilter
value The mesh tree filter object.
inherited MeshTraversal.FilterOut

Remarks:

This MeshTreeFilter is not reset automatically. The application is responsible to call Reset.

The default value is null (i.e. the input filter is used in that case).

See also:

MeshTree.SectorCull
MeshTree.SectorMark
MeshTree.SectorMarkRoots

HasMesh

Has this object been bound to an IMesh object?

public property HasMesh { get }
type bool
value true if this object is currently bound to an IMesh, false if not.
inherited MeshBoundBase.HasMesh

Mesh

The CLOD mesh this object is currently bound to.

public property Mesh { get }
type IMesh
value The CLOD mesh or null.
inherited MeshBoundBase.Mesh

MipmapOffset

The texture mipmap offset can be used to fine-tune the texture output.

public property MipmapOffset { get set }
type float32
value The level-of-detail of texture tiles. Setting this to 0 means that each texel will cover one pixel (approximately). Defaults to 0.

Remarks:

The texture detail setting controls the overall texture detail; it is given as the logarithm base four of the number of pixels per texel:

...
  -2 = log(4^  -2) / log(4)  :  ~0.0625 pixel/texel  (mipmap level   - 2)
  -1 = log(4^  -1) / log(4)  :  ~0.25   pixel/texel  (mipmap level   - 1)
-0.5 = log(4^-0.5) / log(4)  :  ~0.5    pixel/texel
   0 = log(4^   0) / log(4)  :  ~1      pixel/texel  (mipmap level +/- 0)
 0.5 = log(4^ 0.5) / log(4)  :  ~2      pixel/texel
   1 = log(4^   1) / log(4)  :  ~4      pixel/texel  (mipmap level +   1)
   2 = log(4^   2) / log(4)  :  ~16     pixel/texel  (mipmap level +   2)
 ...

Opaque

Use opaque texturing mode?

public property Opaque { get set }
type bool
value true to use opaque texturing, false to use sparse texturing.
implements IOpaque.Opaque

Remarks:

In opaque mode, missing areas (see Empty and Void) are covered with the texture of the parent mesh sector quadrant. In non-opaque mode, missing areas are not rendered.

Opaque mode is usually used for surface imagery that has varying levels of detail, where the best available level of detail needs to be used for rendering.

Non-opaque mode can be used for rasterized vector shapes, where only the most detailed level is rendered.

Defaults to true.

Progress

The progress indicator for background loading of texture tiles.

public property Progress { get }
type int32
value [0..100] The progress, in percent.

Remarks:

The returned value is updated each time the ComputeBatches method is called. A value of 100% means that all texture tiles are ready. Lower values indicates how many texture tiles are being loaded in the background.

TextureCache

The TextureCache that is used.

public property TextureCache { get }
type TextureAtlas
value The used TextureCache object.
implements ITextureCacheDependent.TextureCache

See also:

ITextureCacheDependent.SetTexture

TextureId

The texel pyramid that is used.

public property TextureId { get }
type int32
value The texel pyramid ID (see PyramidIdAllocate).
implements ITextureCacheDependent.TextureId

See also:

ITextureCacheDependent.SetTexture

Tree

The filtered MeshTree of this mesh traversal object.

public property Tree { get }
type MeshTree
value [not-null] The filtered MeshTree object or null if this object is not bound.
inherited MeshTraversal.Tree

Viewport

The current viewport object.

public property Viewport { get set }
type Viewport
value [not-null] The viewport object.
implements IViewportDependent.Viewport

Public / Constructors

Texturing

Creates a new instance of Texturing.

public constructor Texturing ()

Public / Methods

ClearBatches

Clears all batches.

public method ClearBatches ()
implements IBatchRendererBase.ClearBatches

ComputeBatches

Computes the render batches.

public method ComputeBatches ()
implements IBatchRendererBase.ComputeBatches

GetBatch

Returns the index-th rendering batch.

public method GetBatch (int32 index)
type TexturingBatch
params index [0..BatchCount-1] Index of rendering batch to return.
returns The rendering batch.
implements IBatchContainer.GetBatch

Remarks:

Usually, the sort order of batches is well-defined, in order to minimize state changes when processing batches first to last. Please refer to the documentation of the respective batch type for details.

MeshBind

Binds this object to the given IMesh.

public override method MeshBind (IMesh mesh)
params mesh The mesh object.
overrides MeshTraversal.MeshBind

MeshUnbind

Unbinds this object from its current IMesh.

public override method MeshUnbind ()
overrides MeshBoundBase.MeshUnbind

RenderBatches

Renders all batches using the given renderer.

public method RenderBatches (Triangulation triangulation, IPrimitiveRenderer renderer, BatchDelegate<TexturingBatch> callback = null, int32 tag = 0)
params triangulation [not-null] The mesh triangulation object.
  renderer [not-null] The primitive renderer to use.
  callback Optional render state callback to use. Defaults to null.
  tag A user-defined value that will be passed to the callback. Defaults to 0.
implements IBatchRenderer.RenderBatches

SetTexture

Specifies the texture atlas and texel pyramid to use.

public method SetTexture (TextureAtlas textureAtlas, int32 pyramidId = 0)
params textureAtlas The texture atlas to use or null if there is no GPU context.
  pyramidId The texel pyramid ID to use (see PyramidIdAllocate). Defaults to 0.
implements ITextureCacheDependent.SetTexture

UpdateSectorBatch

public method UpdateSectorBatch (TexturingBatch current, SectorBatch updated)
type TexturingBatch
params current
  updated

VisitFaces

Visits the given mesh root sectors.

public method VisitFaces (CubemapFace meshFace = CubemapFace.All)
params meshFace The mesh face to traverse. Defaults to All.
inherited MeshTraversal.VisitFaces

VisitQuadrant

Visits a quadrant of the given mesh sector on the current face, assuming that the corresponding child mesh sector does not exist.

public override method VisitQuadrant (int32 sector, int32 childIdx)
params sector Index of center vertex of sector to visit.
  childIdx Index of non-existing child sector in sector.
implements MeshTraversal.VisitQuadrant

Remarks:

The quadtree data structure for visiting the given sector can be obtained by getting the Tree property of the current mesh (see MeshBind.

VisitSector

Visits the given mesh sector on the current face.

public override method VisitSector (int32 sector)
params sector Index of center vertex of sector to visit.
implements MeshTraversal.VisitSector

Remarks:

The quadtree data structure for visiting the given sector can be obtained by getting the Tree property of the current mesh (see MeshBind.