com.jme.scene.shape
Class Cylinder

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.Cylinder
All Implemented Interfaces:
Savable, java.io.Serializable
Direct Known Subclasses:
Cone

public class Cylinder
extends TriMesh

A simple cylinder, defined by it's height and radius.

Version:
$Revision: 4131 $, $Date: 2009-03-19 20:15:28 +0000 (Thu, 19 Mar 2009) $
Author:
Mark Powell
See Also:
Serialized Form

Nested Class Summary
 
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
 
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
Cylinder()
           
Cylinder(java.lang.String name, int axisSamples, int radialSamples, float radius, float height)
          Creates a new Cylinder.
Cylinder(java.lang.String name, int axisSamples, int radialSamples, float radius, float height, boolean closed)
          Creates a new Cylinder.
Cylinder(java.lang.String name, int axisSamples, int radialSamples, float radius, float height, boolean closed, boolean inverted)
          Creates a new Cylinder.
Cylinder(java.lang.String name, int axisSamples, int radialSamples, float radius, float radius2, float height, boolean closed, boolean inverted)
           
 
Method Summary
 int getAxisSamples()
           
 float getHeight()
           
 int getRadialSamples()
           
 float getRadius()
           
 float getRadius2()
           
 boolean isClosed()
           
 boolean isInverted()
           
 void read(JMEImporter e)
           
 void recomputeGeometry(int axisSamples, int radialSamples, float radius, float height, boolean closed, boolean inverted)
          Deprecated. use updateGeometry(int, int, float, float, float, boolean, boolean).
 void setHalfAngle(float radians)
          Set the half angle of the cone.
 void setRadius(float radius)
          Deprecated. use recomputeGeometry(int, int, float, float, boolean, boolean).
 void setRadius1(float radius)
          Deprecated. use recomputeGeometry(int, int, float, float, boolean, boolean).
 void setRadius2(float radius2)
          Deprecated. use recomputeGeometry(int, int, float, float, boolean, boolean).
 void updateGeometry(int axisSamples, int radialSamples, float radius, float radius2, float height, boolean closed, boolean inverted)
          Rebuilds the cylinder based on a new set of parameters.
 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
 

Constructor Detail

Cylinder

public Cylinder()

Cylinder

public Cylinder(java.lang.String name,
                int axisSamples,
                int radialSamples,
                float radius,
                float height)
Creates a new Cylinder. By default its center is the origin. Usually, a higher sample number creates a better looking cylinder, but at the cost of more vertex information.

Parameters:
name - The name of this Cylinder.
axisSamples - Number of triangle samples along the axis.
radialSamples - Number of triangle samples along the radial.
radius - The radius of the cylinder.
height - The cylinder's height.

Cylinder

public Cylinder(java.lang.String name,
                int axisSamples,
                int radialSamples,
                float radius,
                float height,
                boolean closed)
Creates a new Cylinder. By default its center is the origin. Usually, a higher sample number creates a better looking cylinder, but at the cost of more vertex information.
If the cylinder is closed the texture is split into axisSamples parts: top most and bottom most part is used for top and bottom of the cylinder, rest of the texture for the cylinder wall. The middle of the top is mapped to texture coordinates (0.5, 1), bottom to (0.5, 0). Thus you need a suited distorted texture.

Parameters:
name - The name of this Cylinder.
axisSamples - Number of triangle samples along the axis.
radialSamples - Number of triangle samples along the radial.
radius - The radius of the cylinder.
height - The cylinder's height.
closed - true to create a cylinder with top and bottom surface

Cylinder

public Cylinder(java.lang.String name,
                int axisSamples,
                int radialSamples,
                float radius,
                float height,
                boolean closed,
                boolean inverted)
Creates a new Cylinder. By default its center is the origin. Usually, a higher sample number creates a better looking cylinder, but at the cost of more vertex information.
If the cylinder is closed the texture is split into axisSamples parts: top most and bottom most part is used for top and bottom of the cylinder, rest of the texture for the cylinder wall. The middle of the top is mapped to texture coordinates (0.5, 1), bottom to (0.5, 0). Thus you need a suited distorted texture.

Parameters:
name - The name of this Cylinder.
axisSamples - Number of triangle samples along the axis.
radialSamples - Number of triangle samples along the radial.
radius - The radius of the cylinder.
height - The cylinder's height.
closed - true to create a cylinder with top and bottom surface
inverted - true to create a cylinder that is meant to be viewed from the interior.

Cylinder

public Cylinder(java.lang.String name,
                int axisSamples,
                int radialSamples,
                float radius,
                float radius2,
                float height,
                boolean closed,
                boolean inverted)
Method Detail

getAxisSamples

public int getAxisSamples()
Returns:
the number of samples along the cylinder axis

getHeight

public float getHeight()
Returns:
Returns the height.

getRadialSamples

public int getRadialSamples()
Returns:
number of samples around cylinder

getRadius

public float getRadius()
Returns:
Returns the radius.

getRadius2

public float getRadius2()

isClosed

public boolean isClosed()
Returns:
true if end caps are used.

isInverted

public boolean isInverted()
Returns:
true if normals and uvs are created for interior use

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

recomputeGeometry

public void recomputeGeometry(int axisSamples,
                              int radialSamples,
                              float radius,
                              float height,
                              boolean closed,
                              boolean inverted)
Deprecated. use updateGeometry(int, int, float, float, float, boolean, boolean).


setHalfAngle

public void setHalfAngle(float radians)
Set the half angle of the cone.

Parameters:
radians -

setRadius

public void setRadius(float radius)
Deprecated. use recomputeGeometry(int, int, float, float, boolean, boolean).

Set the radius of this cylinder.

This will also reset any second radius value on the cylinder.

Note: this method causes the tri-mesh geometry data to be recalculated, see the package description for more information about this.

Parameters:
radius - the new radius.

setRadius1

public void setRadius1(float radius)
Deprecated. use recomputeGeometry(int, int, float, float, boolean, boolean).

Set the top radius of the 'cylinder' to differ from the bottom radius.

Note: this method causes the tri-mesh geometry data to be recalculated, see the package description for more information about this.

Parameters:
radius - the first radius to set.
See Also:
Cone}

setRadius2

public void setRadius2(float radius2)
Deprecated. use recomputeGeometry(int, int, float, float, boolean, boolean).

Set the bottom radius of the 'cylinder' to differ from the top radius. This makes the Geometry be a frustum of pyramid, or if set to 0, a cone.

Note: this method causes the tri-mesh geometry data to be recalculated, see the package description for more information about this.

Parameters:
radius - the second radius to set.
See Also:
Cone}

updateGeometry

public void updateGeometry(int axisSamples,
                           int radialSamples,
                           float radius,
                           float radius2,
                           float height,
                           boolean closed,
                           boolean inverted)
Rebuilds the cylinder based on a new set of parameters.

Parameters:
axisSamples - the number of samples along the axis.
radialSamples - the number of samples around the radial.
radius - the radius of the bottom of the cylinder.
radius2 - the radius of the top of the cylinder.
height - the cylinder's height.
closed - should the cylinder have top and bottom surfaces.
inverted - is the cylinder is meant to be viewed from the inside.

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