Class CubeSphereCreator
java.lang.Object
gaiasky.render.gdx.creators.ModelCreator
gaiasky.render.gdx.creators.CubeSphereCreator
-
Nested Class Summary
Nested classes/interfaces inherited from class ModelCreator
ModelCreator.Face, ModelCreator.IFaceModifier and TypeClassDescriptionclassContains the index info for a face.static interface -
Field Summary
Fields inherited from class ModelCreator
binormals, faces, flipNormals, hardEdges, index, name, normals, tangents, uv, vertices -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class ModelCreator
addFace, addVertex, dumpObj, flipModifier and TypeMethodDescriptionprotected voidaddFace(List<ModelCreator.IFace> faces, boolean flipNormals, int... v) protected intaddVertex(com.badlogic.gdx.math.Vector3 p) Adds a vertex.voiddumpObj(OutputStream os) Exports the model to the .obj (Wavefront) format in the given output stream.protected int[]flip(int[] v, int startIndex)
-
Constructor Details
-
CubeSphereCreator
public CubeSphereCreator()
-
-
Method Details
-
create
Creates a cube-sphere model.- Parameters:
radius- The radius of the sphere.divisions- The number of subdivisions per face edge (must be > 0).- Returns:
- This creator.
-
create
Creates a cube-sphere model. Start with a cube where each face containsdivisions x divisionsquads, then project each vertex onto the sphere by normalizing its position and scaling by the radius.UVs are computed from the final spherical direction (longitude/colatitude), using the same convention as
SphereCreator(u=1 at longitude 0, decreasing eastward; v=0 at the north pole, 1 at the south pole). This makes any standard equirectangular texture (e.g. a whole-Earth map) line up correctly, and lets a UV-sphere and cube-sphere share the same texture.Because a flat square face can span more than 180 degrees of longitude around the poles, three of the six faces (-X, +Y, -Y) cross the longitude seam (u wraps from ~1 back to ~0). Vertices along that seam are duplicated with u shifted by +-1 so no quad stretches across the whole texture.
- Parameters:
radius- The radius of the sphere.divisions- The number of subdivisions per face edge (must be > 0).flipNormals- Whether to reverse triangle winding (flip normals).- Returns:
- This creator.
-