com.jme.scene
Class BillboardNode

java.lang.Object
  extended by com.jme.scene.Spatial
      extended by com.jme.scene.Node
          extended by com.jme.scene.BillboardNode
All Implemented Interfaces:
Savable, java.io.Serializable

public class BillboardNode
extends Node

BillboardNode defines a node that always orients towards the camera. However, it does not tilt up/down as the camera rises. This keep geometry from appearing to fall over if the camera rises or lowers. BillboardNode is useful to contain a single quad that has a image applied to it for lowest detail models. This quad, with the texture, will appear to be a full model at great distances, and save on rendering and memory. It is important to note that for AXIAL mode, the billboards orientation will always be up (0,1,0). This means that a "standard" jME camera with up (0,1,0) is the only camera setting compatible with AXIAL mode.

Version:
$Id: BillboardNode.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Mark Powell, Joshua Slack
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme.scene.Spatial
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode
 
Field Summary
static int AXIAL
          Alligns this Billboard Node to the screen, but keeps the Y axis fixed.
static int AXIAL_Y
           
static int AXIAL_Z
          Alligns this Billboard Node to the screen, but keeps the Z axis fixed.
static int CAMERA_ALIGNED
          Alligns this Billboard Node to the camera position.
static int SCREEN_ALIGNED
          Alligns this Billboard Node to the screen.
 
Fields inherited from class com.jme.scene.Node
children
 
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
BillboardNode()
           
BillboardNode(java.lang.String name)
          Constructor instantiates a new BillboardNode.
 
Method Summary
 void draw(Renderer r)
          draw updates the billboards orientation then renders the billboard's children.
 int getAlignment()
          Returns the alignment this BillboardNode is set too.
 void read(JMEImporter e)
           
 void rotateBillboard(Camera cam)
          rotate the billboard based on the type set
 void setAlignment(int alignment)
          Sets the type of rotation this BillboardNode will have.
 void updateWorldData(float time)
          updateWorldData defers the updating of the billboards orientation until rendering.
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChild, attachChildAt, childChange, detachAllChildren, detachChild, detachChildAt, detachChildNamed, findCollisions, findPick, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, hasCollision, lockBounds, lockMeshes, lockShadows, lockTransforms, setModelBound, sortLights, swapChildren, unlockBounds, unlockMeshes, unlockShadows, unlockTransforms, updateModelBound, updateWorldBound, updateWorldVectors
 
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, lockBranch, lockMeshes, 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, unlockBranch, unlockMeshes, updateGeometricState, updateRenderState, updateRenderState, updateWorldRotation, updateWorldScale, updateWorldTranslation, 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

SCREEN_ALIGNED

public static final int SCREEN_ALIGNED
Alligns this Billboard Node to the screen.

See Also:
Constant Field Values

AXIAL

public static final int AXIAL
Alligns this Billboard Node to the screen, but keeps the Y axis fixed.

See Also:
Constant Field Values

AXIAL_Y

public static final int AXIAL_Y
See Also:
Constant Field Values

CAMERA_ALIGNED

public static final int CAMERA_ALIGNED
Alligns this Billboard Node to the camera position.

See Also:
Constant Field Values

AXIAL_Z

public static final int AXIAL_Z
Alligns this Billboard Node to the screen, but keeps the Z axis fixed.

See Also:
Constant Field Values
Constructor Detail

BillboardNode

public BillboardNode()

BillboardNode

public BillboardNode(java.lang.String name)
Constructor instantiates a new BillboardNode. The name of the node is supplied during construction.

Parameters:
name - the name of the node.
Method Detail

updateWorldData

public void updateWorldData(float time)
updateWorldData defers the updating of the billboards orientation until rendering. This keeps the billboard from being needlessly oriented if the player can not actually see it.

Overrides:
updateWorldData in class Node
Parameters:
time - the time between frames.
See Also:
Spatial.updateWorldData(float)

draw

public void draw(Renderer r)
draw updates the billboards orientation then renders the billboard's children.

Overrides:
draw in class Node
Parameters:
r - the renderer used to draw.
See Also:
Spatial.draw(com.jme.renderer.Renderer)

rotateBillboard

public void rotateBillboard(Camera cam)
rotate the billboard based on the type set

Parameters:
cam - Camera

getAlignment

public int getAlignment()
Returns the alignment this BillboardNode is set too.

Returns:
The alignment of rotation, AXIAL, CAMERA or SCREEN.

setAlignment

public void setAlignment(int alignment)
Sets the type of rotation this BillboardNode will have. The alignment can be CAMERA_ALIGNED, SCREEN_ALIGNED or AXIAL. Invalid alignments will assume no billboard rotation.


write

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

read

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