Package gov.nih.mipav.view.renderer.J3D
Class SoftwareLightSpot
java.lang.Object
gov.nih.mipav.view.renderer.J3D.SoftwareLight
gov.nih.mipav.view.renderer.J3D.SoftwareLightPoint
gov.nih.mipav.view.renderer.J3D.SoftwareLightSpot
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 Summary
FieldsModifier and TypeFieldDescription(package private) javax.vecmath.Color3fDOCUMENT ME!(package private) javax.vecmath.Color3fDOCUMENT ME!(package private) javax.vecmath.Vector3fDOCUMENT ME!(package private) javax.vecmath.Vector3fDOCUMENT ME!(package private) javax.vecmath.Vector3fDOCUMENT ME!protected floatthe spot cone angle and exponent.protected floatcosine of the spot cone angle, to avoid computing cosine repeatedly.protected floatDOCUMENT ME!protected final javax.vecmath.Vector3fthe spot cone unit-length axis.(package private) javax.vecmath.Vector3fDOCUMENT ME!(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.Vector3fDOCUMENT ME!(package private) javax.vecmath.Color3fDOCUMENT ME!(package private) javax.vecmath.Color3fDOCUMENT ME!(package private) javax.vecmath.Vector3fDOCUMENT ME!Fields inherited from class gov.nih.mipav.view.renderer.J3D.SoftwareLightPoint
cos_alpha, cos_theta, diffuseColor, m_bAttenuate, m_fA0, m_fA1, m_fA2, m_kDirection, position, R, specularColorFields 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 spot light.Copy (deep) constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal javax.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 voidcomputeSpot(javax.vecmath.Vector3f kDirection) Compute the attenuation due to the spot cone geometry.copy()Create a deep copy of this Light instance.floatgetAngle()Get the spot cone angle.javax.vecmath.Vector3fGet the light direction.floatGet the spot cone exponent.voidsetAngle(float fAngle) Set the spot cone angle.voidsetDirection(float fX, float fY, float fZ) Set the light direction.voidsetDirection(javax.vecmath.Vector3f v) Set the light direction.voidsetExponent(float fExponent) Set the spot cone exponent.Methods inherited from class gov.nih.mipav.view.renderer.J3D.SoftwareLightPoint
computeAttenuation, getAttenuation0, getAttenuation1, getAttenuation2, getPosition, setAttenuation, setPosition, setPositionMethods inherited from class gov.nih.mipav.view.renderer.J3D.SoftwareLight
addAmbient, addDiffuse, addSpecular, initView, normalize
-
Field Details
-
m_fAngle
protected float m_fAnglethe spot cone angle and exponent. -
m_fCosAngle
protected float m_fCosAnglecosine of the spot cone angle, to avoid computing cosine repeatedly. -
m_fExponent
protected float m_fExponentDOCUMENT ME! -
m_kAxis
protected final javax.vecmath.Vector3f m_kAxisthe spot cone unit-length axis. -
ambientColor
javax.vecmath.Color3f ambientColorDOCUMENT ME! -
diffsum
javax.vecmath.Color3f diffsumDOCUMENT ME! -
L
javax.vecmath.Vector3f LDOCUMENT ME! -
lightDirection
javax.vecmath.Vector3f lightDirectionDOCUMENT ME! -
Lneg
javax.vecmath.Vector3f LnegDOCUMENT ME! -
N
javax.vecmath.Vector3f NDOCUMENT ME! -
nScale
javax.vecmath.Vector3f nScaleDOCUMENT ME! -
result
javax.vecmath.Color3f resultDOCUMENT ME! -
specsum
javax.vecmath.Color3f specsumDOCUMENT ME! -
specularVector
javax.vecmath.Vector3f specularVectorDOCUMENT ME! -
V
javax.vecmath.Vector3f VDOCUMENT ME! -
vertexDiffuse
javax.vecmath.Color3f vertexDiffuseDOCUMENT ME! -
vertexSpecular
javax.vecmath.Color3f vertexSpecularDOCUMENT ME! -
viewDirection
javax.vecmath.Vector3f viewDirectionDOCUMENT 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
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:
colorOfin classSoftwareLightPoint- 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.- Overrides:
copyin classSoftwareLightPoint- 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
-