net.jinx.video
Class Light

java.lang.Object
  extended by net.jinx.video.Light
All Implemented Interfaces:
Visible

public class Light
extends java.lang.Object
implements Visible

Represents a light source for rendering. Light sources are composed of two parts, a Material object for the color of light and a vector that is used as the position of the light. The shininess portion of the Material is ignored.
NOTE: Never wrap a Light object in a DisplayList of any kind. Lights are adaptively enabled as needed, so wrapping them in a DisplayList may cause one light to interfere with another.

API Stability: Stable.


Constructor Summary
Light()
          Constructs a light with the default Material at the origin.
Light(float[] position)
          Constructs a light with the default Material at the origin, with the given position.
 
Method Summary
 void deinit(Context opt)
          Does nothing.
 void draw(Context opt)
          Renders this Visible to glDrawable.
 Material getColor()
          Returns the color of this light.
 float getConstantAttenuation()
          Provides the constant attenuation for this light.
 float getLinearAttenuation()
          Provides the linear attenuation for this light.
 float[] getPosition()
          Returns the position of the light.
 float getQuadraticAttenuation()
          Provides the quadratic attenuation for this light.
 float getSpotCutoff()
          Provides the spotlight cutoff angle for this light.
 float[] getSpotDirection()
          Provides the spotlight direction for this light.
 float getSpotExponent()
          Provides the spot exponent for this light.
 void init(Context opt)
          Does nothing.
 void setColor(Material color)
          Sets the color of this light.
 void setConstantAttenuation(float constantAttenuation)
          Sets the constant attenuation for this light.
 void setLinearAttenuation(float linearAttenuation)
          Sets the linear attenuation for this light.
 void setPosition(float[] position)
          Sets the position of the light in three dimensional space with an additional w coordinate that indicates weather the light is at an infinite distance or not.
 void setQuadraticAttenuation(float quadraticAttenuation)
          Sets the quadratic attenuation for this light.
 void setSpotCutoff(float spotCutoff)
          Sets the spotlight cutoff angle for this light.
 void setSpotDirection(float[] spotDirection)
          Sets the spotlight direction.
 void setSpotExponent(float spotExponent)
          Sets the spot exponent for this light.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Light

public Light()
Constructs a light with the default Material at the origin.


Light

public Light(float[] position)
Constructs a light with the default Material at the origin, with the given position.

Parameters:
position - the vector for the position of the light.
Method Detail

init

public void init(Context opt)
Does nothing.

Specified by:
init in interface Visible
Parameters:
opt - describes the rendering options that are being used.

deinit

public void deinit(Context opt)
Does nothing.

Specified by:
deinit in interface Visible
Parameters:
opt - describes the rendering options that are being used.

getQuadraticAttenuation

public float getQuadraticAttenuation()
Provides the quadratic attenuation for this light.

Returns:
the value as a float.

setQuadraticAttenuation

public void setQuadraticAttenuation(float quadraticAttenuation)
Sets the quadratic attenuation for this light.

Parameters:
quadraticAttenuation - the value as a float.

getLinearAttenuation

public float getLinearAttenuation()
Provides the linear attenuation for this light.

Returns:
the value as a float.

setLinearAttenuation

public void setLinearAttenuation(float linearAttenuation)
Sets the linear attenuation for this light.

Parameters:
linearAttenuation - the value as a float.

getConstantAttenuation

public float getConstantAttenuation()
Provides the constant attenuation for this light.

Returns:
the value as a float.

setConstantAttenuation

public void setConstantAttenuation(float constantAttenuation)
Sets the constant attenuation for this light.

Parameters:
constantAttenuation - the value as a float.

getSpotCutoff

public float getSpotCutoff()
Provides the spotlight cutoff angle for this light.

Returns:
the spot cutoff as a float. 180 indicates that the light isn't a spotlight.

setSpotCutoff

public void setSpotCutoff(float spotCutoff)
Sets the spotlight cutoff angle for this light.

Parameters:
spotCutoff - the spot cutoff as a float. 180 indicates that the light isn't a spotlight.

getSpotDirection

public float[] getSpotDirection()
Provides the spotlight direction for this light.

Returns:
a three dimensional float array describing the direction of the spotlight.

setSpotDirection

public void setSpotDirection(float[] spotDirection)
Sets the spotlight direction.

Parameters:
spotDirection - a three dimensional float array describing the direction of the spotlight.

getSpotExponent

public float getSpotExponent()
Provides the spot exponent for this light.

Returns:
the spot exponent as a float.

setSpotExponent

public void setSpotExponent(float spotExponent)
Sets the spot exponent for this light.

Parameters:
spotExponent - the spot exponent as a float.

getColor

public Material getColor()
Returns the color of this light.

Returns:
the Material object that forms the color of this light.

setColor

public void setColor(Material color)
Sets the color of this light.

Parameters:
color - the Material object to use as the color of this light.

getPosition

public float[] getPosition()
Returns the position of the light.

Returns:
the position vector.

setPosition

public void setPosition(float[] position)
Sets the position of the light in three dimensional space with an additional w coordinate that indicates weather the light is at an infinite distance or not. A w value of 0.0 indicates the light is infinitely far away and the vector supplies direction only. A 1.0 indicates that it's regular coordinates.

Parameters:
position - the vector to use as the position of this light.

draw

public void draw(Context opt)
Description copied from interface: Visible
Renders this Visible to glDrawable.

Specified by:
draw in interface Visible
Parameters:
opt - describes the rendering options that are being used.