org.xith3d.scenegraph
Class Light

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.Leaf
              extended by org.xith3d.scenegraph.Light
All Implemented Interfaces:
org.jagatoo.datatypes.Enableable, org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode
Direct Known Subclasses:
AmbientLight, DirectionalLight, PointLight

public abstract class Light
extends Leaf
implements org.jagatoo.datatypes.Enableable

Light defines a common set of attributes that control lights. A light has associated with it a color, a state (on/off), and a Bounds object that specifies the region of influence for the light.


Field Summary
static org.openmali.vecmath2.Colorf DEFAULT_COLOR
           
 
Fields inherited from class org.xith3d.scenegraph.Node
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, transformGroup, untransformedBounds
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
Light()
          Constructs a new Light object with a default color of white.
Light(boolean enabled)
          Constructs a new Light object with a default color of white.
Light(boolean enabled, float colorR, float colorG, float colorB)
          Constructs a new Light object with the specified color.
Light(float colorR, float colorG, float colorB)
          Constructs a new Light object with the specified color.
 
Method Summary
 void freeOpenGLResources(CanvasPeer canvasPeer)
          This method frees OpenGL resources (names) for all Nodes in the traversal of this Node(-Group).
protected static org.openmali.vecmath2.Colorf getCol(org.openmali.vecmath2.Colorf col)
           
 org.openmali.vecmath2.Colorf getColor()
          Gets the color for this object.
 BoundingLeaf getInfluencingBoundingLeaf()
          Sets the influence bounding leaf for this object.
 org.openmali.spatial.bounds.Bounds getInfluencingBounds()
          Gets the influence bounding region for this object.
 int getLightID()
           
 boolean isEnabled()
          Gets the state for this object.
 void setColor(org.openmali.vecmath2.Colorf color)
          Sets the color for this object.
 void setColor(float r, float g, float b)
          Sets the color for this object.
 void setEnabled(boolean enabled)
          Sets the state for this object.
 void setInfluencingBoundingLeaf(BoundingLeaf boundingLeaf)
          Sets the influence bounding leaf for this object.
 void setInfluencingBounds(org.openmali.spatial.bounds.Bounds region)
          Sets the influence bounding region for this object.
 void setPickable(boolean value)
          This is a Light.
 boolean traverse(DetailedTraversalCallback callback)
          Traverses the scenegraph from this node on.
 
Methods inherited from class org.xith3d.scenegraph.Leaf
dump, getPickHost, setPickHost
 
Methods inherited from class org.xith3d.scenegraph.Node
absorbDetails, cloneNode, detach, duplicateNode, freeOpenGLResources, getBounds, getBoundsAutoCompute, getBoundsType, getBoundsTypeHint, getDefaultPickable, getIndentString, getInheritedNodeAttributes, getModListener, getOrderedChild, getOrderedState, getParent, getRoot, getShadowAttachment, getShowBounds, getTransformGroup, getTreeCell, getWorldBounds, getWorldTransform, getWorldTransform, isBillboard, isIgnoreBounds, isOccluder, isPickable, isRenderable, isUpdatableNode, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBounds, setBoundsAutoCompute, setBoundsDirty, setBoundsDirtyUpward, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setModListener, setOrderedChild, setParent, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, sharedCopy, sharedCopy, traverse, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateBounds, updateBoundsCheap, updateOrderedChild, updateTransformGroup, updateWorldTransform
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_COLOR

public static final org.openmali.vecmath2.Colorf DEFAULT_COLOR
Constructor Detail

Light

public Light(boolean enabled,
             float colorR,
             float colorG,
             float colorB)
Constructs a new Light object with the specified color.

Parameters:
enabled -
colorR -
colorG -
colorB -

Light

public Light(float colorR,
             float colorG,
             float colorB)
Constructs a new Light object with the specified color.

Parameters:
colorR -
colorG -
colorB -

Light

public Light(boolean enabled)
Constructs a new Light object with a default color of white.

Parameters:
enabled -

Light

public Light()
Constructs a new Light object with a default color of white.

Method Detail

getLightID

public final int getLightID()

setEnabled

public void setEnabled(boolean enabled)
Sets the state for this object.

Specified by:
setEnabled in interface org.jagatoo.datatypes.Enableable

isEnabled

public final boolean isEnabled()
Gets the state for this object.

Specified by:
isEnabled in interface org.jagatoo.datatypes.Enableable

setPickable

public final void setPickable(boolean value)
This is a Light. You cannot mark a light pickable!

Overrides:
setPickable in class Node
Parameters:
value - if false, this Node is ignored by picking algorithms

setColor

public void setColor(org.openmali.vecmath2.Colorf color)
Sets the color for this object.


setColor

public void setColor(float r,
                     float g,
                     float b)
Sets the color for this object.


getColor

public final org.openmali.vecmath2.Colorf getColor()
Gets the color for this object.


setInfluencingBounds

public void setInfluencingBounds(org.openmali.spatial.bounds.Bounds region)
Sets the influence bounding region for this object.


getInfluencingBounds

public final org.openmali.spatial.bounds.Bounds getInfluencingBounds()
Gets the influence bounding region for this object.


setInfluencingBoundingLeaf

public void setInfluencingBoundingLeaf(BoundingLeaf boundingLeaf)
Sets the influence bounding leaf for this object.


getInfluencingBoundingLeaf

public final BoundingLeaf getInfluencingBoundingLeaf()
Sets the influence bounding leaf for this object.


freeOpenGLResources

public void freeOpenGLResources(CanvasPeer canvasPeer)
This method frees OpenGL resources (names) for all Nodes in the traversal of this Node(-Group).

Specified by:
freeOpenGLResources in class Node

traverse

public boolean traverse(DetailedTraversalCallback callback)
Traverses the scenegraph from this node on. If this Node is a Group it will recusively run through each child.

Overrides:
traverse in class Leaf
Parameters:
callback - the listener is notified of any traversed Node on the way
Returns:
if false, the whole traversal will stop

getCol

protected static final org.openmali.vecmath2.Colorf getCol(org.openmali.vecmath2.Colorf col)