This interface provides quad-tree like access to the structure of a CLOD mesh.
sealed class
|
MeshTree
|
The structure of a CLOD mesh is a directed acyclic graph of vertices and links and can be interpreted as a quadtree. The MeshTree interface provides access to this quadtree.
The MeshTree object of a CLOD IMesh can be used to implement hierarchical traversal algorithms, such as frustum culling, picking and collision detection.
Each
face
of
a
mesh
represents
the
root
node
of
a
quadtree
(see
GetRoot).
The
GetChild*
methods
can
be
used
to
traverse
the
quadtree
hierarchy.
A
quadtree
node
is
equivalent
to
a
mesh
sector
which
is
referred
to
using
the
index
of
its
center
vertex.
So
the
vertex
index
values
using
with
this
class
can
also
be
used
to
access
vertex
data
arrays.
The following figures illustrates the concept of parent/child sectors and parent index values:
Pidx(S) = 3 Pidx(S) = 2 +--------+--------+ +--------+--------+ | | | | | | | C(3) | C(2) | | (C0) | (C3) | | | | | | | +-------(S)-------+ +-------(S)-------+ | | | | | | | C(0) | C(1) | | (C1) | (C2) | | | | | | | +--------+-------(P) (P)-------+--------+ Pidx(S) = 0 Pidx(S) = 1 +--------+-------(P) (P)-------+--------+ | | | | | | | (C2) | (C1) | | (C1) | (C0) | | | | | | | +-------(S)-------+ +-------(S)-------+ | | | | | | | (C3) | (C0) | | (C2) | (C3) | | | | | | | +--------+--------+ +--------+--------+ C(0) := S.LL.LL = S.L[L.L]L = S.LLL = S.L[L]L => LL = 0 C(1) := S.LL.LR = S.L[L.L]R = S.LLR = S.L[L]R => LR = 1 C(2) := S.RL.LL = S.R[L.L]L = S.RLL = S.R[L]L => RL = 2 C(3) := S.RL.LR = S.R[L.L]R = S.RLR = S.R[L]R => RR = 3where
(P)
is
the
center
vertex
of
the
parent
sector,
(S)
is
the
center
vertex
of
the
current
sector,
C(n)
is
the
center
vertex
of
the
n-th
child
vertex
with
n
being
the
child
index
and
Pidx(S)
is
the
child
index
of
(S)
in
(P)
.
See also:
XDagReturns an MeshTree object which represents the mesh structure filtered by the given filter.
public
method
|
Filter
(MeshTreeFilter filterIn,
MeshTreeFilter filterOut = null)
|
||
type
|
MeshTree
|
||
params
|
filterIn
|
Optional
input
filter
to
use.
Defaults
to
null . |
|
filterOut
|
Optional
output
filter
to
use.
Defaults
to
null . |
||
returns
|
|
The resulting MeshTree object. |
Remarks:
Specifying the same MeshTreeFilter instance multiple times will result in a single filtered MeshTree instance. A MeshTreeFilter object must only be used with one MeshTree object.
Returns a child of the given mesh sector.
[Pure]
|
||||
public
method
|
GetChild
(int32 sector,
int32 child)
|
|||
type
|
int32
|
|||
params
|
sector
|
The mesh sector. | ||
child
|
Index
of
child
sector
in
the
range
[0..3] . |
|||
returns
|
Index of child sector center or Null if the child sector does not exist or Void if the child sector has been culled away. |
See also:
SectorCullReturns the four corner vertices of the given sector.
[Pure]
|
||||
public
method
|
GetCorners
(int32 sector)
|
|||
type
|
Vec4I
|
|||
params
|
sector
|
The mesh sector. | ||
returns
|
The four corner vertices of the mesh sector. |
Remarks:
The returned vector has the following meaning:
Returns a downwards vertex link.
[Pure]
|
||||
public
method
|
GetDown
(int32 vertex,
int32 link)
|
|||
type
|
int32
|
|||
params
|
vertex
|
The mesh vertex. | ||
link
|
One of LL, LR, RL and RR. | |||
returns
|
Index of linked vertex or Null if the vertex does not exist or Void if the vertex has been culled away. |
See also:
SectorCullReturns a downwards vertex link.
[Pure]
|
||||
public
method
|
GetDownForce
(int32 sector,
int32 link)
|
|||
type
|
int32
|
|||
params
|
sector
|
Index of mesh sector center. | ||
link
|
One of LL, LR, RL and RR. | |||
returns
|
Index of linked vertex or Void if the vertex does not exist. |
Returns the child index of the given sector in its parent sector.
[Pure]
|
||||
public
method
|
GetIndex
(int32 sector)
|
|||
type
|
int32
|
|||
params
|
sector
|
The mesh sector. | ||
returns
|
|
Child index of sector in its parent sector. |
See also:
GetParentReturns the orientation of the given mesh sector.
[Pure]
|
||||
public
static
method
|
GetOrientation
(Vec4I corners,
Int3 heightmapCoords,
CubemapFace face = CubemapFace.NegZ)
|
|||
type
|
int32
|
|||
params
|
corners
|
The mesh sector corners (see GetCorners). | ||
heightmapCoords
|
The heightmap coordinates (see HeightmapCoords). | |||
face
|
The cubemap face. Defaults to NegZ. | |||
returns
|
|
The orientation code (see remarks). |
Remarks:
The orientation of the mesh sector is computed relative to the face coordinates of the cubemap coordinates of its corner vertices:
o--> face X-coordinates | V face Y-coordinates #0: #1: #2: #3: #4: #5: #6: #7: A R A L L G R G R A L A G L G R L G R G A R A L G L G R R A L A 0x1 := diagonal flip (along line from A to G)? 0x2 := vertical flip? 0x4 := horizontal flip?where
A
,
R
,
L
and
G
represent
the
corner
vertices
of
the
mesh
sector,
specified
via
corners.
Returns the parent sector for the given mesh sector.
[Pure]
|
||||
public
method
|
GetParent
(int32 sector)
|
|||
type
|
int32
|
|||
params
|
sector
|
The mesh sector. | ||
returns
|
The parent sector or Null if not existent. |
See also:
GetIndexReturns the root sector of the given mesh face.
[Pure]
|
||||
public
method
|
GetRoot
(CubemapFace face)
|
|||
type
|
int32
|
|||
params
|
face
|
The mesh face. | ||
returns
|
Index of root sector center vertex or Null. |
See also:
GetParentReturns an upwards vertex link.
[Pure]
|
||||
public
method
|
GetUp
(int32 vertex,
int32 link)
|
|||
type
|
int32
|
|||
params
|
vertex
|
The mesh vertex. | ||
link
|
One of L, R, G and A. | |||
returns
|
Index of linked vertex or Null if the vertex does not exist. |
See also:
SectorCullChecks if the given mesh sector has a mark, either implicit, explicit or both.
public
method
|
HasMark
(int32 sector)
|
||
type
|
bool
|
||
params
|
sector
|
The mesh sector. | |
returns
|
true
if
the
sector
is
marked,
false
if
not. |
See also:
MeshTreeFilterChecks if the given mesh sector has an explicit mark.
public
method
|
HasMarkExplicit
(int32 sector)
|
||
type
|
bool
|
||
params
|
sector
|
The mesh sector. | |
returns
|
true
if
the
sector
is
marked
explicitly,
false
if
not. |
Remarks:
Mesh sectors receive explicit marks only from the MeshTree method.
See also:
MeshTreeFilterChecks if the given mesh sector has an implicit mark.
public
method
|
HasMarkImplicit
(int32 sector)
|
||
type
|
bool
|
||
params
|
sector
|
The mesh sector. | |
returns
|
true
if
the
sector
is
marked
implicitly,
false
if
not. |
Remarks:
A mesh sector receives an implicit mark when one of its descendants is marked explicitly.
See also:
MeshTreeFilterIs the given mesh sector 'even' (see XDag)?
[Pure]
|
||||
public
method
|
IsEven
(int32 vertex)
|
|||
type
|
bool
|
|||
params
|
vertex
|
The mesh sector. | ||
returns
|
true
if
the
mesh
sector
is
'even',
false
if
it
is
'odd'. |
Checks if the given mesh sector is solid, i.e. if none of its descendants have been culled away.
public
method
|
IsSolid
(int32 sector)
|
||
type
|
bool
|
||
params
|
sector
|
The mesh sector. | |
returns
|
true
if
the
sector
is
solid,
false
if
not. |
See also:
SectorCullCulls the given mesh sector.
public
method
|
SectorCull
(int32 sector)
|
||
params
|
sector
|
Index of mesh sector center. |
Remarks:
When culling a mesh sector, its marks (both explicit and implicit) will be retained.
Removes cull flags (see SectorCull) from the input filter of this mesh tree, so that all mesh sectors that have an explicit mark (see SectorMark) will become solid (see IsSolid).
public
method
|
SectorCullKeepMarked
()
|
See also:
SectorCullMarks the given mesh sector.
public
method
|
SectorMark
(int32 sector)
|
||
params
|
sector
|
Index of mesh sector center vertex. |
Remarks:
Mesh sectors can receive marks (both explicit or implicit) even if they have been culled away earlier.
See also:
MeshTreeFilterMarks the root sectors of the mesh.
public
method
|
SectorMarkRoots
()
|
See also:
SectorMark