com.jme.light
Class SpotLight

java.lang.Object
  extended by com.jme.light.Light
      extended by com.jme.light.PointLight
          extended by com.jme.light.SpotLight
All Implemented Interfaces:
Savable, java.io.Serializable

public class SpotLight
extends PointLight

SpotLight defines a light that has a location in space and emits light within a cone. This cone is defined by an angle and exponent. Typically this light's values are attenuated based on the distance of the point light and the object it illuminates.

Version:
$Id: SpotLight.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Mark Powell
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme.light.Light
Light.Type
 
Field Summary
 
Fields inherited from class com.jme.light.Light
shadowCaster
 
Constructor Summary
SpotLight()
          Constructor instantiates a new SpotLight object.
 
Method Summary
 float getAngle()
          getAngle returns the angle of the spot light.
 Vector3f getDirection()
          getDirection returns the direction the spot light pointing.
 float getExponent()
          getExponent gets the spot exponent of this light.
 Light.Type getType()
          getType returns the type of this light (Type.Spot).
 void read(JMEImporter e)
           
 void setAngle(float angle)
          setAngle sets the angle of focus of the spot light measured from the direction vector.
 void setDirection(Vector3f direction)
          setDirection sets the direction the spot light is pointing.
 void setExponent(float exponent)
          setExponent sets the spot exponent of this light.
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.light.PointLight
getLocation, setLocation
 
Methods inherited from class com.jme.light.Light
copyFrom, getAmbient, getClassTag, getConstant, getDiffuse, getLightMask, getLinear, getQuadratic, getSpecular, isAttenuate, isEnabled, isShadowCaster, popLightMask, pushLightMask, setAmbient, setAttenuate, setConstant, setDiffuse, setEnabled, setLightMask, setLinear, setQuadratic, setShadowCaster, setSpecular
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpotLight

public SpotLight()
Constructor instantiates a new SpotLight object. The initial position of the light is (0,0,0) with angle 0, and colors white.

Method Detail

getDirection

public Vector3f getDirection()
getDirection returns the direction the spot light pointing.

Returns:
the direction the spot light is pointing.

setDirection

public void setDirection(Vector3f direction)
setDirection sets the direction the spot light is pointing.

Parameters:
direction - the direction the spot light is pointing.

getAngle

public float getAngle()
getAngle returns the angle of the spot light.

Returns:
the angle (in degrees)
See Also:
for more info

setAngle

public void setAngle(float angle)
setAngle sets the angle of focus of the spot light measured from the direction vector. Think of this as the angle of a cone. Therefore, if you specify 10 degrees, you will get a 20 degree cone (10 degrees off either side of the direction vector.) 180 degrees means radiate in all directions.

Parameters:
angle - the angle (in degrees) which must be between 0 and 90 (inclusive) or the special case 180.

getExponent

public float getExponent()
getExponent gets the spot exponent of this light.

Returns:
the spot exponent of this light.
See Also:
for more info

setExponent

public void setExponent(float exponent)
setExponent sets the spot exponent of this light. This value represents how focused the light beam is.

Parameters:
exponent - the spot exponent of this light. Should be between 0-128

getType

public Light.Type getType()
getType returns the type of this light (Type.Spot).

Overrides:
getType in class PointLight
Returns:
the type of light that has been created.
See Also:
Light.getType()

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class PointLight
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class PointLight
Throws:
java.io.IOException