Class SVTQuadtreeNode<T>

java.lang.Object
gaiasky.util.svt.SVTQuadtreeNode<T>
All Implemented Interfaces:
Comparable<SVTQuadtreeNode>

public class SVTQuadtreeNode<T> extends Object implements Comparable<SVTQuadtreeNode>

A quadtree node that represents a single tile with a specific level of detail (LOD) in the Sparse Virtual Texture (SVT). Contains the level of detail (level), the column within the level (col), the row within the level (row) and the path to the actual texture file.

Each node is subdivided into four tiles like so:

      0     1
    .----.----.
 0  | TL | TR |
    :----+----:
 1  | BL | BR |
    '----'----'
 

Columns increase left-to-right, and rows increase top-to-bottom. Note that in UV coordinates, the V coordinate, corresponding to the rows, is inverted.

  • Field Details

    • tree

      public final SVTQuadtree<T> tree
      The tree this node belongs to.
    • parent

      public final SVTQuadtreeNode<T> parent
      The parent of this tile, if it is not at the root level.
    • level

      public final int level
    • col

      public final int col
    • row

      public final int row
    • object

      public final T object
    • state

      public int state
    • accessed

      public long accessed
  • Constructor Details

  • Method Details

    • getUV

      public double[] getUV()
      Get the UV coordinates in [0,1] of the top left position of this tile.
      Returns:
      The UV coordinates of this tile.
    • mipLevel

      public int mipLevel()
      Computes the OpenGL mip level for this tile.
      Returns:
      The OpenGL mip level for this tile.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toStringShort

      public String toStringShort()
    • compareTo

      public int compareTo(SVTQuadtreeNode o)
      Specified by:
      compareTo in interface Comparable<T>
    • getKey

      public long getKey()
      Gets a unique 64-bit integer key for this tile, including the level, the column and the row.
      Returns:
      The unique key.