com.jme.scene.shape
Class Sphere

java.lang.Object
  extended bycom.jme.scene.Spatial
      extended bycom.jme.scene.Geometry
          extended bycom.jme.scene.TriMesh
              extended bycom.jme.scene.shape.Sphere
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BoundingSphere

public class Sphere
extends TriMesh

Sphere is um ... a sphere :)

Version:
$Id: Sphere.java,v 1.7 2004/09/14 21:52:21 mojomonkey Exp $
Author:
Joshua Slack
See Also:
Serialized Form

Field Summary
 Vector3f center
           
 float radius
           
 
Fields inherited from class com.jme.scene.TriMesh
indices, triangleQuantity
 
Fields inherited from class com.jme.scene.Geometry
bound, color, colorBuf, normal, normBuf, texBuf, texture, vertBuf, vertex, vertQuantity
 
Fields inherited from class com.jme.scene.Spatial
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
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.
 
Method Summary
 Vector3f getCenter()
          Returns the center of this sphere.
 void setCenter(Vector3f aCenter)
          Sets the center of this sphere.
 void setData(Vector3f center, int zSamples, int radialSamples, float radius, boolean updateBuffers)
          Changes the information of the sphere into the given values.
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, draw, drawBounds, findCollisions, findTriangleCollision, findTrianglePick, findWorldRotMat, getIndexAsBuffer, getIndices, getMeshAsTriangles, getTriangle, getTriangle, getTriangleQuantity, hasCollision, hasTriangleCollision, putClone, reconstruct, setIndexBuffer, setIndices, updateCollisionTree, updateIndexBuffer
 
Methods inherited from class com.jme.scene.Geometry
applyRenderState, applyStates, copyTextureCoords, findPick, getAllTextures, getCloneID, getColorAsFloatBuffer, getColors, getModelBound, getNormalAsFloatBuffer, getNormals, getNumberOfUnits, getTextureAsFloatBuffer, getTextureAsFloatBuffer, getTextures, getTextures, getVBOColorID, getVBONormalID, getVBOTextureID, getVBOVertexID, getVerticeAsFloatBuffer, getVertices, getVertQuantity, isVBOColorEnabled, isVBONormalEnabled, isVBOTextureEnabled, isVBOVertexEnabled, randomVertice, reconstruct, setAllTextures, setColor, setColors, setFloatBuffer, setForceView, setModelBound, setNormal, setNormalBuffer, setNormals, setRandomColors, setSolidColor, setTexture, setTexture, setTextureBuffer, setTextureCoord, setTextures, setTextures, setVBOColorEnabled, setVBOColorID, setVBONormalEnabled, setVBONormalID, setVBOTextureEnabled, setVBOTextureID, setVBOVertexEnabled, setVBOVertexID, setVertex, setVertexBuffer, setVertices, updateColorBuffer, updateColorBuffer, updateModelBound, updateNormalBuffer, updateNormalBuffer, updateTextureBuffer, updateTextureBuffer, updateTextureBuffer, updateVertexBuffer, updateVertexBuffer, updateWorldBound
 
Methods inherited from class com.jme.scene.Spatial
addController, applyDefaultStates, calculateCollisions, calculatePick, clearCurrentState, clearCurrentStates, clearRenderState, getController, getControllers, getCurrentState, getLastFrustumIntersection, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getName, getParent, getRenderQueueMode, getRenderStateList, getTextureCombineMode, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, isForceCulled, isForceView, onDraw, onDrawBounds, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeFromParent, setForceCull, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setName, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setWorldBound, setZOrder, toString, updateGeometricState, updateRenderState, updateRenderState, updateWorldData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

radius

public float radius

center

public Vector3f center
Constructor Detail

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.
Method Detail

setData

public void setData(Vector3f center,
                    int zSamples,
                    int radialSamples,
                    float radius,
                    boolean updateBuffers)
Changes the information of the sphere into the given values. The boolean at the end signals if buffer data should be updated as well. If the sphere is to be rendered, then that value should be true.

Parameters:
center - The new center of the sphere.
zSamples - The new number of zSamples of the sphere.
radialSamples - The new number of radial samples of the sphere.
radius - The new radius of the sphere.
updateBuffers - If true, buffer information is updated as well.

getCenter

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

Returns:
The sphere's center.

setCenter

public void setCenter(Vector3f aCenter)
Sets the center of this sphere. Note that other information (such as geometry buffers and actual vertex information) is not changed. In most cases, you'll want to use setData()

Parameters:
aCenter - The new center.
See Also:
setData(com.jme.math.Vector3f, int, int, float, boolean)