Class SoftwareLightPoint

java.lang.Object
gov.nih.mipav.view.renderer.J3D.SoftwareLight
gov.nih.mipav.view.renderer.J3D.SoftwareLightPoint
Direct Known Subclasses:
SoftwareLightSpot

public class SoftwareLightPoint extends SoftwareLight
The class for point 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 Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) javax.vecmath.Color3f
    DOCUMENT ME!
    (package private) float
    DOCUMENT ME!
    (package private) float
    DOCUMENT ME!
    (package private) javax.vecmath.Color3f
    DOCUMENT ME!
    (package private) javax.vecmath.Vector3f
    DOCUMENT ME!
    protected boolean
    DOCUMENT ME!
    protected float
    Attenuation coefficients (inverse quadratic attenuation).
    protected float
    Attenuation coefficients (inverse quadratic attenuation).
    protected float
    Attenuation coefficients (inverse quadratic attenuation).
    protected final javax.vecmath.Vector3f
    To avoid memory allocations.
    (package private) javax.vecmath.Vector3f
    DOCUMENT ME!
    protected final javax.vecmath.Point3f
    the light's position.
    (package private) javax.vecmath.Vector3f
    DOCUMENT ME!
    (package private) javax.vecmath.Color3f
    DOCUMENT ME!
    (package private) javax.vecmath.Color3f
    DOCUMENT ME!
    (package private) javax.vecmath.Vector3f
    DOCUMENT ME!
    (package private) javax.vecmath.Color3f
    DOCUMENT ME!

    Fields inherited from class gov.nih.mipav.view.renderer.J3D.SoftwareLight

    ambient, diffuse, intensity, m_fAttenuate, m_fSpot, m_kColor, m_kNormal, m_kReflect, m_kView, on, specular
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a point light.
    Copy (deep) constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    protected void
    computeAttenuation(float fDistance)
    Compute the attenuation factor as an inverse quadratic polynomial.
    Create a deep copy of this Light instance.
    float
    Get the constant term of the attenuation polynomial.
    float
    Get the linear term of the attenuation polynomial.
    float
    Get the quadratic term of the attenuation polynomial.
    javax.vecmath.Point3f
    Get the light source position.
    void
    setAttenuation(float fA0, float fA1, float fA2)
    Set the coefficients for inverse quadratic attenuation, attenuation = 1/(a0+a1*d+a2*d^2) where d is the distance from the light's position to the vertex.
    void
    setPosition(float fX, float fY, float fZ)
    Set the light source position.
    void
    setPosition(javax.vecmath.Point3f p)
    Set the light source position.

    Methods inherited from class gov.nih.mipav.view.renderer.J3D.SoftwareLight

    addAmbient, addDiffuse, addSpecular, initView, normalize

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • m_bAttenuate

      protected boolean m_bAttenuate
      DOCUMENT ME!
    • m_fA0

      protected float m_fA0
      Attenuation coefficients (inverse quadratic attenuation). The Boolean flag is 'false' whenever (a0,a1,a2) = (1,0,0), in which case the inverse quadratic attenuation is the identity mapping and no execution time should be spent evaluating the attenuation factor.
    • m_fA1

      protected float m_fA1
      Attenuation coefficients (inverse quadratic attenuation). The Boolean flag is 'false' whenever (a0,a1,a2) = (1,0,0), in which case the inverse quadratic attenuation is the identity mapping and no execution time should be spent evaluating the attenuation factor.
    • m_fA2

      protected float m_fA2
      Attenuation coefficients (inverse quadratic attenuation). The Boolean flag is 'false' whenever (a0,a1,a2) = (1,0,0), in which case the inverse quadratic attenuation is the identity mapping and no execution time should be spent evaluating the attenuation factor.
    • m_kDirection

      protected final javax.vecmath.Vector3f m_kDirection
      To avoid memory allocations. The vector is used to store the difference between a vertex to be lit and the light's position.
    • position

      protected final javax.vecmath.Point3f position
      the light's position.
    • ambientColor

      javax.vecmath.Color3f ambientColor
      DOCUMENT ME!
    • cos_theta

      float cos_theta
      DOCUMENT ME!
    • cos_alpha

      float cos_alpha
      DOCUMENT ME!
    • diffuseColor

      javax.vecmath.Color3f diffuseColor
      DOCUMENT ME!
    • L

      javax.vecmath.Vector3f L
      DOCUMENT ME!
    • N

      javax.vecmath.Vector3f N
      DOCUMENT ME!
    • R

      javax.vecmath.Vector3f R
      DOCUMENT ME!
    • result

      javax.vecmath.Color3f result
      DOCUMENT ME!
    • specularColor

      javax.vecmath.Color3f specularColor
      DOCUMENT ME!
    • V

      javax.vecmath.Vector3f V
      DOCUMENT ME!
    • vertexDiffuse

      javax.vecmath.Color3f vertexDiffuse
      DOCUMENT ME!
  • Constructor Details

    • SoftwareLightPoint

      public SoftwareLightPoint()
      Construct a point 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 light is positioned by default at the origin.
    • SoftwareLightPoint

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

    • colorOf

      public 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.
      Specified by:
      colorOf in class SoftwareLight
      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.
      Specified by:
      copy in class SoftwareLight
      Returns:
      Light Deep copy of this Light instance.
    • getAttenuation0

      public float getAttenuation0()
      Get the constant term of the attenuation polynomial.
      Returns:
      coefficient a0
    • getAttenuation1

      public float getAttenuation1()
      Get the linear term of the attenuation polynomial.
      Returns:
      coefficient a1
    • getAttenuation2

      public float getAttenuation2()
      Get the quadratic term of the attenuation polynomial.
      Returns:
      coefficient a2
    • getPosition

      public javax.vecmath.Point3f getPosition()
      Get the light source position.
      Returns:
      position light source position
    • setAttenuation

      public void setAttenuation(float fA0, float fA1, float fA2)
      Set the coefficients for inverse quadratic attenuation, attenuation = 1/(a0+a1*d+a2*d^2) where d is the distance from the light's position to the vertex. The coefficients must satisfy a0 >= 0, a1 >= 0, and a2 >= 0, but not all can be zero. No attenuation occurs when a0 = 1, a1 = 0, and a2 = 0.
      Parameters:
      fA0 - coefficient a0
      fA1 - coefficient a1
      fA2 - coefficient a2
    • setPosition

      public void setPosition(javax.vecmath.Point3f p)
      Set the light source position.
      Parameters:
      p - source position
    • setPosition

      public void setPosition(float fX, float fY, float fZ)
      Set the light source position.
      Parameters:
      fX - float X coordinate of light source position.
      fY - float Y coordinate of light source position.
      fZ - float Z coordinate of light source position.
    • computeAttenuation

      protected void computeAttenuation(float fDistance)
      Compute the attenuation factor as an inverse quadratic polynomial.
      Parameters:
      fDistance - the distance from the light's position to the vertex to be lit