Class IcoSphereCreator

java.lang.Object
gaiasky.util.gdx.ModelCreator
gaiasky.util.gdx.IcoSphereCreator

public class IcoSphereCreator extends ModelCreator
Helper generic class to create icospheres.
  • Constructor Details

    • IcoSphereCreator

      public IcoSphereCreator()
  • Method Details

    • vertex

      protected int vertex(com.badlogic.gdx.math.Vector3 p, float radius)
      Adds a vertex and its UV mapping.
      Parameters:
      p - The point.
      radius - The radius.
      Returns:
    • addUV

      protected void addUV(com.badlogic.gdx.math.Vector3 p)
      Implements the spherical UV mapping
      Parameters:
      p - The normalized point
    • create

      public IcoSphereCreator create(float radius, int recursionLevel)
    • create

      public IcoSphereCreator create(float radius, int divisions, boolean flipNormals)
      Creates an ico-sphere.
      Parameters:
      radius - The radius of the sphere.
      divisions - The number of divisions, it must be bigger than 0.
      flipNormals - Whether to flip normals or not.
      Returns:
      This creator
    • create

      public IcoSphereCreator create(float radius, int divisions, boolean flipNormals, boolean hardEdges)
      Creates an ico-sphere.
      Parameters:
      radius - The radius of the sphere.
      divisions - The number of divisions, it must be bigger than 0.
      flipNormals - Whether to flip normals or not.
      hardEdges - Whether to use smoothLighting (all vertices in a face have a different normal) or not.
      Returns:
      This creator
    • main

      public static void main(String[] args)