Class LODCubeSphere

java.lang.Object
gaiasky.render.gdx.procgen.LODCubeSphere

public class LODCubeSphere extends Object
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.

  • 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

      public final com.badlogic.gdx.utils.Array<LODCubeSphere.Quadtree> visibleLeaves
      Visible leaves list, cleared at the start of each traverse() call.
  • Constructor Details

    • LODCubeSphere

      public LODCubeSphere(int maxDepth, boolean fullInit)
  • Method Details

    • update

      public void update(ICamera cam, double objectRadius, com.badlogic.gdx.math.Matrix4 localTransform)
      Traverses the structure computing the visible nodes, adding them to the visibleLeaves list.
      Parameters:
      cam - The camera.
    • buildVisibleMeshes

      public void buildVisibleMeshes(int N, float radius)
      Build meshes for all visible leaves (populated by update(ICamera, double, Matrix4)). Calls LODCubeSphere.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 internal IntIntMeshBuilder, if needed, and calls begin(attributes, primitiveType) on it.
      Parameters:
      primitiveType - Primitive type (e.g. GL11.GL_TRIANGLES).
    • end

      public IntMesh end()
      Finish building and return the mesh.
      Returns:
      The completed mesh.