Class LODCubeSphere
java.lang.Object
gaiasky.render.gdx.procgen.LODCubeSphere
A unit LOD cube-sphere, where each cube face is a quadtree.
The builder lives in this object. Use begin(int)
to start building, then call LODCubeSphere.Quadtree.buildMesh(int, float) on visible leaf
nodes, and finally end() to produce the IntMesh.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA quadtree, which parts 2D space into 4 parts on subdivision. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal com.badlogic.gdx.math.Vector3final com.badlogic.gdx.math.Vector3final com.badlogic.gdx.math.Vector3final com.badlogic.gdx.math.Vector3final com.badlogic.gdx.math.Vector2final com.badlogic.gdx.utils.Array<LODCubeSphere.Quadtree> Visible leaves list, cleared at the start of each traverse() call. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbegin(int primitiveType) Begin building a mesh.voidbuildVisibleMeshes(int N, float radius) Build meshes for all visible leaves (populated byupdate(ICamera, double, Matrix4)).end()Finish building and return the mesh.voidTraverses the structure computing the visible nodes, adding them to thevisibleLeaveslist.
-
Field Details
-
scratchPos
public final com.badlogic.gdx.math.Vector3 scratchPos -
scratchNormal
public final com.badlogic.gdx.math.Vector3 scratchNormal -
scratchTangent
public final com.badlogic.gdx.math.Vector3 scratchTangent -
scratchBinormal
public final com.badlogic.gdx.math.Vector3 scratchBinormal -
scratchUV
public final com.badlogic.gdx.math.Vector2 scratchUV -
visibleLeaves
Visible leaves list, cleared at the start of each traverse() call.
-
-
Constructor Details
-
LODCubeSphere
public LODCubeSphere(int maxDepth, boolean fullInit)
-
-
Method Details
-
update
Traverses the structure computing the visible nodes, adding them to thevisibleLeaveslist.- Parameters:
cam- The camera.
-
buildVisibleMeshes
public void buildVisibleMeshes(int N, float radius) Build meshes for all visible leaves (populated byupdate(ICamera, double, Matrix4)). CallsLODCubeSphere.Quadtree.buildMesh(int, float)on each visible leaf.- Parameters:
N- The number of subdivisions per edge (N > 0).radius- The radius of the sphere.
-
begin
public void begin(int primitiveType) Begin building a mesh. Initializes the internalIntIntMeshBuilder, if needed, and callsbegin(attributes, primitiveType)on it.- Parameters:
primitiveType- Primitive type (e.g.GL11.GL_TRIANGLES).
-
end
-