MeshTreeFilter

Description

sealed class Tinman.Terrain.Kernel.MeshTreeFilter

The MeshTreeFilter class maintains a hierarchical set of mesh sector flags, to be used during mesh traversal.

Processing of a mesh begins with the full mesh structure (i.e. the current state of tessellation, see MeshBuffer.MeshUpdate). The following figure illustrates the sector hierarchy of an example mesh structure:

                    .---.
                    | R |
                    `---´
           ___________|___________
          |       |       |       |
        .---.   .---.           .---.
        |   |   |   |     X     |   |
        `---´   `---´           `---´
   _______________|_______        |_______________________
  |       |       |       |       |       |       |       |
.---.   .---.   .---.           .---.   .---.   .---.   .---.
|   |   |   |   |   |     X     |   |   |   |   |   |   |   |
`---´   `---´   `---´           `---´   `---´   `---´   `---´
   _______________|_______         _______|_______________
  |       |       |       |       |       |       |       |
.---.   .---.   .---.   .---.   .---.   .---.   .---.
|   |   |   |   |   |   |   |   |   |   |   |   |   |     X
`---´   `---´   `---´   `---´   `---´   `---´   `---´

The sector R is the root of a cubemap face. Sectors marked with X do not exist (see XDag.Null). Calling the MeshTree.SectorMark method will place an explicit mark on the given mesh sector (see sectors tagged with M in the figure below). The ancestors of a mesh sector with an explicit mark receive an implicit mark (see sectors tagged with !):

                    .---.
                    | ! |
                    `---´
           ___________|___________
          |       |       |       |
        .---.   .---.           .---.
        |   |   | ! |     X     | ! |
        `---´   `---´           `---´
   _______________|_______        |_______________________
  |       |       |       |       |       |       |       |
.---.   .---.   .---.           .---.   .---.   .---.   .---.
|   |   |   |   | ! |     X     |   |   | M |   |   |   |   |
`---´   `---´   `---´           `---´   `---´   `---´   `---´
   _______________|_______         _______|_______________
  |       |       |       |       |       |       |       |
.---.   .---.   .---.   .---.   .---.   .---.   .---.
|   |   | M |   |   |   | M |   |   |   |   |   |   |     X
`---´   `---´   `---´   `---´   `---´   `---´   `---´

The marks of a mesh sector can be queried with MeshTree.HasMark, MeshTree.HasMarkExplicit and MeshTree.HasMarkImplicit. Mesh sectors can also be culled away using the MeshTree.SectorCull method or by culling all existing children. Culled mesh sectors are reported as XDag.Void. The following figure shows the result of culling all mesh sectors marked with M in the figure above:

                    .---.
                    |   |
                    `---´
           ___________|___________
          |       |       |       |
        .---.   .---.           .---.
        | S |   |   |    Null   |   |
        `---´   `---´           `---´
   _______________|_______        |_______________________
  |       |       |       |       |       |       |       |
.---.   .---.   .---.           .---.           .---.   .---.
| S |   | S |   |   |    Null   | S |    Void   | S |   | S |
`---´   `---´   `---´           `---´           `---´   `---´
   _______________|_______
  |       |       |       |
.---.           .---.
| S |    Void   | S |    Void
`---´           `---´

The mesh sectors marked with S are solid, i.e. they do not have any descendants that have been culled away. The solid flag can be queried using MeshTree.IsSolid.

Public / Constructors

MeshTreeFilter


public constructor MeshTreeFilter → ()

Creates a new instance of MeshTreeFilter.

Public / Methods

Reset


public method Reset → (1)

other opt : MeshTreeFilter = null

The filter to use for resetting the flags of this filter or null to clear all flags.

Resets the flags in this filter.