com.jme3.scene.shape
Class Cylinder

java.lang.Object
  extended by com.jme3.scene.Mesh
      extended by com.jme3.scene.shape.Cylinder
All Implemented Interfaces:
Savable, java.lang.Cloneable

public class Cylinder
extends Mesh

A simple cylinder, defined by it's height and radius. (Ported to jME3)


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme3.scene.Mesh
Mesh.Mode
 
Constructor Summary
Cylinder()
          Default constructor for serialization only.
Cylinder(int axisSamples, int radialSamples, float radius, float height)
          Creates a new Cylinder.
Cylinder(int axisSamples, int radialSamples, float radius, float height, boolean closed)
          Creates a new Cylinder.
Cylinder(int axisSamples, int radialSamples, float radius, float height, boolean closed, boolean inverted)
          Creates a new Cylinder.
Cylinder(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 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.jme3.scene.Mesh
clearBuffer, clone, cloneForAnim, collideWith, createCollisionData, deepClone, extractVertexData, generateBindPose, getBound, getBuffer, getBufferList, getBuffers, getElementLengths, getFloatBuffer, getId, getIndexBuffer, getIndicesAsList, getLineWidth, getLodLevel, getMaxNumWeights, getMode, getModeStart, getNumLodLevels, getPointSize, getShortBuffer, getTriangle, getTriangle, getTriangle, getTriangleCount, getTriangleCount, getVertexCount, prepareForAnim, scaleTextureCoordinates, setBound, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setDynamic, setElementLengths, setId, setInterleaved, setLineWidth, setLodLevels, setMaxNumWeights, setMode, setModeStart, setPointSize, setStatic, setStreamed, updateBound, updateCounts
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cylinder

public Cylinder()
Default constructor for serialization only. Do not use.


Cylinder

public Cylinder(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:
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(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:
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(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:
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(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

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.

read

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

write

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