Class IcoSphereCreator

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

public class IcoSphereCreator
extends ModelCreator
Helper generic class to create icospheres.
  • Nested Class Summary

    Nested classes/interfaces inherited from class gaiasky.util.gdx.ModelCreator

    ModelCreator.Face, ModelCreator.IFace
  • Field Summary

    Fields inherited from class gaiasky.util.gdx.ModelCreator

    faces, flipNormals, hardEdges, index, name, normals, uv, vertices
  • Constructor Summary

    Constructors
    Constructor Description
    IcoSphereCreator()  
  • Method Summary

    Modifier and Type Method Description
    protected void addUV​(com.badlogic.gdx.math.Vector3 p)
    Implements the spherical UV mapping
    IcoSphereCreator create​(float radius, int recursionLevel)  
    IcoSphereCreator create​(float radius, int divisions, boolean flipNormals)
    Creates an ico-sphere.
    IcoSphereCreator create​(float radius, int divisions, boolean flipNormals, boolean hardEdges)
    Creates an ico-sphere.
    static void main​(java.lang.String[] args)  
    protected int vertex​(com.badlogic.gdx.math.Vector3 p, float radius)
    Adds a vertex and its UV mapping.

    Methods inherited from class gaiasky.util.gdx.ModelCreator

    addFace, dumpObj, flip

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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​(java.lang.String[] args)