com.jme.scene
Class BillboardNode

java.lang.Object
  extended bycom.jme.scene.Spatial
      extended bycom.jme.scene.Node
          extended bycom.jme.scene.BillboardNode
All Implemented Interfaces:
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 the billboards orientation will always be up (0,1,0). This means that a standard camera with up (0,1,0) is the only camera setting compatible with BillboardNode.

Version:
$Id: BillboardNode.java,v 1.17 2005/03/14 20:15:45 renanse Exp $
Author:
Mark Powell
See Also:
Serialized Form

Field Summary
static int AXIAL
          Alligns this Billboard Node to the screen, but keeps the Y 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
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
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 getType()
          Returns the type of rotation this BillboardNode is set too.
 void rotateBillboard(Camera cam)
          rotate the billboard based on the type set
 void setType(int type)
          Sets the type of rotation this BillboardNode will have.
 void updateWorldData(float time)
          updateWorldData defers the updating of the billboards orientation until rendering.
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChild, detachAllChildren, detachChild, detachChildAt, detachChildNamed, drawBounds, findCollisions, findPick, getChild, getChild, getChildren, getQuantity, hasChild, hasCollision, putClone, setChild, setForceView, updateCollisionTree, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

CAMERA_ALIGNED

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

See Also:
Constant Field Values
Constructor Detail

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

getType

public int getType()
Returns the type of rotation this BillboardNode is set too.

Returns:
The type of rotation, AXIAL or SCREEN.

setType

public void setType(int type)
Sets the type of rotation this BillboardNode will have. The type can be either SCREEN_ALIGNED or AXIAL. Invalid types will assume no billboard rotation.