com.jme.scene.shape
Class Sphere

java.lang.Object
  extended by com.jme.scene.Spatial
      extended by com.jme.scene.Geometry
          extended by com.jme.scene.TriMesh
              extended by com.jme.scene.shape.Sphere
All Implemented Interfaces:
Savable, java.io.Serializable

public class Sphere
extends TriMesh

Sphere represents a 3D object with all points equidistance from a center point.

Version:
$Revision: 4163 $, $Date: 2009-03-25 01:14:55 +0000 (Wed, 25 Mar 2009) $
Author:
Joshua Slack
See Also:
Serialized Form

Nested Class Summary
static class Sphere.TextureMode
           
 
Nested classes/interfaces inherited from class com.jme.scene.TriMesh
TriMesh.Mode
 
Nested classes/interfaces inherited from class com.jme.scene.Spatial
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode
 
Field Summary
 Vector3f center
          the center of the sphere
protected  int radialSamples
           
 float radius
          the distance from the center point each point falls on
static int TEX_ORIGINAL
          Deprecated. 
static int TEX_PROJECTED
          Deprecated. 
protected  Sphere.TextureMode textureMode
           
protected  boolean useEvenSlices
           
protected  int zSamples
           
 
Fields inherited from class com.jme.scene.TriMesh
indexBuffer, mode, triangleQuantity
 
Fields inherited from class com.jme.scene.Geometry
binormalBuf, bound, castsShadows, colorBuf, compVect, defaultColor, displayListID, enabled, fogBuf, hasDirtyVertices, normBuf, states, tangentBuf, texBuf, vboInfo, vertBuf, vertQuantity
 
Fields inherited from class com.jme.scene.Spatial
cullHint, frustrumIntersects, geometricalControllers, isCollidable, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
Sphere()
           
Sphere(java.lang.String name)
          Constructs a sphere.
Sphere(java.lang.String name, int zSamples, int radialSamples, float radius)
          Constructs a sphere with center at the origin.
Sphere(java.lang.String name, Vector3f center, int zSamples, int radialSamples, float radius)
          Constructs a sphere.
Sphere(java.lang.String name, Vector3f center, int zSamples, int radialSamples, float radius, boolean useEvenSlices)
          Constructs a sphere.
 
Method Summary
 Vector3f getCenter()
          Returns the center of this sphere.
 int getRadialSamples()
           
 float getRadius()
           
 Sphere.TextureMode getTextureMode()
           
 int getZSamples()
           
 void read(JMEImporter e)
           
 void setCenter(Vector3f aCenter)
          Deprecated. Use updateGeometry(Vector3f,int,int,float) instead
 void setData(Vector3f center, int zSamples, int radialSamples, float radius)
          Deprecated. Use updateGeometry(Vector3f,int,int,float) instead
 void setTextureMode(int textureMode)
          Deprecated. 
 void setTextureMode(Sphere.TextureMode textureMode)
           
 void updateGeometry(Vector3f center, int zSamples, int radialSamples, float radius)
          Changes the information of the sphere into the given values.
 void updateGeometry(Vector3f center, int zSamples, int radialSamples, float radius, boolean useEvenSlices)
           
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, draw, findCollisions, findTriangleCollision, findTrianglePick, getIndexBuffer, getMaxIndex, getMeshAsTriangles, getMeshAsTrianglesVertices, getMode, getTriangle, getTriangle, getTriangleCount, getTriangleIndices, getVertIndex, hasCollision, hasTriangleCollision, randomPointOnTriangles, recalcTriangleQuantity, reconstruct, setIndexBuffer, setMode, setTriangleQuantity
 
Methods inherited from class com.jme.scene.Geometry
addTextureCoordinates, addTextureCoordinates, applyRenderState, checkTextureCoordinates, clearTextureBuffers, copyTextureCoordinates, copyTextureCoordinates, findPick, getBinormalBuffer, getColorBuffer, getDefaultColor, getDisplayListID, getFogBuffer, getLightState, getModelBound, getNormalBuffer, getNumberOfUnits, getTangentBuffer, getTextureCoords, getTextureCoords, getVBOInfo, getVertexBuffer, getVertexCount, getWorldCoords, getWorldNormals, hasDirtyVertices, isCastsShadows, lockMeshes, postdraw, predraw, randomVertex, reconstruct, resizeTextureIds, rotateNormals, rotatePoints, scaleTextureCoordinates, scaleTextureCoordinates, setBinormalBuffer, setCastsShadows, setColorBuffer, setDefaultColor, setDisplayListID, setFogCoordBuffer, setHasDirtyVertices, setLightState, setModelBound, setNormalBuffer, setRandomColors, setSolidColor, setTangentBuffer, setTextureCoords, setTextureCoords, setTextureCoords, setVBOInfo, setVertexBuffer, setVertexCount, sortLights, translatePoints, translatePoints, unlockMeshes, updateModelBound, updateWorldBound
 
Methods inherited from class com.jme.scene.Spatial
addController, calculateCollisions, calculatePick, clearControllers, clearRenderState, clearRenderState, getClassTag, getController, getControllerCount, getControllers, getCullHint, getLastFrustumIntersection, getLightCombineMode, getLocalCullHint, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalRotation, getLocalScale, getLocalTextureCombineMode, getLocalToWorldMatrix, getLocalTranslation, getLocks, getName, getNormalsMode, getParent, getRenderQueueMode, getRenderState, getRenderState, getTextureCombineMode, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, hasAncestor, isCollidable, localToWorld, lock, lock, lockBounds, lockBranch, lockMeshes, lockShadows, lockTransforms, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setCullHint, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setLocks, setLocks, setName, setNormalsMode, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setUserData, setZOrder, setZOrder, toString, unlock, unlock, unlockBounds, unlockBranch, unlockMeshes, unlockShadows, unlockTransforms, updateGeometricState, updateRenderState, updateRenderState, updateWorldData, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, updateWorldVectors, worldToLocal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Field Detail

TEX_ORIGINAL

@Deprecated
public static final int TEX_ORIGINAL
Deprecated. 
See Also:
Constant Field Values

TEX_PROJECTED

@Deprecated
public static final int TEX_PROJECTED
Deprecated. 
See Also:
Constant Field Values

zSamples

protected int zSamples

radialSamples

protected int radialSamples

useEvenSlices

protected boolean useEvenSlices

radius

public float radius
the distance from the center point each point falls on


center

public Vector3f center
the center of the sphere


textureMode

protected Sphere.TextureMode textureMode
Constructor Detail

Sphere

public Sphere()

Sphere

public Sphere(java.lang.String name)
Constructs a sphere. By default the Sphere has not geometry data or center.

Parameters:
name - The name of the sphere.

Sphere

public Sphere(java.lang.String name,
              int zSamples,
              int radialSamples,
              float radius)
Constructs a sphere with center at the origin. For details, see the other constructor.

Parameters:
name - Name of sphere.
zSamples - The samples along the Z.
radialSamples - The samples along the radial.
radius - Radius of the sphere.
See Also:
Sphere(java.lang.String, com.jme.math.Vector3f, int, int, float)

Sphere

public Sphere(java.lang.String name,
              Vector3f center,
              int zSamples,
              int radialSamples,
              float radius)
Constructs a sphere. All geometry data buffers are updated automatically. Both zSamples and radialSamples increase the quality of the generated sphere.

Parameters:
name - Name of the sphere.
center - Center of the sphere.
zSamples - The number of samples along the Z.
radialSamples - The number of samples along the radial.
radius - The radius of the sphere.

Sphere

public Sphere(java.lang.String name,
              Vector3f center,
              int zSamples,
              int radialSamples,
              float radius,
              boolean useEvenSlices)
Constructs a sphere. Additional arg to evenly space latitudinal slices

Parameters:
name - Name of the sphere.
center - Center of the sphere.
zSamples - The number of samples along the Z.
radialSamples - The number of samples along the radial.
radius - The radius of the sphere.
useEvenSlices - Slice sphere evenly along the Z axis
Method Detail

getCenter

public Vector3f getCenter()
Returns the center of this sphere.

Returns:
The sphere's center.

getRadialSamples

public int getRadialSamples()

getRadius

public float getRadius()

getTextureMode

public Sphere.TextureMode getTextureMode()
Returns:
Returns the textureMode.

getZSamples

public int getZSamples()

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class TriMesh
Throws:
java.io.IOException

setCenter

public void setCenter(Vector3f aCenter)
Deprecated. Use updateGeometry(Vector3f,int,int,float) instead


setData

public void setData(Vector3f center,
                    int zSamples,
                    int radialSamples,
                    float radius)
Deprecated. Use updateGeometry(Vector3f,int,int,float) instead


setTextureMode

@Deprecated
public void setTextureMode(int textureMode)
Deprecated. 

Parameters:
textureMode - The textureMode to set.

setTextureMode

public void setTextureMode(Sphere.TextureMode textureMode)
Parameters:
textureMode - The textureMode to set.

updateGeometry

public void updateGeometry(Vector3f center,
                           int zSamples,
                           int radialSamples,
                           float radius)
Changes the information of the sphere into the given values.

Parameters:
center - the center of the sphere.
zSamples - the number of zSamples of the sphere.
radialSamples - the number of radial samples of the sphere.
radius - the radius of the sphere.

updateGeometry

public void updateGeometry(Vector3f center,
                           int zSamples,
                           int radialSamples,
                           float radius,
                           boolean useEvenSlices)

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class TriMesh
Throws:
java.io.IOException