com.jme3.scene.shape
Class AbstractBox

java.lang.Object
  extended by com.jme3.scene.Mesh
      extended by com.jme3.scene.shape.AbstractBox
All Implemented Interfaces:
Savable, java.lang.Cloneable
Direct Known Subclasses:
Box, StripBox

public abstract class AbstractBox
extends Mesh

An eight sided box.

A Box is defined by a minimal point and a maximal point. The eight vertices that make the box are then computed, they are computed in such a way as to generate an axis-aligned box.

This class does not control how the geometry data is generated, see Box for that.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme3.scene.Mesh
Mesh.Mode
 
Field Summary
 Vector3f center
           
 float xExtent
           
 float yExtent
           
 float zExtent
           
 
Constructor Summary
AbstractBox()
           
 
Method Summary
protected  Vector3f[] computeVertices()
          Gets the array or vectors representing the 8 vertices of the box.
protected abstract  void duUpdateGeometryIndices()
          Convert the indices into the list of vertices that define the box's geometry.
protected abstract  void duUpdateGeometryNormals()
          Update the normals of each of the box's planes.
protected abstract  void duUpdateGeometryTextures()
          Update the points that define the texture of the box.
protected abstract  void duUpdateGeometryVertices()
          Update the position of the vertices that define the box.
 Vector3f getCenter()
          Get the center point of this box.
 float getXExtent()
          Get the x-axis size (extent) of this box.
 float getYExtent()
          Get the y-axis size (extent) of this box.
 float getZExtent()
          Get the z-axis size (extent) of this box.
 void read(JmeImporter e)
           
 void updateGeometry()
          Rebuilds the box after a property has been directly altered.
 void updateGeometry(Vector3f center, float x, float y, float z)
          Rebuilds this box based on a new set of parameters.
 void updateGeometry(Vector3f minPoint, Vector3f maxPoint)
          Rebuilds this box 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
 

Field Detail

center

public final Vector3f center

xExtent

public float xExtent

yExtent

public float yExtent

zExtent

public float zExtent
Constructor Detail

AbstractBox

public AbstractBox()
Method Detail

computeVertices

protected final Vector3f[] computeVertices()
Gets the array or vectors representing the 8 vertices of the box.

Returns:
a newly created array of vertex vectors.

duUpdateGeometryIndices

protected abstract void duUpdateGeometryIndices()
Convert the indices into the list of vertices that define the box's geometry.


duUpdateGeometryNormals

protected abstract void duUpdateGeometryNormals()
Update the normals of each of the box's planes.


duUpdateGeometryTextures

protected abstract void duUpdateGeometryTextures()
Update the points that define the texture of the box.

It's a one-to-one ratio, where each plane of the box has it's own copy of the texture. That is, the texture is repeated one time for each face.


duUpdateGeometryVertices

protected abstract void duUpdateGeometryVertices()
Update the position of the vertices that define the box.

These eight points are determined from the minimum and maximum point.


getCenter

public final Vector3f getCenter()
Get the center point of this box.


getXExtent

public final float getXExtent()
Get the x-axis size (extent) of this box.


getYExtent

public final float getYExtent()
Get the y-axis size (extent) of this box.


getZExtent

public final float getZExtent()
Get the z-axis size (extent) of this box.


updateGeometry

public final void updateGeometry()
Rebuilds the box after a property has been directly altered.

For example, if you call getXExtent().x = 5.0f then you will need to call this method afterwards in order to update the box.


updateGeometry

public final void updateGeometry(Vector3f center,
                                 float x,
                                 float y,
                                 float z)
Rebuilds this box based on a new set of parameters.

Note that the actual sides will be twice the given extent values because the box extends in both directions from the center for each extent.

Parameters:
center - the center of the box.
x - the x extent of the box, in each directions.
y - the y extent of the box, in each directions.
z - the z extent of the box, in each directions.

updateGeometry

public final void updateGeometry(Vector3f minPoint,
                                 Vector3f maxPoint)
Rebuilds this box based on a new set of parameters.

The box is updated so that the two opposite corners are minPoint and maxPoint, the other corners are created from those two positions.

Parameters:
minPoint - the new minimum point of the box.
maxPoint - the new maximum point of the box.

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