javax.media.j3d
Class Light

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.Node
              |
              +--javax.media.j3d.Leaf
                    |
                    +--javax.media.j3d.Light
Direct Known Subclasses:
AmbientLight, DirectionalLight, PointLight

public abstract class Light
extends Leaf

Light is an abstract class containing instance variable common to all lights.


Field Summary
static int ALLOW_COLOR_READ
          Specifies that this Light allows read access to its color information at runtime.
static int ALLOW_COLOR_WRITE
          Specifies that this Light allows write access to its color information at runtime.
static int ALLOW_INFLUENCING_BOUNDS_READ
          Specifies that this Light allows read access to its influencing bounds and bounds leaf information.
static int ALLOW_INFLUENCING_BOUNDS_WRITE
          Specifies that this Light allows write access to its influencing bounds and bounds leaf information.
static int ALLOW_SCOPE_READ
          Specifies that this Light allows read access to its scope information at runtime.
static int ALLOW_SCOPE_WRITE
          Specifies that this Light allows write access to its scope information at runtime.
static int ALLOW_STATE_READ
          Specifies that this Light allows read access to its current state information at runtime.
static int ALLOW_STATE_WRITE
          Specifies that this Light allows write access to its current state information at runtime.
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_PICK, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
Light()
          Constructs a Light node with default parameters.
Light(boolean lightOn, Color3f color)
          Constructs and initializes a Light node using the specified enable flag and color.
Light(Color3f color)
          Constructs and initializes a Light node using the specified color.
 
Method Summary
 void addScope(Group scope)
          Appends the specified scope to this node's list of scopes.
 java.util.Enumeration getAllScopes()
          Returns an Enumeration object of all scopes.
 void getColor(Color3f color)
          Gets this Light's current color and places it in the parameter specified.
 boolean getEnable()
          Retrieves this Light's current state (on/off).
 BoundingLeaf getInfluencingBoundingLeaf()
          Retrieves the Light node's influencing bounding leaf.
 Bounds getInfluencingBounds()
          Retrieves the Light node's influencing bounds.
 Group getScope(int index)
          Retrieves this Light's scope at the index specified.
 void insertScope(Group scope, int index)
          Inserts the scope specified by the group node at the specified index location.
 int numScopes()
          Returns a count of this lights' scopes.
 void removeScope(int index)
          Removes the node's scope at the specified index location.
 void setColor(Color3f color)
          Sets the Light's current color.
 void setEnable(boolean state)
          Turns the light on or off.
 void setInfluencingBoundingLeaf(BoundingLeaf region)
          Sets the Light's influencing region to the specified bounding leaf.
 void setInfluencingBounds(Bounds region)
          Sets the Light's influencing region to the specified bounds.
 void setScope(Group scope, int index)
          Sets the Light's hierarchical scope at the index specified By default, lights are scoped only by their region of influence bounds.
 void updateNodeReferences(NodeReferenceTable referenceTable)
          Callback used to allow a node to check if any scene graph objects referenced by that node have been duplicated via a call to cloneTree.
 
Methods inherited from class javax.media.j3d.Node
cloneNode, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_STATE_READ

public static final int ALLOW_STATE_READ
Specifies that this Light allows read access to its current state information at runtime.

ALLOW_STATE_WRITE

public static final int ALLOW_STATE_WRITE
Specifies that this Light allows write access to its current state information at runtime.

ALLOW_COLOR_READ

public static final int ALLOW_COLOR_READ
Specifies that this Light allows read access to its color information at runtime.

ALLOW_COLOR_WRITE

public static final int ALLOW_COLOR_WRITE
Specifies that this Light allows write access to its color information at runtime.

ALLOW_INFLUENCING_BOUNDS_READ

public static final int ALLOW_INFLUENCING_BOUNDS_READ
Specifies that this Light allows read access to its influencing bounds and bounds leaf information.

ALLOW_INFLUENCING_BOUNDS_WRITE

public static final int ALLOW_INFLUENCING_BOUNDS_WRITE
Specifies that this Light allows write access to its influencing bounds and bounds leaf information.

ALLOW_SCOPE_READ

public static final int ALLOW_SCOPE_READ
Specifies that this Light allows read access to its scope information at runtime.

ALLOW_SCOPE_WRITE

public static final int ALLOW_SCOPE_WRITE
Specifies that this Light allows write access to its scope information at runtime.
Constructor Detail

Light

public Light()
Constructs a Light node with default parameters. The default values are as follows:

Light

public Light(Color3f color)
Constructs and initializes a Light node using the specified color.
Parameters:
color - the color of the light source

Light

public Light(boolean lightOn,
             Color3f color)
Constructs and initializes a Light node using the specified enable flag and color.
Parameters:
lightOn - flag indicating whether this light is on or off
color - the color of the light source
Method Detail

setEnable

public final void setEnable(boolean state)
Turns the light on or off.
Parameters:
state - true or false to set light on or off
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getEnable

public final boolean getEnable()
Retrieves this Light's current state (on/off).
Returns:
this node's current state (on/off)
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setColor

public final void setColor(Color3f color)
Sets the Light's current color.
Parameters:
color - the value of this node's new color
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getColor

public final void getColor(Color3f color)
Gets this Light's current color and places it in the parameter specified.
Parameters:
color - the vector that will receive this node's color
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setScope

public final void setScope(Group scope,
                           int index)
Sets the Light's hierarchical scope at the index specified By default, lights are scoped only by their region of influence bounds. This allows them to be further scoped * by a node in the hierarchy.
Parameters:
scope - the Group node that defines this Light's scope
index - the index which group node to replace.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getScope

public final Group getScope(int index)
Retrieves this Light's scope at the index specified.
Parameters:
index - which scope to return
Returns:
the Group node that defines this Light's scope
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

insertScope

public final void insertScope(Group scope,
                              int index)
Inserts the scope specified by the group node at the specified index location.
Parameters:
scope - the new scope
index - at which location to insert
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

removeScope

public final void removeScope(int index)
Removes the node's scope at the specified index location.
Parameters:
index - which scope to remove
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getAllScopes

public final java.util.Enumeration getAllScopes()
Returns an Enumeration object of all scopes.
Returns:
an Enumeration object of all the scopes
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

addScope

public final void addScope(Group scope)
Appends the specified scope to this node's list of scopes.
Parameters:
scope - the scope to add to this node's list of scopes
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

numScopes

public final int numScopes()
Returns a count of this lights' scopes.
Returns:
the number of scopes for this light..
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setInfluencingBounds

public final void setInfluencingBounds(Bounds region)
Sets the Light's influencing region to the specified bounds. This is used when the influencing bounding leaf is set to null.
Parameters:
region - the bounds that contains the Light's new influencing region.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getInfluencingBounds

public final Bounds getInfluencingBounds()
Retrieves the Light node's influencing bounds.
Returns:
this Light's influencing bounds information
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setInfluencingBoundingLeaf

public final void setInfluencingBoundingLeaf(BoundingLeaf region)
Sets the Light's influencing region to the specified bounding leaf. When set to a value other than null, this overrides the influencing bounds object.
Parameters:
region - the bounding leaf node used to specify the Light node's new influencing region.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getInfluencingBoundingLeaf

public final BoundingLeaf getInfluencingBoundingLeaf()
Retrieves the Light node's influencing bounding leaf.
Returns:
this Light's influencing bounding leaf information
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

updateNodeReferences

public void updateNodeReferences(NodeReferenceTable referenceTable)
Callback used to allow a node to check if any scene graph objects referenced by that node have been duplicated via a call to cloneTree. This method is called by cloneTree after all nodes in the sub-graph have been duplicated. The cloned Leaf node's method will be called and the Leaf node can then look up any object references by using the getNewObjectReference method found in the NodeReferenceTable object. If a match is found, a reference to the corresponding object in the newly cloned sub-graph is returned. If no corresponding reference is found, either a DanglingReferenceException is thrown or a reference to the original object is returned depending on the value of the allowDanglingReferences parameter passed in the cloneTree call.
Overrides:
updateNodeReferences in class Leaf
Parameters:
referenceTable - a NodeReferenceTableObject that contains the getNewObjectReference method needed to search for new object instances.
See Also:
NodeReferenceTable, Node.cloneTree(), DanglingReferenceException