Class SoftwareLightSpot


public class SoftwareLightSpot extends SoftwareLightPoint
The class for spot lights in a general lighting system to calculate diffuse and specular colors at a point in space.

See ShearWarpRendering.pdf for a detailed description of the lighting model.

  • Field Details

    • m_fAngle

      protected float m_fAngle
      the spot cone angle and exponent.
    • m_fCosAngle

      protected float m_fCosAngle
      cosine of the spot cone angle, to avoid computing cosine repeatedly.
    • m_fExponent

      protected float m_fExponent
      DOCUMENT ME!
    • m_kAxis

      protected final javax.vecmath.Vector3f m_kAxis
      the spot cone unit-length axis.
    • ambientColor

      javax.vecmath.Color3f ambientColor
      DOCUMENT ME!
    • diffsum

      javax.vecmath.Color3f diffsum
      DOCUMENT ME!
    • L

      javax.vecmath.Vector3f L
      DOCUMENT ME!
    • lightDirection

      javax.vecmath.Vector3f lightDirection
      DOCUMENT ME!
    • Lneg

      javax.vecmath.Vector3f Lneg
      DOCUMENT ME!
    • N

      javax.vecmath.Vector3f N
      DOCUMENT ME!
    • nScale

      javax.vecmath.Vector3f nScale
      DOCUMENT ME!
    • result

      javax.vecmath.Color3f result
      DOCUMENT ME!
    • specsum

      javax.vecmath.Color3f specsum
      DOCUMENT ME!
    • specularVector

      javax.vecmath.Vector3f specularVector
      DOCUMENT ME!
    • V

      javax.vecmath.Vector3f V
      DOCUMENT ME!
    • vertexDiffuse

      javax.vecmath.Color3f vertexDiffuse
      DOCUMENT ME!
    • vertexSpecular

      javax.vecmath.Color3f vertexSpecular
      DOCUMENT ME!
    • viewDirection

      javax.vecmath.Vector3f viewDirection
      DOCUMENT ME!
  • Constructor Details

    • SoftwareLightSpot

      public SoftwareLightSpot()
      Construct a spot light. The default colors are all black, the intensity is zero, and the light is off. The attenuation parameters are initialized to 1 (no attenuation). The class provides accessor methods for attenuation.
    • SoftwareLightSpot

      public SoftwareLightSpot(SoftwareLightSpot kThat)
      Copy (deep) constructor.
      Parameters:
      kThat - Light What to make "this" light like.
  • Method Details

    • colorOf

      public final javax.vecmath.Color3f colorOf(SoftwareMaterial kMaterial, SoftwareVertexProperty kVertexProperty, javax.vecmath.Point3f kEye)
      Compute the contribution of color from this light on the specified material with specified vertex properties.
      Overrides:
      colorOf in class SoftwareLightPoint
      Parameters:
      kMaterial - SoftwareMaterial Default properties for the material including emissive, ambient, diffuse, and specular colors along with the specular shininess which can be used to disable specular highlighting.
      kVertexProperty - SoftwareVertexProperty Properties of the vertex which include its position and normal vector along with optional material property overrides for the diffuse and specular colors.
      kEye - Point3f The location of the observer in the coordinate system defined for the light.
      Returns:
      Color3f Reference to the computed color contribution by this light with this vertex and its material properties. The instance returned is owned by this light.
    • copy

      public SoftwareLight copy()
      Create a deep copy of this Light instance.
      Overrides:
      copy in class SoftwareLightPoint
      Returns:
      Light Deep copy of this Light instance.
    • getAngle

      public float getAngle()
      Get the spot cone angle.
      Returns:
      the spot cone angle
    • getDirection

      public javax.vecmath.Vector3f getDirection()
      Get the light direction.
      Returns:
      m_kDirection light direction
    • getExponent

      public float getExponent()
      Get the spot cone exponent.
      Returns:
      the spot cone exponent
    • setAngle

      public void setAngle(float fAngle)
      Set the spot cone angle. The angle must be in [0,pi).
      Parameters:
      fAngle - the spot cone angle
    • setDirection

      public void setDirection(javax.vecmath.Vector3f v)
      Set the light direction.
      Parameters:
      v - light direction
    • setDirection

      public void setDirection(float fX, float fY, float fZ)
      Set the light direction.
      Parameters:
      fX - float X coordinate of the light direction vector.
      fY - float Y coordinate of the light direction vector.
      fZ - float Z coordinate of the light direction vector.
    • setExponent

      public void setExponent(float fExponent)
      Set the spot cone exponent. The exponent must be nonnegative. If it is zero, the light is completely attenuated.
      Parameters:
      fExponent - the spot cone exponent
    • computeSpot

      protected void computeSpot(javax.vecmath.Vector3f kDirection)
      Compute the attenuation due to the spot cone geometry.
      Parameters:
      kDirection - the unit-length direction from the light's position to the vertex