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
-
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 Summary
Fields Modifier and Type Field Description (package private) javax.vecmath.Color3f
ambientColor
DOCUMENT ME!(package private) javax.vecmath.Color3f
diffsum
DOCUMENT ME!(package private) javax.vecmath.Vector3f
L
DOCUMENT ME!(package private) javax.vecmath.Vector3f
lightDirection
DOCUMENT ME!(package private) javax.vecmath.Vector3f
Lneg
DOCUMENT ME!protected float
m_fAngle
the spot cone angle and exponent.protected float
m_fCosAngle
cosine of the spot cone angle, to avoid computing cosine repeatedly.protected float
m_fExponent
DOCUMENT ME!protected javax.vecmath.Vector3f
m_kAxis
the spot cone unit-length axis.(package private) javax.vecmath.Vector3f
N
DOCUMENT ME!(package private) javax.vecmath.Vector3f
nScale
DOCUMENT ME!(package private) javax.vecmath.Color3f
result
DOCUMENT ME!(package private) javax.vecmath.Color3f
specsum
DOCUMENT ME!(package private) javax.vecmath.Vector3f
specularVector
DOCUMENT ME!(package private) javax.vecmath.Vector3f
V
DOCUMENT ME!(package private) javax.vecmath.Color3f
vertexDiffuse
DOCUMENT ME!(package private) javax.vecmath.Color3f
vertexSpecular
DOCUMENT ME!(package private) javax.vecmath.Vector3f
viewDirection
DOCUMENT 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, specularColor
-
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 SoftwareLightSpot()
Construct a spot light.SoftwareLightSpot(SoftwareLightSpot kThat)
Copy (deep) constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods 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
computeSpot(javax.vecmath.Vector3f kDirection)
Compute the attenuation due to the spot cone geometry.SoftwareLight
copy()
Create a deep copy of this Light instance.float
getAngle()
Get the spot cone angle.javax.vecmath.Vector3f
getDirection()
Get the light direction.float
getExponent()
Get the spot cone exponent.void
setAngle(float fAngle)
Set the spot cone angle.void
setDirection(float fX, float fY, float fZ)
Set the light direction.void
setDirection(javax.vecmath.Vector3f v)
Set the light direction.void
setExponent(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, setPosition
-
Methods inherited from class gov.nih.mipav.view.renderer.J3D.SoftwareLight
addAmbient, addDiffuse, addSpecular, initView, normalize
-
-
-
-
Field Detail
-
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 Detail
-
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 Detail
-
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 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
public SoftwareLight copy()
Create a deep copy of this Light instance.- Overrides:
copy
in 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
-
-