Class SpotLight

All Implemented Interfaces:
Savable, 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.
See Also:
  • Constructor Details

    • 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 Details

    • getDirection

      public ReadOnlyVector3 getDirection()
      Returns:
      the direction the spot light is pointing.
    • setDirection

      public void setDirection(ReadOnlyVector3 direction)
      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:
    • 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:
    • 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:
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class PointLight
      Throws:
      IOException
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class PointLight
      Throws:
      IOException