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

struct PyramidCoords in Tinman.Terrain.Pyramids

Coordinates of a tile in a pyramid (see IPyramidBase).

struct PyramidCoords implements IEquatable<PyramidCoords>

Public / Constants

All

public static readonly field All
type PyramidCoords

Undefined

Undefined set of pyramid coordinates.

public static readonly field Undefined
type PyramidCoords

Public / Attributes

CanWrap

Do these pyramid tile coordinates lie outside of the cubemap face and can be wrapped at the cubemap edges?

public property CanWrap { get }
type bool
value true if the coordinates can be wrapped, false if not.

See also:

Wrap

Face

The cubemap face.

public readonly field Face
type CubemapFace

IsLeaf

Is this a leaf node (i.e. it does not have children)?

public property IsLeaf { get }
type bool
value true if this is a leaf, false if not.

See also:

Child

IsRoot

Is this a root node (i.e. it does not have a parent)?

public property IsRoot { get }
type bool
value true if this is a root, false if not.

See also:

Parent

IsUndefined

Is this set of pyramid coordinates undefined?

public property IsUndefined { get }
type bool
value true if these pyramid coordinates are undefined, false if they are valid.

Level

The pyramid level.

public readonly field Level
type int32

TileX

X-coordinate of tile in pyramid level.

public readonly field TileX
type int32

TileY

Y-coordinate of tile in pyramid level.

public readonly field TileY
type int32

Public / Constructors

PyramidCoords

Creates a new instance of PyramidCoords.

public constructor PyramidCoords (CubemapFace face, int32 level, int32 tileX, int32 tileY)
params face The cubemap face.
  level The pyramid level.
  tileX X-coordinate of tile in pyramid level.
  tileY Y-coordinate of tile in pyramid level.

Public / Methods

Child

Returns the coordinates of a child node.

public method Child (int32 index)
type PyramidCoords
params index [0..3] The child index.
returns The child coordinates or Undefined if this node is a leaf.

Remarks:

Child indices are mapped to tile coordinates as follows:

+---+---+        |
| 0 | 1 |        |
+---+---+    ----+---> X
| 2 | 3 |        |
+---+---+        v Y

See also:

IsLeaf

Contains

Checks if this pyramid tile contains the given one.

public method Contains (PyramidCoords other)
type bool
params other The other pyramid tile.
returns true if this pyramid tile contains the given one, false if not.

Equals

public method Equals (PyramidCoords other)
type bool
params other

GetHashCode

public override method GetHashCode ()
type int32

Pack

Packs these pyramid tile coordinates into a 54-bit value.

public method Pack ()
type int64
returns The packed 54-bit value.

Packs the given pyramid tile coordinates into a 54-bit value.

public static method Pack (CubemapFace face, int32 level, int32 tileX, int32 tileY)
type int64
params face The cubemap face.
  level [0..25] The pyramid level.
  tileX [0..33554431] Tile X-coordinate.
  tileY [0..33554431] Tile Y-coordinate.
returns The packed 54-bit value.

Parent

Returns the coordinates of the parent node.

public method Parent ()
type PyramidCoords
returns The parent coordinates or Undefined if this node is a cubemap root.

See also:

IsRoot

Sector

Returns the pyramid coordinates of the tile that corresponds to the given CLOD mesh sector.

public static method Sector (Vec3I sector, int32 heightmapSize = HeightmapsUtil.MaxSize)
type PyramidCoords
params sector Heightmap coordinates of mesh sector center vertex.
  heightmapSize [pow2+1] Size of mesh heightmap. Defaults to MaxSize.
returns The pyramid tile coordinates.

Returns the pyramid coordinates of the tile that corresponds to the given CLOD mesh sector.

public static method Sector (int32 sectorX, int32 sectorY, int32 sectorZ, int32 heightmapSize = HeightmapsUtil.MaxSize)
type PyramidCoords
params sectorX Heightmap X-coordinate of mesh sector center vertex.
  sectorY Heightmap Y-coordinate of mesh sector center vertex.
  sectorZ Heightmap Z-coordinate of mesh sector center vertex.
  heightmapSize [pow2+1] Size of mesh heightmap. Defaults to MaxSize.
returns The pyramid tile coordinates.

Size

Returns the size of the given pyramid level.

public static method Size (int32 level)
type int32
params level [0..30] The pyramid level.
returns [>0] The pyramid level size, in tiles.

ToString

public override method ToString ()
type string

Unpack

Unpacks the given 54-bit value back to pyramid tile coordinates.

public static method Unpack (int64 value)
type PyramidCoords
params value The packed 54-bit value.
returns The pyramid tile coordinates.

Wrap

Wraps the pyramid coordinates at the cubemap edges.

public method Wrap (out PyramidCoords coords)
type Transform
params coords The wrapped pyramid tile coordinates.
returns The transform that must be applied to the pyramid tile.

See also:

CanWrap