com.jme.scene.shape
Class OrientedBox

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.OrientedBox
All Implemented Interfaces:
Savable, java.io.Serializable

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.

Version:
$Revision: 4131 $, $Date: 2009-03-19 20:15:28 +0000 (Thu, 19 Mar 2009) $
Author:
Jack Lindamood
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
protected  Vector3f center
          Center of the Oriented Box.
 boolean correctCorners
          Have the corners of the box (as stored in the #vectorStore array) been set to correctly represent the box’s corners or not.
protected  Vector3f extent
          Extents of the box along the x,y,z axis.
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
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
OrientedBox(java.lang.String name)
          Creates a new OrientedBox with the given name.
OrientedBox(java.lang.String name, Vector3f center, Vector2f topRight, Vector2f topLeft, Vector2f bottomRight, Vector2f bottomLeft)
          Create a new oriented box.
 
Method Summary
 void computeCorners()
          Deprecated. will be made private.
 void computeInformation()
          Deprecated. will be made private.
 Vector3f getCenter()
          Returns the center of the box.
 Vector3f getExtent()
          Returns the box's extent vector along the x,y,z.
 Vector3f getxAxis()
          Deprecated. Use getXAxis() instead
 Vector3f getXAxis()
           
 Vector3f getyAxis()
          Deprecated. Use getYAxis() instead
 Vector3f getYAxis()
           
 Vector3f getzAxis()
          Deprecated. Use getZAxis() instead
 Vector3f getZAxis()
           
 boolean isCorrectCorners()
          Have the corners of the box been set correctly.
 void read(JMEImporter e)
           
 void setCenter(Vector3f center)
          Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.
 void setExtent(Vector3f extent)
          Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.
 void setxAxis(Vector3f xAxis)
          Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.
 void setyAxis(Vector3f yAxis)
          Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.
 void setzAxis(Vector3f zAxis)
          Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.
 void updateGeometry()
          Update the box’s geometry after a property has been altered directly.
 void updateGeometry(Vector3f center, Vector2f topRight, Vector2f topLeft, Vector2f bottomRight, Vector2f bottomLeft)
           
 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
 

Field Detail

center

protected Vector3f center
Center of the Oriented Box.


correctCorners

public boolean correctCorners
Have the corners of the box (as stored in the #vectorStore array) been set to correctly represent the box’s corners or not.


extent

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


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.


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.

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.

OrientedBox

public OrientedBox(java.lang.String name,
                   Vector3f center,
                   Vector2f topRight,
                   Vector2f topLeft,
                   Vector2f bottomRight,
                   Vector2f bottomLeft)
Create a new oriented box.

The box is initially configured based on the supplied texture co-ordinate points.

Parameters:
name - the name of the box.
center - point at the center of the box.
topRight - the top right hand corner of the box.
topLeft - the top left hand corner of the box.
bottomRight - the bottom right hand corner of the box.
bottomLeft - the bottom left hand corner of the box.
Method Detail

computeCorners

public void computeCorners()
Deprecated. will be made private.

Sets the vectorStore information to the 8 corners of the box.


computeInformation

public void computeInformation()
Deprecated. will be made private.

Takes the plane and center information and creates the correct vertex,normal,color,texture,index information to represent the OrientedBox.


getCenter

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

Returns:
The box's center.

getExtent

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

Returns:
The box's extent vector.

getxAxis

public Vector3f getxAxis()
Deprecated. Use getXAxis() instead


getXAxis

public Vector3f getXAxis()

getyAxis

public Vector3f getyAxis()
Deprecated. Use getYAxis() instead


getYAxis

public Vector3f getYAxis()

getzAxis

public Vector3f getzAxis()
Deprecated. Use getZAxis() instead


getZAxis

public Vector3f getZAxis()

isCorrectCorners

public boolean isCorrectCorners()
Have the corners of the box been set correctly.

Returns:
true if the vector store is correct, false otherwise.

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

setCenter

public void setCenter(Vector3f center)
Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.


setExtent

public void setExtent(Vector3f extent)
Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.


setxAxis

public void setxAxis(Vector3f xAxis)
Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.


setyAxis

public void setyAxis(Vector3f yAxis)
Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.


setzAxis

public void setzAxis(Vector3f zAxis)
Deprecated. use #updateGeometry(Vector3f, Vector2f, Vector2f, Vector2f, Vector2f, boolean) instead.


updateGeometry

public void updateGeometry()
Update the box’s geometry after a property has been altered directly.


updateGeometry

public void updateGeometry(Vector3f center,
                           Vector2f topRight,
                           Vector2f topLeft,
                           Vector2f bottomRight,
                           Vector2f bottomLeft)

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