de.jreality.scene
Class Light

java.lang.Object
  extended by de.jreality.scene.SceneGraphNode
      extended by de.jreality.scene.Light
Direct Known Subclasses:
DirectionalLight, PointLight

public abstract class Light
extends SceneGraphNode

Light is the abstract super class to all lights in the scene. It carries a color and an intensity as the only common properties of all lights.

Warning: currently, all lights are considered to be global (setGlobal(boolean)) in all backends.

Author:
Tim Hoffmann TODO: make lights immutable - make a LightFactory

Constructor Summary
Light(java.lang.String name)
           
 
Method Summary
 void accept(SceneGraphVisitor v)
          The accept method for a SceneGraphVisitor.
 void addLightListener(LightListener listener)
           
 java.awt.Color getColor()
           
 double getIntensity()
          Get this light's intensity
 float[] getScaledColorAsFloat()
          get the current color of this light as a triple of floats, premultiplied by the intensity factor.
 boolean isAmbientFake()
           
 boolean isGlobal()
           
 void removeLightListener(LightListener listener)
           
 void setAmbientFake(boolean b)
           
 void setColor(java.awt.Color color)
           
 void setGlobal(boolean global)
           
 void setIntensity(double intensity)
          Sets the intensity.
 
Methods inherited from class de.jreality.scene.SceneGraphNode
getName, getOwner, getThreadSafe, isReadOnly, setName, setOwner, setReadOnly, setThreadSafe, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Light

public Light(java.lang.String name)
Method Detail

getColor

public java.awt.Color getColor()

setColor

public void setColor(java.awt.Color color)

getScaledColorAsFloat

public float[] getScaledColorAsFloat()
get the current color of this light as a triple of floats, premultiplied by the intensity factor.

Returns:
float[]

getIntensity

public double getIntensity()
Get this light's intensity

Returns:
double the intensity

setIntensity

public void setIntensity(double intensity)
Sets the intensity.

Parameters:
intensity - the intensity

isGlobal

public boolean isGlobal()
Returns:
Returns wether the light is global for the scene.

setGlobal

public void setGlobal(boolean global)
Parameters:
global: - setting wether the light is global for the scene.

isAmbientFake

public boolean isAmbientFake()
Returns:
Returns whether the light should be considered as a fake for ambient light (so sophisticated renderers might ignore it).

setAmbientFake

public void setAmbientFake(boolean b)
Parameters:
global: - setting whether the light should be considered as a fake for ambient light (so sophisticated renderers might ignore it).

accept

public void accept(SceneGraphVisitor v)
Description copied from class: SceneGraphNode
The accept method for a SceneGraphVisitor.

Overrides:
accept in class SceneGraphNode

addLightListener

public void addLightListener(LightListener listener)

removeLightListener

public void removeLightListener(LightListener listener)