j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class Light

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.Node
          extended byorg.j3d.aviatrix3d.Leaf
              extended byorg.j3d.aviatrix3d.Light
Direct Known Subclasses:
AmbientLight, DirectionalLight, PointLight, SpotLight

public abstract class Light
extends Leaf

Base representation of a light source.

By default a light is not enabled and the colour is set to black. Lights also have a secondary specular value that can be provided. By default it is black (ie has no effect).

Version:
$Revision: 1.8 $
Author:
Justin Couch

Field Summary
protected  float[] diffuseColor
          The colour of the light
protected  boolean enabled
          The enabled state
protected  float[] specularColor
          The colour of the light
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
protected Light()
          Creates a light with the colour and specular colour set to black.
protected Light(float[] col)
          Create a light with the given base colour.Colour must be in the range [0, 1] otherwise an exception is generated.
 
Method Summary
 void getDiffuseColor(float[] col)
          Retrieve the current diffuse colour value from the light.
 void getSpecularColor(float[] col)
          Retrieve the current colour value from the light.
 boolean isEnabled()
          Get the current enabled state of the light.
abstract  void postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu, int lightId)
           
abstract  void render(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu, int lightId)
          Overloaded form of the render() method to render the light details given the specific Light ID used by OpenGL.
 void setDiffuseColor(float[] col)
          Set the diffuse colour component to the new value.
 void setEnabled(boolean state)
          Set the enabled state of the light.
 void setSpecularColor(float[] col)
          Set the colour to the new value.
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, markBoundsDirty, postRender, recomputeBounds, removeParent, render, setBounds, setLive, setParent, updateBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, dataChanged, getUserData, isLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

diffuseColor

protected float[] diffuseColor
The colour of the light


specularColor

protected float[] specularColor
The colour of the light


enabled

protected boolean enabled
The enabled state

Constructor Detail

Light

protected Light()
Creates a light with the colour and specular colour set to black.


Light

protected Light(float[] col)
         throws java.lang.IllegalArgumentException
Create a light with the given base colour.Colour must be in the range [0, 1] otherwise an exception is generated.

Parameters:
col - The new colour value to use
Throws:
java.lang.IllegalArgumentException - The colour value is out of range
Method Detail

setEnabled

public void setEnabled(boolean state)
                throws InvalidWriteTimingException
Set the enabled state of the light. Can use this to turn it on and off in a general fashion.

Parameters:
state - The new state of the light
Throws:
InvalidWriteTimingException

isEnabled

public boolean isEnabled()
Get the current enabled state of the light.

Returns:
The current state

setDiffuseColor

public void setDiffuseColor(float[] col)
                     throws java.lang.IllegalArgumentException,
                            InvalidWriteTimingException
Set the diffuse colour component to the new value. Colour must be in the range [0, 1] otherwise an exception is generated.

Parameters:
col - The new colour value to use
Throws:
java.lang.IllegalArgumentException - The colour value is out of range
InvalidWriteTimingException

getDiffuseColor

public void getDiffuseColor(float[] col)
Retrieve the current diffuse colour value from the light.

Parameters:
col - An array to copy the colour value into

setSpecularColor

public void setSpecularColor(float[] col)
                      throws java.lang.IllegalArgumentException,
                             InvalidWriteTimingException
Set the colour to the new value. Colour must be in the range [0, 1] otherwise an exception is generated.

Parameters:
col - The new colour value to use
Throws:
java.lang.IllegalArgumentException - The colour value is out of range
InvalidWriteTimingException

getSpecularColor

public void getSpecularColor(float[] col)
Retrieve the current colour value from the light.

Parameters:
col - An array to copy the colour value into

render

public abstract void render(net.java.games.jogl.GL gl,
                            net.java.games.jogl.GLU glu,
                            int lightId)
Overloaded form of the render() method to render the light details given the specific Light ID used by OpenGL. Since the active light ID for this node may vary over time, a fixed ID cannot be used by OpenGL. The renderer will always call this method rather than the normal render() method. The normal post render will still be called

Parameters:
gl - The GL context to render with
glu - The GL utility context to render with
lightId - the ID of the light to make GL calls with

postRender

public abstract void postRender(net.java.games.jogl.GL gl,
                                net.java.games.jogl.GLU glu,
                                int lightId)

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org