com.jme.scene.shape
Class OrientedBox

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

public class OrientedBox
extends TriMesh

Started Date: Aug 22, 2004

This primitive represents a box that has options to orient it acording to its X/Y/Z axis. It is used to create an OrientedBoundingBox mostly.

Author:
Jack Lindamood
See Also:
Serialized Form

Field Summary
protected  Vector3f center
          Center of the Oriented Box.
 boolean correctCorners
          If true, the box's vectorStore array correctly represnts the box's corners.
protected  Vector3f extent
          Extents of the box along the x,y,z axis.
protected  ColorRGBA meshColor
          Per vertex color of the drawn OrientedBox on computeInformation calls
protected  Vector3f[] normalStore
          Vector array used to store the box's normals.
protected  Vector2f texBotLeft
          Texture coordintae values for the corners of the box.
protected  Vector2f texBotRight
          Texture coordintae values for the corners of the box.
protected  Vector2f texTopLeft
          Texture coordintae values for the corners of the box.
protected  Vector2f texTopRight
          Texture coordintae values for the corners of the box.
 Vector3f[] vectorStore
          Vector array used to store the array of 8 corners the box has.
protected  Vector3f xAxis
          X axis of the Oriented Box.
protected  Vector3f yAxis
          Y axis of the Oriented Box.
protected  Vector3f zAxis
          Z axis of the Oriented Box.
 
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
OrientedBox(java.lang.String name)
          Creates a new OrientedBox with the given name.
 
Method Summary
 void computeCorners()
          Sets the vectorStore information to the 8 corners of the box.
 void computeInformation()
          Takes the plane and center information and creates the correct vertex,normal,color,texture,index information to represent the OrientedBox.
 Vector3f getCenter()
          Returns the center of the box.
 Vector3f getExtent()
          Returns the box's extent vector along the x,y,z.
 ColorRGBA getMeshColor()
          Returns this OB's per vertex color.
 Vector3f getxAxis()
          Returns the x axis of this box.
 Vector3f getyAxis()
          Gets the Y axis of this OB.
 Vector3f getzAxis()
          Returns the Z axis of this OB.
 boolean isCorrectCorners()
          Returns if the corners are set corectly.
 void setCenter(Vector3f center)
          Sets the box's center to the given value.
 void setExtent(Vector3f extent)
          Sets the box's extent vector to the given value.
 void setMeshColor(ColorRGBA meshColor)
          Sets the per vertex color of this OB.
 void setxAxis(Vector3f xAxis)
          Sets the x axis of this OB.
 void setyAxis(Vector3f yAxis)
          Sets the Y axis of this OB.
 void setzAxis(Vector3f zAxis)
          Sets the Z axis of this OB.
 
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

center

protected Vector3f center
Center of the Oriented Box.


xAxis

protected Vector3f xAxis
X axis of the Oriented Box.


yAxis

protected Vector3f yAxis
Y axis of the Oriented Box.


zAxis

protected Vector3f zAxis
Z axis of the Oriented Box.


extent

protected Vector3f extent
Extents of the box along the x,y,z axis.


meshColor

protected ColorRGBA meshColor
Per vertex color of the drawn OrientedBox on computeInformation calls


texTopRight

protected Vector2f texTopRight
Texture coordintae values for the corners of the box.


texTopLeft

protected Vector2f texTopLeft
Texture coordintae values for the corners of the box.


texBotRight

protected Vector2f texBotRight
Texture coordintae values for the corners of the box.


texBotLeft

protected Vector2f texBotLeft
Texture coordintae values for the corners of the box.


vectorStore

public Vector3f[] vectorStore
Vector array used to store the array of 8 corners the box has.


normalStore

protected Vector3f[] normalStore
Vector array used to store the box's normals.


correctCorners

public boolean correctCorners
If true, the box's vectorStore array correctly represnts the box's corners.

Constructor Detail

OrientedBox

public OrientedBox(java.lang.String name)
Creates a new OrientedBox with the given name.

Parameters:
name - The name of the new box.
Method Detail

computeInformation

public void computeInformation()
Takes the plane and center information and creates the correct vertex,normal,color,texture,index information to represent the OrientedBox.


computeCorners

public void computeCorners()
Sets the vectorStore information to the 8 corners of the box.


getCenter

public Vector3f getCenter()
Returns the center of the box.

Returns:
The box's center.

setCenter

public void setCenter(Vector3f center)
Sets the box's center to the given value. Shallow copy only.

Parameters:
center - The box's new center.

getExtent

public Vector3f getExtent()
Returns the box's extent vector along the x,y,z.

Returns:
The box's extent vector.

setExtent

public void setExtent(Vector3f extent)
Sets the box's extent vector to the given value. Shallow copy only.

Parameters:
extent - The box's new extent.

getxAxis

public Vector3f getxAxis()
Returns the x axis of this box.

Returns:
This OB's x axis.

setxAxis

public void setxAxis(Vector3f xAxis)
Sets the x axis of this OB. Shallow copy.

Parameters:
xAxis - The new x axis.

getyAxis

public Vector3f getyAxis()
Gets the Y axis of this OB.

Returns:
This OB's Y axis.

setyAxis

public void setyAxis(Vector3f yAxis)
Sets the Y axis of this OB. Shallow copy.

Parameters:
yAxis - The new Y axis.

getzAxis

public Vector3f getzAxis()
Returns the Z axis of this OB.

Returns:
The Z axis.

setzAxis

public void setzAxis(Vector3f zAxis)
Sets the Z axis of this OB. Shallow copy.

Parameters:
zAxis - The new Z axis.

getMeshColor

public ColorRGBA getMeshColor()
Returns this OB's per vertex color.

Returns:
This OB's per vertex color.

setMeshColor

public void setMeshColor(ColorRGBA meshColor)
Sets the per vertex color of this OB. Shallow copy.

Parameters:
meshColor - The new per vertex color.

isCorrectCorners

public boolean isCorrectCorners()
Returns if the corners are set corectly.

Returns:
True if the vectorStore is correct.