Package gov.nih.mipav.view.renderer.J3D
Class SoftwareLightPoint
java.lang.Object
gov.nih.mipav.view.renderer.J3D.SoftwareLight
gov.nih.mipav.view.renderer.J3D.SoftwareLightPoint
- Direct Known Subclasses:
SoftwareLightSpot
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
FieldsModifier and TypeFieldDescription(package private) javax.vecmath.Color3fDOCUMENT ME!(package private) floatDOCUMENT ME!(package private) floatDOCUMENT ME!(package private) javax.vecmath.Color3fDOCUMENT ME!(package private) javax.vecmath.Vector3fDOCUMENT ME!protected booleanDOCUMENT ME!protected floatAttenuation coefficients (inverse quadratic attenuation).protected floatAttenuation coefficients (inverse quadratic attenuation).protected floatAttenuation coefficients (inverse quadratic attenuation).protected final javax.vecmath.Vector3fTo avoid memory allocations.(package private) javax.vecmath.Vector3fDOCUMENT ME!protected final javax.vecmath.Point3fthe light's position.(package private) javax.vecmath.Vector3fDOCUMENT ME!(package private) javax.vecmath.Color3fDOCUMENT ME!(package private) javax.vecmath.Color3fDOCUMENT ME!(package private) javax.vecmath.Vector3fDOCUMENT ME!(package private) javax.vecmath.Color3fDOCUMENT 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
ConstructorsConstructorDescriptionConstruct a point light.Copy (deep) constructor. -
Method Summary
Modifier and TypeMethodDescriptionjavax.vecmath.Color3fcolorOf(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 voidcomputeAttenuation(float fDistance) Compute the attenuation factor as an inverse quadratic polynomial.copy()Create a deep copy of this Light instance.floatGet the constant term of the attenuation polynomial.floatGet the linear term of the attenuation polynomial.floatGet the quadratic term of the attenuation polynomial.javax.vecmath.Point3fGet the light source position.voidsetAttenuation(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.voidsetPosition(float fX, float fY, float fZ) Set the light source position.voidsetPosition(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
-
Field Details
-
m_bAttenuate
protected boolean m_bAttenuateDOCUMENT ME! -
m_fA0
protected float m_fA0Attenuation 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_fA1Attenuation 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_fA2Attenuation 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_kDirectionTo 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 positionthe light's position. -
ambientColor
javax.vecmath.Color3f ambientColorDOCUMENT ME! -
cos_theta
float cos_thetaDOCUMENT ME! -
cos_alpha
float cos_alphaDOCUMENT ME! -
diffuseColor
javax.vecmath.Color3f diffuseColorDOCUMENT ME! -
L
javax.vecmath.Vector3f LDOCUMENT ME! -
N
javax.vecmath.Vector3f NDOCUMENT ME! -
R
javax.vecmath.Vector3f RDOCUMENT ME! -
result
javax.vecmath.Color3f resultDOCUMENT ME! -
specularColor
javax.vecmath.Color3f specularColorDOCUMENT ME! -
V
javax.vecmath.Vector3f VDOCUMENT ME! -
vertexDiffuse
javax.vecmath.Color3f vertexDiffuseDOCUMENT 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
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:
colorOfin classSoftwareLight- 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
Create a deep copy of this Light instance.- Specified by:
copyin classSoftwareLight- 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 a0fA1- coefficient a1fA2- 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
-