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

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

public class PositionalLight
extends AbstractLight
implements PositionalLightIface

This class represents a positional OpenGL light.

Author:
Frank Bruns

Constructor Summary
PositionalLight(int lightNumber)
          Creates a positional light with the specified number
 
Method Summary
 void bind(javax.media.opengl.GL gl)
          Starts using the light.
 float getConstAttenuation()
          Returns the constant attenuation factor of the light
 float getLinearAttenuation()
          Returns the linear attenuation factor.
 Point3D getPosition()
          Returns the position of the light as new Point3D object
 float getQuadraticAttenuation()
          Returns the quadric attenuation factor.
 void setConstAttenuation(float constAttenuation)
          Sets the constant attenuation factor [0,1].
 void setLinearAttenuation(float linearAttenuation)
          Sets the linear attenuation factor [0,1].
 void setPosition(float x, float y, float z)
          Sets the position of the light
 void setPosition(Point3D pos)
          Sets the position of the light
 void setQuadraticAttenuation(float quadraticAttenuation)
          Sets the quadric attenuation factor [0,1].
 void setShowLightPosition(boolean show)
          Determines whether the light's position will be symbolized by a little solid cube.
 void setX(float x)
          Sets the x-position of the light
 void setY(float y)
          Sets the y-position of the light
 void setZ(float z)
          Sets the z-position 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

PositionalLight

public PositionalLight(int lightNumber)
Creates a positional light with the specified number

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

setShowLightPosition

public void setShowLightPosition(boolean show)
Determines whether the light's position will be symbolized by a little solid cube.

Parameters:
show - Symbolize light position? --> true = yes, false = no

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

setPosition

public void setPosition(float x,
                        float y,
                        float z)
Description copied from interface: PositionalLightIface
Sets the position of the light

Specified by:
setPosition in interface PositionalLightIface
Parameters:
x - x-coordinate
y - y-coordinate
z - z-coordinate

setPosition

public void setPosition(Point3D pos)
Description copied from interface: PositionalLightIface
Sets the position of the light

Specified by:
setPosition in interface PositionalLightIface
Parameters:
pos - light position

setX

public void setX(float x)
Description copied from interface: PositionalLightIface
Sets the x-position of the light

Specified by:
setX in interface PositionalLightIface
Parameters:
x - new x-coordinate

setY

public void setY(float y)
Description copied from interface: PositionalLightIface
Sets the y-position of the light

Specified by:
setY in interface PositionalLightIface
Parameters:
y - new y-coordinate

setZ

public void setZ(float z)
Description copied from interface: PositionalLightIface
Sets the z-position of the light

Specified by:
setZ in interface PositionalLightIface
Parameters:
z - new z-coordinate

getPosition

public Point3D getPosition()
Description copied from interface: PositionalLightIface
Returns the position of the light as new Point3D object

Specified by:
getPosition in interface PositionalLightIface
Returns:
the light's position

getConstAttenuation

public float getConstAttenuation()
Returns the constant attenuation factor of the light

Returns:
constant attenuation

setConstAttenuation

public void setConstAttenuation(float constAttenuation)
Sets the constant attenuation factor [0,1].

Parameters:
constAttenuation - constant attenuation

getLinearAttenuation

public float getLinearAttenuation()
Returns the linear attenuation factor.

Returns:
linear attenuation

setLinearAttenuation

public void setLinearAttenuation(float linearAttenuation)
Sets the linear attenuation factor [0,1].

Parameters:
linearAttenuation - linear attenuation

getQuadraticAttenuation

public float getQuadraticAttenuation()
Returns the quadric attenuation factor.

Returns:
quadric attenuation

setQuadraticAttenuation

public void setQuadraticAttenuation(float quadraticAttenuation)
Sets the quadric attenuation factor [0,1].

Parameters:
quadraticAttenuation - quadric attenuation