de.rico.engine.effect.light.ogllight
Class DirectionalLight

java.lang.Object
  extended by de.rico.engine.effect.light.ogllight.AbstractLight
      extended by de.rico.engine.effect.light.ogllight.DirectionalLight
All Implemented Interfaces:
DirectionalLightIface, LightIface

public class DirectionalLight
extends AbstractLight
implements DirectionalLightIface

This class represents a directional OpenGL light.

Author:
Frank Bruns

Constructor Summary
DirectionalLight(int lightNumber)
          Creates a directional light with the specified light number
 
Method Summary
 void bind(javax.media.opengl.GL gl)
          Starts using the light.
 Point3D getDirection()
          Returns the direction as a new Point3D object.
 float[] getDirectionArray()
          Returns the direction of the light in its array representation.
 void setDirection(float x, float y, float z)
          Set the direction of the light.
 void setDirection(Point3D dir)
          Sets the direction of the light.
 
Methods inherited from class de.rico.engine.effect.light.ogllight.AbstractLight
destroy, getAmbient, getDiffuse, getLightNr, getLightNrOGLConst, getSpecular, isEnabled, release, setAmbient, setAmbient, setDiffuse, setDiffuse, setEnabled, setSpecular, setSpecular
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.rico.engine.effect.light.LightIface
destroy, release, setEnabled
 

Constructor Detail

DirectionalLight

public DirectionalLight(int lightNumber)
Creates a directional light with the specified light number

Parameters:
lightNumber - light number from 0 to 7
Method Detail

bind

public void bind(javax.media.opengl.GL gl)
Description copied from interface: LightIface
Starts using the light. All objects that are rendered after the call to this method, will be affected by the light, if no special treatment was performed on those objects.

Specified by:
bind in interface LightIface
Overrides:
bind in class AbstractLight

setDirection

public void setDirection(float x,
                         float y,
                         float z)
Description copied from interface: DirectionalLightIface
Set the direction of the light. The specified parameters get normalized.

Specified by:
setDirection in interface DirectionalLightIface
Parameters:
x - x direction
y - y direction
z - z direction

setDirection

public void setDirection(Point3D dir)
Description copied from interface: DirectionalLightIface
Sets the direction of the light. The specified parameter gets normalized.

Specified by:
setDirection in interface DirectionalLightIface
Parameters:
dir - light direction

getDirectionArray

public float[] getDirectionArray()
Returns the direction of the light in its array representation.

Returns:
direction of the light

getDirection

public Point3D getDirection()
Description copied from interface: DirectionalLightIface
Returns the direction as a new Point3D object.

Specified by:
getDirection in interface DirectionalLightIface
Returns:
direction as a new Point3D object