com.jme.light
Class LightNode

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

public class LightNode
extends Node

LightNode defines a scene node that contains and maintains a light object. A light node contains a single light, and positions the light based on it's translation vector.
If the contained light is a spot light, the rotation of the node determines it's direction. It has no concept of location.
If the contained light is a Directional light, the direction is relative to the LightNodes world translation. If the light node is located at (0,0,0) the DirectionalLight will have no direction and the Light will be disabled.

Version:
$Id: LightNode.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Mark Powell
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
 
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
LightNode()
           
LightNode(java.lang.String name)
          Constructor creates a new LightState object.
 
Method Summary
 Light getLight()
          getLight returns the light object this node is controlling.
 void read(JMEImporter e)
           
 void setLight(Light light)
          setLight sets the light of this node.
 java.lang.String toString()
          Returns the Spatial's name followed by the class of the spatial
Example: "MyNode (com.jme.scene.Spatial)
 void updateWorldData(float time)
          updateWorldData modifies the light data based on any change the light node has made.
 void write(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, 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, 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
 

Constructor Detail

LightNode

public LightNode()

LightNode

public LightNode(java.lang.String name)
Constructor creates a new LightState object. The light state the node controls is required at construction time.

Parameters:
name - the name of the scene element. This is required for identification and comparision purposes.
Method Detail

setLight

public void setLight(Light light)
setLight sets the light of this node. If a light was previously set to the node, it is replaced by this light.

Parameters:
light - the light to use for the node.

getLight

public Light getLight()
getLight returns the light object this node is controlling.

Returns:
the light object of the node.

updateWorldData

public void updateWorldData(float time)
updateWorldData modifies the light data based on any change the light node has made.

Overrides:
updateWorldData in class Node
Parameters:
time - the time between frames.

toString

public java.lang.String toString()
Description copied from class: Spatial
Returns the Spatial's name followed by the class of the spatial
Example: "MyNode (com.jme.scene.Spatial)

Overrides:
toString in class Spatial
Returns:
Spatial's name followed by the class of the Spatial

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