com.brackeen.javagamebook.math3D
Class PointLight3D

java.lang.Object
  extended bycom.brackeen.javagamebook.math3D.Vector3D
      extended bycom.brackeen.javagamebook.math3D.PointLight3D
All Implemented Interfaces:
Transformable

public class PointLight3D
extends Vector3D

A PointLight3D is a point light that has an intensity (between 0 and 1) and optionally a distance falloff value, which causes the light to diminish with distance.


Field Summary
static float NO_DISTANCE_FALLOFF
           
 
Fields inherited from class com.brackeen.javagamebook.math3D.Vector3D
x, y, z
 
Constructor Summary
PointLight3D()
          Creates a new PointLight3D at (0,0,0) with an intensity of 1 and no distance falloff.
PointLight3D(float x, float y, float z, float intensity)
          Creates a new PointLight3D with the specified location and intensity.
PointLight3D(float x, float y, float z, float intensity, float distanceFalloff)
          Creates a new PointLight3D with the specified location.
PointLight3D(PointLight3D p)
          Creates a copy of the specified PointLight3D.
 
Method Summary
 float getDistanceFalloff()
          Gets the distances falloff value.
 float getIntensity()
          Gets the intensity of this light.
 float getIntensity(float distance)
          Gets the intensity of this light from the specified distance.
 void setDistanceFalloff(float distanceFalloff)
          Sets the distances falloff value.
 void setIntensity(float intensity)
          Sets the intensity of this light.
 void setTo(PointLight3D p)
          Sets this PointLight3D to the same location, intensity, and distance falloff as the specified PointLight3D.
 
Methods inherited from class com.brackeen.javagamebook.math3D.Vector3D
add, add, add, addRotation, divide, equals, equals, getDistance, getDistanceSq, getDotProduct, length, multiply, normalize, rotateX, rotateX, rotateY, rotateY, rotateZ, rotateZ, setLength, setTo, setTo, setToCrossProduct, subtract, subtract, subtract, subtractRotation, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_DISTANCE_FALLOFF

public static final float NO_DISTANCE_FALLOFF
See Also:
Constant Field Values
Constructor Detail

PointLight3D

public PointLight3D()
Creates a new PointLight3D at (0,0,0) with an intensity of 1 and no distance falloff.


PointLight3D

public PointLight3D(PointLight3D p)
Creates a copy of the specified PointLight3D.


PointLight3D

public PointLight3D(float x,
                    float y,
                    float z,
                    float intensity)
Creates a new PointLight3D with the specified location and intensity. The created light has no distance falloff.


PointLight3D

public PointLight3D(float x,
                    float y,
                    float z,
                    float intensity,
                    float distanceFalloff)
Creates a new PointLight3D with the specified location. intensity, and no distance falloff.

Method Detail

setTo

public void setTo(PointLight3D p)
Sets this PointLight3D to the same location, intensity, and distance falloff as the specified PointLight3D.


getIntensity

public float getIntensity(float distance)
Gets the intensity of this light from the specified distance.


getIntensity

public float getIntensity()
Gets the intensity of this light.


setIntensity

public void setIntensity(float intensity)
Sets the intensity of this light.


getDistanceFalloff

public float getDistanceFalloff()
Gets the distances falloff value. The light intensity is zero beyond this distance.


setDistanceFalloff

public void setDistanceFalloff(float distanceFalloff)
Sets the distances falloff value. The light intensity is zero beyond this distance. Set to NO_DISTANCE_FALLOFF if the light does not diminish with distance.