Package com.ardor3d.scenegraph.shape
Class Cylinder
java.lang.Object
com.ardor3d.scenegraph.Spatial
com.ardor3d.scenegraph.Mesh
com.ardor3d.scenegraph.shape.Cylinder
- All Implemented Interfaces:
Pickable
,Hintable
,Renderable
,Savable
- Direct Known Subclasses:
Cone
Cylinder
provides an extension of Mesh
. A Cylinder
is defined by a height and
radius. The center of the Cylinder is the origin.-
Field Summary
Fields inherited from class com.ardor3d.scenegraph.Mesh
_defaultColor, _isVisible, _lightState, _meshData, _modelBound, _states, RENDER_VERTEX_ONLY
Fields inherited from class com.ardor3d.scenegraph.Spatial
_controllers, _delegateMap, _dirtyMark, _frustumIntersects, _listener, _localTransform, _name, _parent, _queueDistance, _renderStateList, _sceneHints, _userData, _worldBound, _worldTransform, ON_DIRTY_ATTACHED, ON_DIRTY_BOUNDING, ON_DIRTY_RENDERSTATE, ON_DIRTY_TRANSFORM, ON_DIRTY_TRANSFORM_ONLY
-
Constructor Summary
ConstructorDescriptionCylinder()
Creates a new Cylinder.Cylinder
(String name, int axisSamples, int radialSamples, double radius, double height, boolean closed) Creates a new Cylinder.Cylinder
(String name, int axisSamples, int radialSamples, double radius, double height, boolean closed, boolean inverted) Creates a new Cylinder. -
Method Summary
Modifier and TypeMethodDescriptionint
double
int
double
boolean
isClosed()
boolean
void
read
(InputCapsule capsule) void
setHeight
(double height) void
setRadius
(double radius) Change the radius of this cylinder.void
setRadius1
(double radius) Set the top radius of the 'cylinder' to differ from the bottom radius.void
setRadius2
(double radius) Set the bottom radius of the 'cylinder' to differ from the top radius.void
write
(OutputCapsule capsule) Methods inherited from class com.ardor3d.scenegraph.Mesh
applyWorldRenderStates, draw, getClassTag, getDefaultColor, getLightState, getMeshData, getModelBound, getModelBound, getWorldNormals, getWorldRenderState, getWorldVectors, intersectsPrimitivesWhere, intersectsWorldBound, intersectsWorldBoundsWhere, isVisible, makeCopy, makeInstanced, render, render, renderArrays, renderVBO, reorderIndices, reorderVertexData, reorderVertexData, setDefaultColor, setDefaultColor, setLightState, setMeshData, setModelBound, setModelBound, setRandomColors, setSolidColor, setVisible, sortLights, supportsBoundsIntersectionRecord, supportsPrimitivesIntersectionRecord, updateModelBound, updateWorldBound
Methods inherited from class com.ardor3d.scenegraph.Spatial
acceptVisitor, addController, addTranslation, addTranslation, clearControllers, clearDirty, clearDirty, clearRenderState, getController, getControllerCount, getControllers, getCurrentRenderDelegate, getLastFrustumIntersection, getListener, getLocalLastFrustumIntersection, getLocalRenderState, getLocalRenderStates, getName, getParent, getParentHintable, getRenderDelegate, getRotation, getScale, getSceneHints, getTransform, getTranslation, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, isDirty, localToWorld, markDirty, markDirty, onDraw, propagateBoundToRoot, propagateDirtyDown, propagateDirtyUp, propagateStatesFromRoot, propageEventUp, removeController, removeController, removeFromParent, setLastFrustumIntersection, setListener, setName, setParent, setRenderDelegate, setRenderState, setRotation, setRotation, setScale, setScale, setScale, setTransform, setTranslation, setTranslation, setUserData, setWorldRotation, setWorldRotation, setWorldScale, setWorldScale, setWorldScale, setWorldTransform, setWorldTranslation, setWorldTranslation, toString, updateChildren, updateControllers, updateGeometricState, updateGeometricState, updateWorldRenderStates, updateWorldRenderStates, updateWorldTransform, worldToLocal
-
Constructor Details
-
Cylinder
public Cylinder() -
Cylinder
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(String name, int axisSamples, int radialSamples, double radius, double 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(String name, int axisSamples, int radialSamples, double radius, double 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 surfaceinverted
- true to create a cylinder that is meant to be viewed from the interior.
-
-
Method Details
-
getHeight
public double getHeight()- Returns:
- Returns the height.
-
setHeight
public void setHeight(double height) - Parameters:
height
- The height to set.
-
getRadius
public double getRadius()- Returns:
- Returns the radius.
-
setRadius
public void setRadius(double radius) Change the radius of this cylinder. This resets any second radius.- Parameters:
radius
- The radius to set.
-
setRadius1
public void setRadius1(double radius) Set the top radius of the 'cylinder' to differ from the bottom radius.- Parameters:
radius
- The first radius to set.- See Also:
-
setRadius2
public void setRadius2(double radius) Set the bottom radius of the 'cylinder' to differ from the top radius. This makes the Mesh be a frustum of pyramid, or if set to 0, a cone.- Parameters:
radius
- The second radius to set.- See Also:
-
getAxisSamples
public int getAxisSamples()- Returns:
- the number of samples along the cylinder axis
-
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
-
getRadialSamples
public int getRadialSamples()- Returns:
- number of samples around cylinder
-
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classMesh
- Parameters:
capsule
- the capsule- Throws:
IOException
- Signals that an I/O exception has occurred.- See Also:
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classMesh
- Parameters:
capsule
- the input capsule- Throws:
IOException
- Signals that an I/O exception has occurred.- See Also:
-