Package gaiasky.util.svt
Class SVTQuadtree<T>
java.lang.Object
gaiasky.util.svt.SVTQuadtree<T>
A Sparse Virtual Texture (SVT) quadtree with a certain LOD depth and tile size.
Only square tiles are supported. The tree typically contains two root nodes,
since the textures that wrap around spherical objects have an aspect ratio of 2:1.
-
Field Summary
Modifier and TypeFieldDescriptionAuxiliary object to store additional data.int
Depth of the tree, e.g., the deepest level, in [0,n].com.badlogic.gdx.utils.LongMap<SVTQuadtreeNode<T>>[]
Each tile is identified by its level and its UV.final int
final String
Name of the tree.int
The total number of tiles in the tree.SVTQuadtreeNode<T>[]
Root node(s) of the tree.final int
Size in pixels of each tile. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(int level, int col, int row) int[]
getColRow
(int level, double u, double v) long
getKey
(int level, int col, int row) long
getKey
(SVTQuadtreeNode<T> tile) int[]
Get the resolution of this SVT at the most-detailed level.getTile
(int level, int col, int row) Gets a tile in the tree given its level, column and row.getTileFromUV
(int level, double u, double v) Gets a tile given a level and texture coordinates in UV.long
getUTileCount
(int level) double[]
getUV
(int level, int col, int row) long
getVTileCount
(int level) void
-
Field Details
-
MAX_LEVEL
public final int MAX_LEVEL- See Also:
-
name
Name of the tree. -
tileSize
public final int tileSizeSize in pixels of each tile. Tiles are square, so width and height are equal. The tile size is a power of two, capping at 1024. One of 8, 16, 32, 64, 128, 256, 512 or 1024. -
numTiles
public int numTilesThe total number of tiles in the tree. -
depth
public int depthDepth of the tree, e.g., the deepest level, in [0,n]. -
root
Root node(s) of the tree. -
levels
Each tile is identified by its level and its UV. Here we can access tiles directly. -
aux
Auxiliary object to store additional data.
-
-
Constructor Details
-
SVTQuadtree
-
-
Method Details
-
insert
-
getTile
Gets a tile in the tree given its level, column and row.- Parameters:
level
- The level.col
- The column.row
- The row.- Returns:
- The tile with the given level, column and row, if it exists.
-
getTileFromUV
Gets a tile given a level and texture coordinates in UV.- Parameters:
level
- The level.u
- The U texture coordinate in [0,1].v
- The V texture coordinate in [0,1].- Returns:
- The tile at the given level and UV.
-
getUTileCount
public long getUTileCount(int level) -
getVTileCount
public long getVTileCount(int level) -
getColRow
public int[] getColRow(int level, double u, double v) -
getUV
public double[] getUV(int level, int col, int row) -
contains
public boolean contains(int level, int col, int row) -
getKey
public long getKey(int level, int col, int row) -
getKey
-
getResolution
public int[] getResolution()Get the resolution of this SVT at the most-detailed level.- Returns:
- The resolution at the most detailed level.
-