Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class PointLight

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.Node
          extended by org.j3d.aviatrix3d.Leaf
              extended by org.j3d.aviatrix3d.Light
                  extended by org.j3d.aviatrix3d.PointLight
All Implemented Interfaces:
java.lang.Comparable, CascadeRenderable, ComponentRenderable, Cullable, EffectRenderable, LeafCullable, Renderable

public class PointLight
extends Light

Representation of a point light source.

A positional light has a position, but no orientation and attenuates over distance from the position.

Version:
$Revision: 1.22 $
Author:
Justin Couch

Field Summary
protected  float cAttenuation
          The constant attentuation factor
protected  float lAttenuation
          The linear attentuation factor
protected  float[] position
          The colour of the light
protected  float qAttenuation
          The quadratic attentuation factor
 
Fields inherited from class org.j3d.aviatrix3d.Light
AMBIENT_TYPE, ambientColor, diffuseColor, DIRECTIONAL_TYPE, effectBounds, enabled, globalOnly, INVALID_ALPHA_PROP, INVALID_BLUE_PROP, INVALID_GREEN_PROP, INVALID_RED_PROP, POINT_TYPE, specularColor, SPOT_TYPE
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Fields inherited from interface org.j3d.aviatrix3d.rendering.LeafCullable
AUDIO_CULLABLE, CLIP_CULLABLE, FOG_CULLABLE, GEOMETRY_CULLABLE, LIGHT_CULLABLE, OVERRIDE_CULLABLE
 
Constructor Summary
PointLight()
          Creates a light with the colour set to black.
PointLight(float[] col)
          Create a light with the given base colour.Colour must be in the range [0, 1] otherwise an exception is generated.
PointLight(float[] col, float[] pos)
          Create a light with the given base colour.Colour must be in the range [0, 1] otherwise an exception is generated.
 
Method Summary
 int compareTo(Light l)
          Compares this object with the specified object for order.
 void getAttenuation(float[] values)
          Set the attenuation factors for the light.
 void getPosition(float[] pos)
          Retrieve the current position vector from the light.
protected  void markBoundsDirty()
          Mark this node as having dirty bounds due to one of it's children having their bounds changed.
 void postRender(javax.media.opengl.GL gl, java.lang.Object lightId)
           
 void render(javax.media.opengl.GL gl, java.lang.Object lightId)
          Overloaded form of the render() method to render the light details given the specific Light ID used by OpenGL.
 void setAttenuation(float[] values)
          Set the attenuation factors for the light.
 void setAttenuation(float constant, float linear, float quad)
          Set the attenuation factors for the light.
 void setPosition(float[] pos)
          Set the position to the new value.
 void setPosition(float x, float y, float z)
          Set the position to the new value.
 
Methods inherited from class org.j3d.aviatrix3d.Light
compareColor3, compareTo, getAmbientColor, getCullableType, getDiffuseColor, getEffectBounds, getRenderable, getSpecularColor, isEnabled, isGlobalOnly, setAmbientColor, setDiffuseColor, setEffectBounds, setEnabled, setGlobalOnly, setSpecularColor
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, recomputeBounds, removeParent, requestBoundsUpdate, setBounds, setParent, updateBounds, updateParentBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.LeafCullable
getBounds
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.Renderable
equals
 

Field Detail

position

protected float[] position
The colour of the light


cAttenuation

protected float cAttenuation
The constant attentuation factor


lAttenuation

protected float lAttenuation
The linear attentuation factor


qAttenuation

protected float qAttenuation
The quadratic attentuation factor

Constructor Detail

PointLight

public PointLight()
Creates a light with the colour set to black.


PointLight

public PointLight(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

PointLight

public PointLight(float[] col,
                  float[] pos)
           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
pos - The position of the light
Throws:
java.lang.IllegalArgumentException
Method Detail

render

public void render(javax.media.opengl.GL gl,
                   java.lang.Object 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
lightId - the ID of the light to make GL calls with

postRender

public void postRender(javax.media.opengl.GL gl,
                       java.lang.Object lightId)

markBoundsDirty

protected void markBoundsDirty()
Mark this node as having dirty bounds due to one of it's children having their bounds changed.

Overrides:
markBoundsDirty in class Node

setPosition

public void setPosition(float[] pos)
                 throws InvalidWriteTimingException
Set the position to the new value. Position is a vector that the light is shining.

Parameters:
pos - The new position value to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener bounds change callback method

setPosition

public void setPosition(float x,
                        float y,
                        float z)
                 throws InvalidWriteTimingException
Set the position to the new value. Position is a vector that the light is shining.

Parameters:
x - The x component of the position value to use
y - The y component of the position value to use
z - The z component of the position value to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener bounds change callback method

getPosition

public void getPosition(float[] pos)
Retrieve the current position vector from the light.

Parameters:
pos - An array to copy the position into

setAttenuation

public void setAttenuation(float constant,
                           float linear,
                           float quad)
                    throws InvalidWriteTimingException
Set the attenuation factors for the light. See class header documentation for more inforamtion on these values.

Parameters:
constant - The constant attenuation factor
linear - The linear attenuation factor
quad - The quadratic attenuation factor
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data change callback method

setAttenuation

public void setAttenuation(float[] values)
                    throws InvalidWriteTimingException
Set the attenuation factors for the light. See class header documentation for more inforamtion on these values.

Parameters:
values - Each value in the order:
[0] The constant attenuation factor
[1] The linear attenuation factor
[2] The quadratic attenuation factor
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data change callback method

getAttenuation

public void getAttenuation(float[] values)
Set the attenuation factors for the light. See class header documentation for more inforamtion on these values.

Parameters:
values - Array to copy the values into, in the order:
[0] The constant attenuation factor
[1] The linear attenuation factor
[2] The quadratic attenuation factor

compareTo

public int compareTo(Light l)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Overrides:
compareTo in class Light
Parameters:
l - The light instance to be compared
Returns:
-1, 0 or 1 depending on order

Aviatrix3D
2.1.0

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