Class Octasphere

java.lang.Object
com.jme3.scene.Mesh
jme3utilities.mesh.Octasphere
All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.util.clone.JmeCloneable, Cloneable

public class Octasphere extends com.jme3.scene.Mesh
A static, Triangles-mode mesh (with indices, normals, and texture coordinates) that approximates a sphere, generated by subdividing the faces of a regular octahedron. The resulting mesh is more isotropic than a U-V sphere and handles textures better than an icosphere.

The center is at (0,0,0). All triangles face outward with right-handed winding.

The texture coordinates are generated for an equirectangular projection similar to Sphere.TextureMode.Projected, only with the U values mirrored and offset:

  • U is the azimuthal angle in revs. It ranges from 0 to 1.
  • V is the polar angle, measured (in half revs) from the -Z axis. It ranges from 0 to 1.

Vertices with Y=0 and X<1 lie on the seam. Those vertices are doubled and can have either U=0 or U=1.

Vertices with X=0 and Y=0 lie at the poles. Those vertices are trebled and can have U=0 or 0.5 or 1.

Derived from Icosphere by jayfella.

  • Nested Class Summary

    Nested classes/interfaces inherited from class com.jme3.scene.Mesh

    com.jme3.scene.Mesh.Mode
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Logger
    message logger for this class
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    No-argument constructor needed by SavableClassUtil.
     
    Octasphere(int numRefineSteps, float radius)
    Instantiate an Octasphere with the specified radius and number of refinement steps: 0 steps → 11 unique vertices and 8 triangular faces 1 step → 27 unique vertices and 32 triangular faces 2 steps → 83 unique vertices and 128 triangular faces 3 steps → 291 unique vertices and 512 triangular faces 4 steps → 1091 unique vertices and 2048 triangular faces etcetera
  • Method Summary

    Methods inherited from class com.jme3.scene.Mesh

    addMorphTarget, clearBuffer, clearCollisionData, clone, cloneFields, cloneForAnim, collideWith, createCollisionData, deepClone, extractVertexData, generateBindPose, generateBindPose, getBound, getBuffer, getBufferList, getBuffers, getElementLengths, getFloatBuffer, getId, getIndexBuffer, getIndicesAsList, getInstanceCount, getLineWidth, getLodLevel, getMaxNumWeights, getMode, getModeStart, getMorphIndex, getMorphTarget, getMorphTargetNames, getMorphTargets, getNumLodLevels, getPatchVertexCount, getPointSize, getShortBuffer, getTriangle, getTriangle, getTriangle, getTriangleCount, getTriangleCount, getVertexCount, hasMorphTargets, isAnimated, isAnimatedByBone, isAnimatedByJoint, jmeClone, prepareForAnim, read, removeMorphTarget, removeMorphTarget, scaleTextureCoordinates, setBound, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setDynamic, setElementLengths, setId, setInterleaved, setLineWidth, setLodLevels, setMaxNumWeights, setMode, setModeStart, setPatchVertexCount, setStatic, setStreamed, updateBound, updateCounts, write

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • Octasphere

      protected Octasphere()
      No-argument constructor needed by SavableClassUtil.
    • Octasphere

      public Octasphere(int numRefineSteps, float radius)
      Instantiate an Octasphere with the specified radius and number of refinement steps:
      • 0 steps → 11 unique vertices and 8 triangular faces
      • 1 step → 27 unique vertices and 32 triangular faces
      • 2 steps → 83 unique vertices and 128 triangular faces
      • 3 steps → 291 unique vertices and 512 triangular faces
      • 4 steps → 1091 unique vertices and 2048 triangular faces
      • etcetera
      Parameters:
      numRefineSteps - number of refinement steps (≥0, ≤13)
      radius - radius (in mesh units, >0)