com.jme3.light
Class PointLight

java.lang.Object
  extended by com.jme3.light.Light
      extended by com.jme3.light.PointLight
All Implemented Interfaces:
Savable, java.lang.Cloneable

public class PointLight
extends Light

Represents a point light. A point light emits light from a given position into all directions in space. E.g a lamp or a bright effect. Point light positions are in world space.

In addition to a position, point lights also have a radius which can be used to attenuate the influence of the light depending on the distance between the light and the effected object.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme3.light.Light
Light.Type
 
Field Summary
protected  float invRadius
           
protected  Vector3f position
           
protected  float radius
           
 
Fields inherited from class com.jme3.light.Light
color, enabled, lastDistance, name
 
Constructor Summary
PointLight()
           
 
Method Summary
 void computeLastDistance(Spatial owner)
          Used internally to compute the last distance value.
 float getInvRadius()
          for internal use only
 Vector3f getPosition()
          Returns the world space position of the light.
 float getRadius()
          Returns the radius of the light influence.
 Light.Type getType()
          Returns the light type
 void read(JmeImporter im)
           
 void setPosition(Vector3f position)
          Set the world space position of the light.
 void setRadius(float radius)
          Set the radius of the light influence.
 void write(JmeExporter ex)
           
 
Methods inherited from class com.jme3.light.Light
clone, getColor, getName, setColor, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

position

protected Vector3f position

radius

protected float radius

invRadius

protected float invRadius
Constructor Detail

PointLight

public PointLight()
Method Detail

computeLastDistance

public void computeLastDistance(Spatial owner)
Description copied from class: Light
Used internally to compute the last distance value.

Specified by:
computeLastDistance in class Light

getPosition

public Vector3f getPosition()
Returns the world space position of the light.

Returns:
the world space position of the light.
See Also:
setPosition(com.jme3.math.Vector3f)

setPosition

public void setPosition(Vector3f position)
Set the world space position of the light.

Parameters:
position - the world space position of the light.

getRadius

public float getRadius()
Returns the radius of the light influence. A radius of 0 means the light has no attenuation.

Returns:
the radius of the light

setRadius

public void setRadius(float radius)
Set the radius of the light influence.

Setting a non-zero radius indicates the light should use attenuation. If a pixel's distance to this light's position is greater than the light's radius, then the pixel will not be effected by this light, if the distance is less than the radius, then the magnitude of the influence is equal to distance / radius.

Parameters:
radius - the radius of the light influence.
Throws:
java.lang.IllegalArgumentException - If radius is negative

getInvRadius

public float getInvRadius()
for internal use only

Returns:
the inverse of the radius

getType

public Light.Type getType()
Description copied from class: Light
Returns the light type

Specified by:
getType in class Light
Returns:
the light type
See Also:
Light.Type

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class Light
Throws:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class Light
Throws:
java.io.IOException