org.jdesktop.wonderland.client.jme.utils.graphics
Class TexturedBox

java.lang.Object
  extended by com.jme.scene.Spatial
      extended by com.jme.scene.Node
          extended by org.jdesktop.wonderland.client.jme.utils.graphics.TexturedBox
All Implemented Interfaces:
com.jme.util.export.Savable, java.io.Serializable

public class TexturedBox
extends com.jme.scene.Node

A textured version of a JME Box. The given texture is displayed on multiple faces of the box. Derived from JME Box and presents a similar interface.

Author:
deronj
See Also:
Serialized Form

Nested Class Summary
protected static class TexturedBox.Face
          The ordinals of this enum are indices for faces[].
 
Nested classes/interfaces inherited from class com.jme.scene.Spatial
com.jme.scene.Spatial.CullHint, com.jme.scene.Spatial.LightCombineMode, com.jme.scene.Spatial.NormalsMode, com.jme.scene.Spatial.TextureCombineMode
 
Field Summary
static int BACK
          Designates the back (+z) face of the box.
static int BOTTOM
          Designates the bottom side (-y) face of the box.
 com.jme.math.Vector3f center
          The center of the box (in local coordinates)
protected  com.jme.renderer.ColorRGBA color
          The lit ambient-and-diffuse color.
protected  com.jme.scene.TriMesh[] faces
          The geometry of the faces.
static int FRONT
          Designates the front (+z) face of the box.
static int LEFT
          Designates the left side (-x) face of the box.
static int RIGHT
          Designates the right side (+x) face of the box.
protected  com.jme.image.Texture texture
          The texture which is displayed on the textured surfaces of the box.
protected  int texturedFaces
          A bitmask which indicates which faces are textured.
static int TOP
          Designates the top side (+y) face of the box.
 float xExtent
          Extent along the X axis (in both directions).
 float yExtent
          Extent along the Y axis (in both directions).
 float zExtent
          Extent along the Z axis (in both directions).
 
Fields inherited from class com.jme.scene.Node
children
 
Fields inherited from class com.jme.scene.Spatial
cullHint, frustrumIntersects, geometricalControllers, geometricUpdateListeners, 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
TexturedBox(com.jme.image.Texture texture)
          Internal Only: Create a new instance of TexturedBox.
TexturedBox(com.jme.image.Texture texture, int texturedFaces)
          Internal Only: Create a new instance of TexturedBox.
TexturedBox(com.jme.image.Texture texture, int texturedFaces, java.lang.String name)
          Create a new instance of Textured object.
TexturedBox(com.jme.image.Texture texture, int texturedFaces, java.lang.String name, com.jme.math.Vector3f center, float xExtent, float yExtent, float zExtent)
          Create a new instance of TexturedBox.
TexturedBox(com.jme.image.Texture texture, int texturedFaces, java.lang.String name, com.jme.math.Vector3f min, com.jme.math.Vector3f max)
          Create a new instance of TexturedBox object.
TexturedBox(com.jme.image.Texture texture, java.lang.String name)
          Create a new instance of TexturedBox object.
TexturedBox(com.jme.image.Texture texture, java.lang.String name, com.jme.math.Vector3f center, float xExtent, float yExtent, float zExtent)
          Create a new instance of TexturedBox.
TexturedBox(com.jme.image.Texture texture, java.lang.String name, com.jme.math.Vector3f min, com.jme.math.Vector3f max)
          Create a new instance of TexturedBox object.
 
Method Summary
 java.lang.Object clone()
          Creates a new TexturedBox object containing the same data as this one.
 com.jme.math.Vector3f[] computeVertices()
           
 com.jme.math.Vector3f getCenter()
          Returns the current center of the box.
 com.jme.renderer.ColorRGBA getColor()
          Returns the lit ambient-and-diffuse color of this box.
 com.jme.image.Texture getTexture()
          Returns this box's texture.
 void read(com.jme.util.export.JMEImporter e)
           
 void setCenter(com.jme.math.Vector3f aCenter)
          Sets the center of the box.
 void setColor(com.jme.renderer.ColorRGBA color)
          Specify a new lit ambient-and-diffuse color for all sides of this box.
 void setData(com.jme.math.Vector3f center, float xExtent, float yExtent, float zExtent)
          Changes the data of the box so that its center is center and it extends in the x, y, and z directions by the given extent.
 void setData(com.jme.math.Vector3f minPoint, com.jme.math.Vector3f maxPoint)
          Changes the data of the box so that the two opposite corners are minPoint and maxPoint.
 void setTexture(com.jme.image.Texture texture)
          Specify a new texture.
 void write(com.jme.util.export.JMEExporter e)
           
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChild, attachChildAt, childChange, detachAllChildren, detachChild, detachChildAt, detachChildNamed, draw, findCollisions, findPick, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, hasCollision, lockBounds, lockMeshes, lockShadows, lockTransforms, setLive, setModelBound, sortLights, swapChildren, unlockBounds, unlockMeshes, unlockShadows, unlockTransforms, updateModelBound, updateWorldBound, updateWorldData, updateWorldVectors
 
Methods inherited from class com.jme.scene.Spatial
addController, addGeometricUpdateListener, calculateCollisions, calculatePick, clearControllers, clearRenderState, clearRenderState, getClassTag, getController, getControllerCount, getControllers, getCullHint, getGlowColor, getGlowScale, 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, isGlowEnabled, isLive, isVisible, localToWorld, lock, lock, lockBranch, lockMeshes, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeGeometricUpdateListener, removeUserData, rotateUpTo, setCullHint, setGlowColor, setGlowEnabled, setGlowScale, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setLocks, setLocks, setName, setNormalsMode, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setUserData, setVisible, setZOrder, setZOrder, toString, unlock, unlock, unlockBranch, unlockMeshes, updateGeometricState, updateRenderState, updateRenderState, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, worldToLocal
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Field Detail

BACK

public static int BACK
Designates the back (+z) face of the box.


RIGHT

public static int RIGHT
Designates the right side (+x) face of the box.


FRONT

public static int FRONT
Designates the front (+z) face of the box.


LEFT

public static int LEFT
Designates the left side (-x) face of the box.


TOP

public static int TOP
Designates the top side (+y) face of the box.


BOTTOM

public static int BOTTOM
Designates the bottom side (-y) face of the box.


texture

protected com.jme.image.Texture texture
The texture which is displayed on the textured surfaces of the box.


texturedFaces

protected int texturedFaces
A bitmask which indicates which faces are textured.


xExtent

public float xExtent
Extent along the X axis (in both directions).


yExtent

public float yExtent
Extent along the Y axis (in both directions).


zExtent

public float zExtent
Extent along the Z axis (in both directions).


center

public final com.jme.math.Vector3f center
The center of the box (in local coordinates)


faces

protected com.jme.scene.TriMesh[] faces
The geometry of the faces.


color

protected com.jme.renderer.ColorRGBA color
The lit ambient-and-diffuse color.

Constructor Detail

TexturedBox

public TexturedBox(com.jme.image.Texture texture)
Internal Only: Create a new instance of TexturedBox. The texture is displayed on the front face only. All other attributes must be supplied later.

Parameters:
texture - The texture to display on the box.

TexturedBox

public TexturedBox(com.jme.image.Texture texture,
                   int texturedFaces)
Internal Only: Create a new instance of TexturedBox. The texture is displayed on the specified faces. All other attributes must be supplied later.

Parameters:
texture - The texture to display on the box.
texturedFaces - Specifies the faces on which to display the texture. This is the logical OR of FRONT, BACK, etc.

TexturedBox

public TexturedBox(com.jme.image.Texture texture,
                   java.lang.String name)
Create a new instance of TexturedBox object. The texture is displayed on the front face only. The center and size vertice information must be supplied later.

Parameters:
texture - The texture to display on the box.
name - The name of the scene element.

TexturedBox

public TexturedBox(com.jme.image.Texture texture,
                   int texturedFaces,
                   java.lang.String name)
Create a new instance of Textured object. The center and size vertice information must be supplied later.

Parameters:
texture - The texture to display on the box.
texturedFaces - Specifies the faces on which to display the texture. This is the logical OR of FRONT, BACK, etc.
name - The name of the scene element.

TexturedBox

public TexturedBox(com.jme.image.Texture texture,
                   java.lang.String name,
                   com.jme.math.Vector3f min,
                   com.jme.math.Vector3f max)
Create a new instance of TexturedBox object. The given minimum and maximum points define the size of the box, but not it's orientation or position. You should use the setLocalTranslation and setLocalRotation for those attributes. The texture is displayed on the front face only.

Parameters:
texture - The texture to display on the box.
name - The name of the scene element.
min - The minimum point that defines the box.
max - The maximum point that defines the box.

TexturedBox

public TexturedBox(com.jme.image.Texture texture,
                   int texturedFaces,
                   java.lang.String name,
                   com.jme.math.Vector3f min,
                   com.jme.math.Vector3f max)
Create a new instance of TexturedBox object. The given minimum and maximum points define the size of the box, but not it's orientation or position. You should use the setLocalTranslation and setLocalRotation for those attributes. The texture is displayed on the specified faces.

Parameters:
texture - The texture to display on the box.
texturedFaces - Specifies the faces on which to display the texture. This is the logical OR of FRONT, BACK, etc.
name - The name of the scene element.
min - The minimum point that defines the box.
max - The maximum point that defines the box.

TexturedBox

public TexturedBox(com.jme.image.Texture texture,
                   java.lang.String name,
                   com.jme.math.Vector3f center,
                   float xExtent,
                   float yExtent,
                   float zExtent)
Create a new instance of TexturedBox. The box has the given center and extends in the x, y, and z out from the center (+ and -) by the given amounts. So, for example, a box with extent of .5 would be the unit cube. The texture is displayed on the front face only.

Parameters:
texture - The texture to display on the box.
name - Name of the box.
center - The center of the box.
xExtent - The x extent of the box, in both directions.
yExtent - The y extent of the box, in both directions.
zExtent - The z extent of the box, in both directions.

TexturedBox

public TexturedBox(com.jme.image.Texture texture,
                   int texturedFaces,
                   java.lang.String name,
                   com.jme.math.Vector3f center,
                   float xExtent,
                   float yExtent,
                   float zExtent)
Create a new instance of TexturedBox. The box has the given center and extends in the x, y, and z out from the center (+ and -) by the given amounts. So, for example, a box with extent of .5 would be the unit cube. The texture is displayed on the specified faces.

Parameters:
texture - The texture to display on the box.
texturedFaces - Specifies the faces on which to display the texture. This is the logical OR of FRONT, BACK, etc.
name - Name of the box.
center - The center of the box.
xExtent - The x extent of the box, in both directions.
yExtent - The y extent of the box, in both directions.
zExtent - The z extent of the box, in both directions.
Method Detail

setData

public void setData(com.jme.math.Vector3f minPoint,
                    com.jme.math.Vector3f maxPoint)
Changes the data of the box so that the two opposite corners are minPoint and maxPoint. The other corners are created from those two points. The vertex/normal/texture/color/index buffers are updated when the data is changed.

Parameters:
minPoint - The new minPoint of the box.
maxPoint - The new maxPoint of the box.

setData

public void setData(com.jme.math.Vector3f center,
                    float xExtent,
                    float yExtent,
                    float zExtent)
Changes the data of the box so that its center is center and it extends in the x, y, and z directions by the given extent. Note that the actual sides will be 2x the given extent values because the box extends in + & - from the center for each extent.

Parameters:
center - The center of the box.
xExtent - x extent of the box, in both directions.
yExtent - y extent of the box, in both directions.
zExtent - z extent of the box, in both directions.

setTexture

public void setTexture(com.jme.image.Texture texture)
Specify a new texture.


getTexture

public com.jme.image.Texture getTexture()
Returns this box's texture.


setColor

public void setColor(com.jme.renderer.ColorRGBA color)
Specify a new lit ambient-and-diffuse color for all sides of this box.


getColor

public com.jme.renderer.ColorRGBA getColor()
Returns the lit ambient-and-diffuse color of this box.


computeVertices

public com.jme.math.Vector3f[] computeVertices()
Returns:
a size 8 array of Vectors representing the 8 points of the box.

getCenter

public com.jme.math.Vector3f getCenter()
Returns the current center of the box.

Returns:
The box's center.

setCenter

public void setCenter(com.jme.math.Vector3f aCenter)
Sets the center of the box. Note that even though the center is set, Geometry information is not updated. In most cases, you'll want to use setData()

Parameters:
aCenter - The new center.

clone

public java.lang.Object clone()
Creates a new TexturedBox object containing the same data as this one.

Overrides:
clone in class java.lang.Object
Returns:
The new TexturedBox.

write

public void write(com.jme.util.export.JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface com.jme.util.export.Savable
Overrides:
write in class com.jme.scene.Node
Throws:
java.io.IOException

read

public void read(com.jme.util.export.JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface com.jme.util.export.Savable
Overrides:
read in class com.jme.scene.Node
Throws:
java.io.IOException


Open Wonderland - http://openwonderland.org