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

java.lang.Object
  extended by de.rico.engine.effect.light.ogllight.AbstractLight
      extended by de.rico.engine.effect.light.ogllight.PositionalLight
          extended by de.rico.engine.effect.light.ogllight.SpotLight
All Implemented Interfaces:
LightIface, PositionalLightIface, SpotLightIface
Direct Known Subclasses:
ShaderSpotLight

public class SpotLight
extends PositionalLight
implements SpotLightIface

This class represents an OpenGL spot light.

Author:
Frank Bruns

Constructor Summary
SpotLight(int lightNumber)
          Creates a new spot light with the specified number.
 
Method Summary
 void bind(javax.media.opengl.GL gl)
          Starts using the light.
 float getCutoff()
          Returns the spot citoff
 Point3D getDirection()
          Deprecated. I recommend to use the setRotX() and setRotY() methods instead. They are a lot easier to control.
 float getExponent()
          Returns the spot exponent
 float getRotX()
          Returns the degrees of ratation of the light along the x axis
 float getRotY()
          Returns the degrees of ratation of the light along the y axis
 void setCutOff(float spotCutoff)
          Sets the spot cutoff [0f,90f].
 void setDirection(float x, float y, float z)
          Deprecated. I recommend to use the setRotX() and setRotY() methods instead. They are a lot easier to control.
 void setDirection(Point3D direction)
          Deprecated. I recommend to use the setRotX() and setRotY() methods instead. They are a lot easier to control.
 void setExponent(float spotExponent)
          Sets the spot exponent of the spot light
 void setRotX(float rotation)
          Sets the rotaton of the light along the x axis
 void setRotY(float rotation)
          Sets the rotaton along the y axis of the light
 
Methods inherited from class de.rico.engine.effect.light.ogllight.PositionalLight
getConstAttenuation, getLinearAttenuation, getPosition, getQuadraticAttenuation, setConstAttenuation, setLinearAttenuation, setPosition, setPosition, setQuadraticAttenuation, setShowLightPosition, setX, setY, setZ
 
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.PositionalLightIface
getPosition, setPosition, setPosition, setX, setY, setZ
 
Methods inherited from interface de.rico.engine.effect.light.LightIface
destroy, release, setEnabled
 

Constructor Detail

SpotLight

public SpotLight(int lightNumber)
Creates a new spot light with the specified 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 PositionalLight

getCutoff

public float getCutoff()
Returns the spot citoff

Returns:
spot cutoff

setCutOff

public void setCutOff(float spotCutoff)
Sets the spot cutoff [0f,90f].

Parameters:
spotCutoff - spotcutoff for the spot light

getExponent

public float getExponent()
Returns the spot exponent

Returns:
spot exponent

setExponent

public void setExponent(float spotExponent)
Sets the spot exponent of the spot light

Parameters:
spotExponent - spot exponent of the spot light

getDirection

@Deprecated
public Point3D getDirection()
Deprecated. I recommend to use the setRotX() and setRotY() methods instead. They are a lot easier to control.

Returns the spot direction.

Returns:
spot direction

setDirection

@Deprecated
public void setDirection(float x,
                                    float y,
                                    float z)
Deprecated. I recommend to use the setRotX() and setRotY() methods instead. They are a lot easier to control.

Set the direction of the spot light. The specified values get normalized.

Parameters:
x - x-coordinate
y - y-coordinate
z - z-coordinate

setDirection

@Deprecated
public void setDirection(Point3D direction)
Deprecated. I recommend to use the setRotX() and setRotY() methods instead. They are a lot easier to control.

Set the direction of the spot light. The specified values get normalized.

Parameters:
direction - direction of the spot light

setRotX

public void setRotX(float rotation)
Description copied from interface: SpotLightIface
Sets the rotaton of the light along the x axis

Specified by:
setRotX in interface SpotLightIface
Parameters:
rotation - degrees of rotation

setRotY

public void setRotY(float rotation)
Description copied from interface: SpotLightIface
Sets the rotaton along the y axis of the light

Specified by:
setRotY in interface SpotLightIface
Parameters:
rotation - degrees of rotation

getRotX

public float getRotX()
Description copied from interface: SpotLightIface
Returns the degrees of ratation of the light along the x axis

Specified by:
getRotX in interface SpotLightIface
Returns:
light rotation along x axis

getRotY

public float getRotY()
Description copied from interface: SpotLightIface
Returns the degrees of ratation of the light along the y axis

Specified by:
getRotY in interface SpotLightIface
Returns:
light rotation along y axis