PyramidCoords

Description

struct Tinman.Terrain.Pyramids.PyramidCoords

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

Public / Constants

All


public static readonly attribute All → (PyramidCoords)

Special pyramid coordinates that represent all six cubemap faces.

Undefined


public static readonly attribute Undefined → (PyramidCoords)

Undefined set of pyramid coordinates.

Public / Constructors

Pyramid​Coords


public constructor PyramidCoords → (4)

face in : CubemapFace

The cubemap face.

level in : int32

The pyramid level.

tileX in : int32

X-coordinate of tile in pyramid level.

tileY in : int32

Y-coordinate of tile in pyramid level.

Creates a new instance of PyramidCoords.

Sector

2 overloads


public static method Sector1 → (2)

sector in : Vec3I

Heightmap coordinates of mesh sector center vertex.

heightmapSize opt : int32 = HeightmapsUtil.MaxSize

[pow2+1]
Size of mesh heightmap.

returns → PyramidCoords

The pyramid tile coordinates.

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


public static method Sector2 → (4)

sectorX in : int32

Heightmap X-coordinate of mesh sector center vertex.

sectorY in : int32

Heightmap Y-coordinate of mesh sector center vertex.

sectorZ in : int32

Heightmap Z-coordinate of mesh sector center vertex.

heightmapSize opt : int32 = HeightmapsUtil.MaxSize

[pow2+1]
Size of mesh heightmap.

returns → PyramidCoords

The pyramid tile coordinates.

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

Unpack


public static method Unpack → (1)

value in : int64

The packed 54-bit value.

returns → PyramidCoords

The pyramid tile coordinates.

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

Public / Methods

Child


public method Child → (1)

index in : int32

[0..3]
The child index.

returns → PyramidCoords

The child coordinates or Undefined if this node is a leaf.

Returns the coordinates of a child node.

Child indices are mapped to tile coordinates as follows:

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

Contains


[Pure]
public method Contains → (1)

other in : PyramidCoords

The other pyramid tile.

returns → bool

true if this pyramid tile contains the given one, false if not.

Checks if this pyramid tile contains the given one.

This method take the special pyramid tile coordinate All and Undefined into account.

Pack


public static method Pack → (4)

face in : CubemapFace

The cubemap face.

level in : int32

[0..25]
The pyramid level.

tileX in : int32

[0..33554431]
Tile X-coordinate.

tileY in : int32

[0..33554431]
Tile Y-coordinate.

returns → int64

The packed 54-bit value.

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


public method Pack → ()

returns → int64

The packed 54-bit value.

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

Parent


public method Parent → ()

returns → PyramidCoords

The parent coordinates or Undefined if this node is a cubemap root.

Returns the coordinates of the parent node.

Size


public static method Size → (1)

level in : int32

[0..30]
The pyramid level.

returns → int32

The pyramid level size, in tiles.

Returns the size of the given pyramid level.

Wrap


public method Wrap → (1)

coords out : PyramidCoords

The wrapped pyramid tile coordinates.

returns → Transform

The transform that must be applied to the pyramid tile.

Wraps the pyramid coordinates at the cubemap edges.

Public / Attributes

Can​Wrap


public attribute CanWrap → (get)

value : bool

true if the coordinates can be wrapped, false if not.

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

Face


public readonly attribute Face → (CubemapFace)

The cubemap face.

Is​Leaf


public attribute IsLeaf → (get)

value : bool

true if this is a leaf, false if not.

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

Is​Root


public attribute IsRoot → (get)

value : bool

true if this is a root, false if not.

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

Is​Undefined


public attribute IsUndefined → (get)

value : bool

true if these pyramid coordinates are undefined, false if they are valid.

Is this set of pyramid coordinates undefined?

Level


public readonly attribute Level → (int32)

The pyramid level.

Tile​X


public readonly attribute TileX → (int32)

X-coordinate of tile in pyramid level.

Tile​Y


public readonly attribute TileY → (int32)

Y-coordinate of tile in pyramid level.