org.xith3d.scenegraph.primitives
Class Sphere

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.Leaf
              extended by org.xith3d.scenegraph.Shape3D
                  extended by org.xith3d.scenegraph.primitives.Sphere
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode

public class Sphere
extends Shape3D

A sphere using standard specifications.


Field Summary
 
Fields inherited from class org.xith3d.scenegraph.Node
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, transformGroup, untransformedBounds
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
Sphere(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, Appearance app)
          Creates a sphere using standard specifications.
Sphere(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, org.openmali.vecmath2.Colorf color)
          Creates a sphere using standard specifications.
Sphere(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates a sphere using standard specifications.
Sphere(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, java.lang.String texture)
          Creates a sphere using standard specifications.
Sphere(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, Texture texture)
          Creates a sphere using standard specifications.
Sphere(float radius, int slices, int stacks, Appearance app)
          Creates a sphere using standard specifications.
Sphere(float radius, int slices, int stacks, org.openmali.vecmath2.Colorf color)
          Creates a sphere using standard specifications.
Sphere(float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates a sphere using standard specifications.
Sphere(float radius, int slices, int stacks, java.lang.String texture)
          Creates a sphere using standard specifications.
Sphere(float radius, int slices, int stacks, Texture texture)
          Creates a sphere using standard specifications.
Sphere(int slices, int stacks, Appearance app)
          Creates a sphere using standard specifications.
Sphere(int slices, int stacks, org.openmali.vecmath2.Colorf color)
          Creates a sphere using standard specifications.
Sphere(int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates a sphere using standard specifications.
Sphere(int slices, int stacks, java.lang.String texture)
          Creates a sphere using standard specifications.
Sphere(int slices, int stacks, Texture texture)
          Creates a sphere using standard specifications.
 
Method Summary
 void addAtmosphere(float percentalAtmosphereRadius, PointLight light, Updater updater)
          Prepares this Sphere to have an atmosphere.
static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere, int slices, int stacks, Appearance app)
          Creates a sphere using standard specifications.
static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere, int slices, int stacks, org.openmali.vecmath2.Colorf color)
          Creates a sphere using standard specifications.
static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates a sphere using standard specifications.
static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere, int slices, int stacks, java.lang.String texture)
          Creates a sphere using standard specifications.
static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere, int slices, int stacks, Texture texture)
          Creates a sphere using standard specifications.
static Geometry createGeometry(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates the GeometryArray for a Sphere.
static GeometryConstruct createGeometryConstructITA(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates a GeometryConstruct for an IndexedTriangleArray for a Raster Shape3D.
static GeometryConstruct createGeometryConstructITSA(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates the GemetryConstruct for a sphere.
static GeometryConstruct createGeometryConstructTA(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates a GeometryConstruct for a TriangleArray for a Raster Shape3D.
static GeometryConstruct createGeometryConstructTSA(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates a GeometryConstruct for a TriangleStripArray for a Raster Shape3D.
static IndexedTriangleArray createGeometryITA(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates an IndexedTriangleArray for a Sphere Shape3D.
static IndexedTriangleStripArray createGeometryITSA(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates an IndexedTriangleStripArray for a Sphere Shape3D.
static TriangleArray createGeometryTA(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates a TriangleArray for a Sphere Shape3D.
static TriangleStripArray createGeometryTSA(float centerX, float centerY, float centerZ, float radius, int slices, int stacks, int features, boolean colorAlpha, int texCoordsSize)
          Creates a TriangleStripArray for a Sphere Shape3D.
static GeometryType getGeometryConstructionTypeHint()
           
 float getRadius()
           
static void setGeometryConstructionTypeHint(GeometryType hint)
          Sets the hint for this ShapeType's Geometry to be constructed of a certain type.
 void setRadius(float radius)
           
 void setRadius(float radius, boolean scaleGeometry)
           
 
Methods inherited from class org.xith3d.scenegraph.Shape3D
absorbDetails, copy, freeOpenGLResources, getAppearance, getAppearance, getCustomComparable, getGeometry, isBumpMappingEnabled, isShadowReceiver, isVisible, newAppearance, newInstance, setAppearance, setBounds, setBumpMappingEnabled, setBumpMappingEnabled, setCustomComparable, setGeometry, setIsShadowReceiver, setModListener, setVisible, sharedCopy, sharedCopy, traverse, updateBounds, updateBoundsCheap, updateWorldTransform, verifyAppChange
 
Methods inherited from class org.xith3d.scenegraph.Leaf
dump, getPickHost, setPickHost
 
Methods inherited from class org.xith3d.scenegraph.Node
cloneNode, detach, duplicateNode, freeOpenGLResources, getBounds, getBoundsAutoCompute, getBoundsType, getBoundsTypeHint, getDefaultPickable, getIndentString, getInheritedNodeAttributes, getModListener, getOrderedChild, getOrderedState, getParent, getRoot, getShadowAttachment, getShowBounds, getTransformGroup, getTreeCell, getWorldBounds, getWorldTransform, getWorldTransform, isBillboard, isIgnoreBounds, isOccluder, isPickable, isRenderable, isUpdatableNode, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBoundsAutoCompute, setBoundsDirty, setBoundsDirtyUpward, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setOrderedChild, setParent, setPickable, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, traverse, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateOrderedChild, updateTransformGroup
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sphere

public Sphere(float centerX,
              float centerY,
              float centerZ,
              float radius,
              int slices,
              int stacks,
              int features,
              boolean colorAlpha,
              int texCoordsSize)
Creates a sphere using standard specifications.
 Parametric equations:
 x=r*cos(theta)*sin(phi)
 y=r*sin(theta)*sin(phi)
 z=r*cos(phi)
 over theta in [0,2*PI] and phi in [0,PI]
 

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

Sphere

public Sphere(float centerX,
              float centerY,
              float centerZ,
              float radius,
              int slices,
              int stacks,
              Texture texture)
Creates a sphere using standard specifications.

Parameters:
centerX -
centerY -
centerZ -
radius - amount to enlarge the sphere by
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
texture - the texture to apply to the Sphere's Appearance

Sphere

public Sphere(float centerX,
              float centerY,
              float centerZ,
              float radius,
              int slices,
              int stacks,
              java.lang.String texture)
Creates a sphere using standard specifications.

Parameters:
centerX -
centerY -
centerZ -
radius - amount to enlarge the sphere by
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
texture - the texture to apply to the Sphere's Appearance

Sphere

public Sphere(float centerX,
              float centerY,
              float centerZ,
              float radius,
              int slices,
              int stacks,
              Appearance app)
Creates a sphere using standard specifications.

Parameters:
centerX -
centerY -
centerZ -
radius - amount to enlarge the sphere by
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
app - the new Sphere's Appearance

Sphere

public Sphere(float centerX,
              float centerY,
              float centerZ,
              float radius,
              int slices,
              int stacks,
              org.openmali.vecmath2.Colorf color)
Creates a sphere using standard specifications.

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
color - the color to apply to the Sphere's Appearance

Sphere

public Sphere(int slices,
              int stacks,
              int features,
              boolean colorAlpha,
              int texCoordsSize)
Creates a sphere using standard specifications.
 Parametric equations:
 x=r*cos(theta)*sin(phi)
 y=r*sin(theta)*sin(phi)
 z=r*cos(phi)
 over theta in [0,2*PI] and phi in [0,PI]
 

Parameters:
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

Sphere

public Sphere(float radius,
              int slices,
              int stacks,
              int features,
              boolean colorAlpha,
              int texCoordsSize)
Creates a sphere using standard specifications.

Parameters:
radius - amount to enlarge the sphere by
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -
See Also:
StaticTransform.scale(Shape3D, float)

Sphere

public Sphere(float radius,
              int slices,
              int stacks,
              Texture texture)
Creates a sphere using standard specifications.

Parameters:
radius - amount to enlarge the sphere by
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
texture - the texture to apply to the Sphere's Appearance

Sphere

public Sphere(float radius,
              int slices,
              int stacks,
              java.lang.String texture)
Creates a sphere using standard specifications.

Parameters:
radius - amount to enlarge the sphere by
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
texture - the texture to apply to the Sphere's Appearance

Sphere

public Sphere(float radius,
              int slices,
              int stacks,
              Appearance app)
Creates a sphere using standard specifications.

Parameters:
radius - amount to enlarge the sphere by
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
app - the new Sphere's Appearance

Sphere

public Sphere(int slices,
              int stacks,
              Texture texture)
Creates a sphere using standard specifications.

Parameters:
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
texture - the texture to apply to the Sphere's Appearance

Sphere

public Sphere(int slices,
              int stacks,
              java.lang.String texture)
Creates a sphere using standard specifications.

Parameters:
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
texture - the texture to apply to the Sphere's Appearance

Sphere

public Sphere(int slices,
              int stacks,
              Appearance app)
Creates a sphere using standard specifications.

Parameters:
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
app - the new Sphere's Appearance

Sphere

public Sphere(int slices,
              int stacks,
              org.openmali.vecmath2.Colorf color)
Creates a sphere using standard specifications.

Parameters:
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
color - the color to apply to the Sphere's Appearance

Sphere

public Sphere(float radius,
              int slices,
              int stacks,
              org.openmali.vecmath2.Colorf color)
Creates a sphere using standard specifications.

Parameters:
radius - amount to enlarge the sphere by
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
color - the color to apply to the Sphere's Appearance
Method Detail

setGeometryConstructionTypeHint

public static void setGeometryConstructionTypeHint(GeometryType hint)
Sets the hint for this ShapeType's Geometry to be constructed of a certain type.

Parameters:
hint -

getGeometryConstructionTypeHint

public static GeometryType getGeometryConstructionTypeHint()
Returns:
the hint for this ShapeType's Geometry to be constructed of a certain type.

createGeometryConstructITSA

public static GeometryConstruct createGeometryConstructITSA(float centerX,
                                                            float centerY,
                                                            float centerZ,
                                                            float radius,
                                                            int slices,
                                                            int stacks,
                                                            int features,
                                                            boolean colorAlpha,
                                                            int texCoordsSize)
Creates the GemetryConstruct for a sphere.
 Parametric equations:
 x = r * cos( theta ) * sin( phi )
 y = r * sin( theta ) * sin( phi )
 z = r * cos( phi )
 over theta in [ 0, 2 * PI ] and phi in [ 0, PI ]
 

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

createGeometryITSA

public static IndexedTriangleStripArray createGeometryITSA(float centerX,
                                                           float centerY,
                                                           float centerZ,
                                                           float radius,
                                                           int slices,
                                                           int stacks,
                                                           int features,
                                                           boolean colorAlpha,
                                                           int texCoordsSize)
Creates an IndexedTriangleStripArray for a Sphere Shape3D.

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

createGeometryConstructITA

public static GeometryConstruct createGeometryConstructITA(float centerX,
                                                           float centerY,
                                                           float centerZ,
                                                           float radius,
                                                           int slices,
                                                           int stacks,
                                                           int features,
                                                           boolean colorAlpha,
                                                           int texCoordsSize)
Creates a GeometryConstruct for an IndexedTriangleArray for a Raster Shape3D.

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

createGeometryITA

public static IndexedTriangleArray createGeometryITA(float centerX,
                                                     float centerY,
                                                     float centerZ,
                                                     float radius,
                                                     int slices,
                                                     int stacks,
                                                     int features,
                                                     boolean colorAlpha,
                                                     int texCoordsSize)
Creates an IndexedTriangleArray for a Sphere Shape3D.

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

createGeometryConstructTSA

public static GeometryConstruct createGeometryConstructTSA(float centerX,
                                                           float centerY,
                                                           float centerZ,
                                                           float radius,
                                                           int slices,
                                                           int stacks,
                                                           int features,
                                                           boolean colorAlpha,
                                                           int texCoordsSize)
Creates a GeometryConstruct for a TriangleStripArray for a Raster Shape3D.

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

createGeometryTSA

public static TriangleStripArray createGeometryTSA(float centerX,
                                                   float centerY,
                                                   float centerZ,
                                                   float radius,
                                                   int slices,
                                                   int stacks,
                                                   int features,
                                                   boolean colorAlpha,
                                                   int texCoordsSize)
Creates a TriangleStripArray for a Sphere Shape3D.

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

createGeometryConstructTA

public static GeometryConstruct createGeometryConstructTA(float centerX,
                                                          float centerY,
                                                          float centerZ,
                                                          float radius,
                                                          int slices,
                                                          int stacks,
                                                          int features,
                                                          boolean colorAlpha,
                                                          int texCoordsSize)
Creates a GeometryConstruct for a TriangleArray for a Raster Shape3D.

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

createGeometryTA

public static TriangleArray createGeometryTA(float centerX,
                                             float centerY,
                                             float centerZ,
                                             float radius,
                                             int slices,
                                             int stacks,
                                             int features,
                                             boolean colorAlpha,
                                             int texCoordsSize)
Creates a TriangleArray for a Sphere Shape3D.

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

createGeometry

public static Geometry createGeometry(float centerX,
                                      float centerY,
                                      float centerZ,
                                      float radius,
                                      int slices,
                                      int stacks,
                                      int features,
                                      boolean colorAlpha,
                                      int texCoordsSize)
Creates the GeometryArray for a Sphere.
 Parametric equations:
 x = r * cos( theta ) * sin( phi )
 y = r * sin( theta ) * sin( phi )
 z = r * cos( phi )
 over theta in [ 0, 2 * PI ] and phi in [ 0, PI ]
 

Parameters:
centerX -
centerY -
centerZ -
radius -
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -

setRadius

public void setRadius(float radius,
                      boolean scaleGeometry)

setRadius

public final void setRadius(float radius)

getRadius

public final float getRadius()

addAtmosphere

public void addAtmosphere(float percentalAtmosphereRadius,
                          PointLight light,
                          Updater updater)
Prepares this Sphere to have an atmosphere.

Parameters:
percentalAtmosphereRadius - the additional radius of the atmosphere in percent to the sphere's radius. this could be something like 1.05f.
light -
updater -

createFromSphereBody

public static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere,
                                          int slices,
                                          int stacks,
                                          int features,
                                          boolean colorAlpha,
                                          int texCoordsSize)
Creates a sphere using standard specifications.

Parameters:
sampleSphere - the sphere-body to create this scenegraph-sphere-primitive from
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
features - Generate the data for GeometryArray.COLOR_3 | GeometryArray.NORMALS | ...
colorAlpha -
texCoordsSize -
See Also:
StaticTransform.scale(Shape3D, float)

createFromSphereBody

public static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere,
                                          int slices,
                                          int stacks,
                                          Texture texture)
Creates a sphere using standard specifications.

Parameters:
sampleSphere - the sphere-body to create this scenegraph-sphere-primitive from
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
texture - the texture to apply to the Sphere's Appearance

createFromSphereBody

public static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere,
                                          int slices,
                                          int stacks,
                                          java.lang.String texture)
Creates a sphere using standard specifications.

Parameters:
sampleSphere - the sphere-body to create this scenegraph-sphere-primitive from
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
texture - the texture to apply to the Sphere's Appearance

createFromSphereBody

public static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere,
                                          int slices,
                                          int stacks,
                                          Appearance app)
Creates a sphere using standard specifications.

Parameters:
sampleSphere - the sphere-body to create this scenegraph-sphere-primitive from
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
app - the new Sphere's Appearance

createFromSphereBody

public static Sphere createFromSphereBody(org.openmali.spatial.bodies.Sphere sampleSphere,
                                          int slices,
                                          int stacks,
                                          org.openmali.vecmath2.Colorf color)
Creates a sphere using standard specifications.

Parameters:
sampleSphere - the sphere-body to create this scenegraph-sphere-primitive from
slices - Number of vertical stripes down the sphere
stacks - Number of stacked rings around the sphere
color - the color to apply to the Sphere's Appearance