Class SoftwareLightSet

java.lang.Object
gov.nih.mipav.view.renderer.J3D.SoftwareLightSet

public class SoftwareLightSet extends Object
This class maintains a set of SoftwareLight instances where each light can be of type ambient, directional, point, or spot. Furthermore, each light can have position and direction in model coordinates or in world coordinates where a transformation can be specified which converts world coordinates to model coordinates. This class is also used to apply the complete set of lighting to a "cell" in model coordinates which consists of a set of coordinates, a normal vector, and a color along with some other default "material" properties.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private SoftwareLight[]
    Array of software lights in model coordinates.
    private javax.vecmath.Vector3f[]
    Array of world coordinate vectors for software world lights.
    private javax.vecmath.Vector3f[]
    Array of model coordinate vectors for software world lights corresponding to the entries in the m_akLightsWorldDirection array.
    private SoftwareLight[]
    Array of software lights converted from world coordinates to model coordinates.
    private javax.vecmath.Point3f[]
    Array of world coordinate positions for software world lights.
    private javax.vecmath.Point3f[]
    Array of model coordinate positions for software world lights corresponding to the entries in the m_akLightsWorldPosition array.
    private javax.vecmath.Vector3f
    Avoid memory reallocations.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyWorldToModelTransform(javax.vecmath.Matrix3f kTransform)
    Apply a 3x3 transformation to the software world light position and direction which are in world coordinates so that they are converted to model coordinates.
    void
    applyWorldToModelTransform(javax.vecmath.Vector3f kAxisX, javax.vecmath.Vector3f kAxisY, javax.vecmath.Vector3f kAxisZ)
    Apply a 3x3 transformation to the software world light position and direction which are in world coordinates so that they are converted to model coordinates.
    javax.vecmath.Color3f
    getCellColor(SoftwareMaterial kMaterial, SoftwareVertexProperty kVertexProperty, javax.vecmath.Point3f kEyeModel)
    Compute the "lighted" color of the cell at the specified position with the specified normal vector and base color.
    boolean
    Determine if any "model" relative lights are enabled.
    boolean
    Determine if any "world" positioned lights are enabled.
    void
    Specify a set of software lights defined in model coordinates.
    void
    Specify a set of software lights defined in world coordinates.

    Methods inherited from class java.lang.Object

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

    • m_akLightsModel

      private SoftwareLight[] m_akLightsModel
      Array of software lights in model coordinates.
    • m_akLightsWorldDirection

      private javax.vecmath.Vector3f[] m_akLightsWorldDirection
      Array of world coordinate vectors for software world lights. An array item may be null if that software light does not have a direction (e.g., ambient or point).
    • m_akLightsWorldDirectionInModelSpace

      private javax.vecmath.Vector3f[] m_akLightsWorldDirectionInModelSpace
      Array of model coordinate vectors for software world lights corresponding to the entries in the m_akLightsWorldDirection array.
    • m_akLightsWorldInModelSpace

      private SoftwareLight[] m_akLightsWorldInModelSpace
      Array of software lights converted from world coordinates to model coordinates.
    • m_akLightsWorldPosition

      private javax.vecmath.Point3f[] m_akLightsWorldPosition
      Array of world coordinate positions for software world lights. An array item may be null if that software light does not have a position (e.g., ambient or directional).
    • m_akLightsWorldPositionInModelSpace

      private javax.vecmath.Point3f[] m_akLightsWorldPositionInModelSpace
      Array of model coordinate positions for software world lights corresponding to the entries in the m_akLightsWorldPosition array.
    • m_kV

      private javax.vecmath.Vector3f m_kV
      Avoid memory reallocations.
  • Constructor Details

    • SoftwareLightSet

      public SoftwareLightSet()
      Default constructor. Creates empty set of lights.
  • Method Details

    • applyWorldToModelTransform

      public void applyWorldToModelTransform(javax.vecmath.Matrix3f kTransform)
      Apply a 3x3 transformation to the software world light position and direction which are in world coordinates so that they are converted to model coordinates.
      Parameters:
      kTransform - Matrix3f Contains the 3x3 rotation transformation.
    • applyWorldToModelTransform

      public void applyWorldToModelTransform(javax.vecmath.Vector3f kAxisX, javax.vecmath.Vector3f kAxisY, javax.vecmath.Vector3f kAxisZ)
      Apply a 3x3 transformation to the software world light position and direction which are in world coordinates so that they are converted to model coordinates.
      Parameters:
      kAxisX - Vector3f X axis vector of 3x3 transformation.
      kAxisY - Vector3f Y axis vector of 3x3 transformation.
      kAxisZ - Vector3f Z axis vector of 3x3 transformation.
    • getCellColor

      public javax.vecmath.Color3f getCellColor(SoftwareMaterial kMaterial, SoftwareVertexProperty kVertexProperty, javax.vecmath.Point3f kEyeModel)
      Compute the "lighted" color of the cell at the specified position with the specified normal vector and base color. This is based on application of all the world and model lights to this cell.
      Parameters:
      kMaterial - SoftwareMaterial Contains default material properties for lighting some of which may be overridden by properties specified in the vertex propertyies.
      kVertexProperty - SoftwareVertexProperty Contains the position, normal, and optional diffuse/specular colors defined for this cell.
      kEyeModel - Point3f Position of the eyepoint in model coordinates.
      Returns:
      Color3f Computed "lighted" color clamped so as not to exceed white.
    • isAnyModelLightEnabled

      public boolean isAnyModelLightEnabled()
      Determine if any "model" relative lights are enabled.
      Returns:
      boolean True if any "model" relative lights are enabled.
    • isAnyWorldLightEnabled

      public boolean isAnyWorldLightEnabled()
      Determine if any "world" positioned lights are enabled.
      Returns:
      boolean True if any "world" positioned lights are enabled.
    • setModelLights

      public void setModelLights(SoftwareLight[] akLights)
      Specify a set of software lights defined in model coordinates.
      Parameters:
      akLights - SoftwareLight[] Array of software lights in model coordinats.
    • setWorldLights

      public void setWorldLights(SoftwareLight[] akLights)
      Specify a set of software lights defined in world coordinates.

      Note: If a transformation was applied previously to convert world lights to model coordinates, this transformation will have to be respecified to convert these world lights to model coordinates.

      Parameters:
      akLights - SoftwareLight[] Array of software lights in world coordinates.