public class PointLight extends Light
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 affected object.
Light.Type| Modifier and Type | Field and Description |
|---|---|
protected float |
invRadius |
protected Vector3f |
position |
protected float |
radius |
color, enabled, lastDistance, name| Constructor and Description |
|---|
PointLight()
Creates a PointLight
|
PointLight(Vector3f position)
Creates a PointLight at the given position
|
PointLight(Vector3f position,
ColorRGBA color)
Creates a PointLight at the given position and with the given color
|
PointLight(Vector3f position,
ColorRGBA color,
float radius)
Creates a PointLight at the given position, with the given color and the
given radius
|
PointLight(Vector3f position,
float radius)
Creates a PointLight at the given position, with the given radius
|
| Modifier and Type | Method and Description |
|---|---|
PointLight |
clone() |
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
|
boolean |
intersectsBox(BoundingBox box,
TempVars vars)
Determines if the light intersects with the given bounding box.
|
boolean |
intersectsFrustum(Camera camera,
TempVars vars)
Determines if the light intersects with the given camera frustum.
|
boolean |
intersectsSphere(BoundingSphere sphere,
TempVars vars)
Determines if the light intersects with the given bounding sphere.
|
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) |
getColor, getName, isEnabled, isFrustumCheckNeeded, isIntersectsFrustum, setColor, setEnabled, setFrustumCheckNeeded, setIntersectsFrustum, setNameprotected Vector3f position
protected float radius
protected float invRadius
public PointLight()
public PointLight(Vector3f position)
position - the position in world spacepublic PointLight(Vector3f position, ColorRGBA color)
position - the position in world spacecolor - the light colorpublic PointLight(Vector3f position, ColorRGBA color, float radius)
position - the position in world spacecolor - the light colorradius - the light radiuspublic PointLight(Vector3f position, float radius)
position - the position in world spaceradius - the light radiuspublic void computeLastDistance(Spatial owner)
LightcomputeLastDistance in class Lightpublic Vector3f getPosition()
setPosition(com.jme3.math.Vector3f)public final void setPosition(Vector3f position)
position - the world space position of the light.public float getRadius()
public final void setRadius(float radius)
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 affected by this light, if the distance is less than the radius, then the magnitude of the influence is equal to distance / radius.
radius - the radius of the light influence.java.lang.IllegalArgumentException - If radius is negativepublic float getInvRadius()
public Light.Type getType()
LightgetType in class LightLight.Typepublic boolean intersectsBox(BoundingBox box, TempVars vars)
Light
For non-local lights, such as directional lights,
ambient lights, or point lights
without influence radius, this method should always return true.
intersectsBox in class Lightbox - The box to check intersection against.vars - TempVars in case it is needed.public boolean intersectsSphere(BoundingSphere sphere, TempVars vars)
Light
For non-local lights, such as directional lights,
ambient lights, or point lights
without influence radius, this method should always return true.
intersectsSphere in class Lightsphere - The sphere to check intersection against.vars - TempVars in case it is needed.public boolean intersectsFrustum(Camera camera, TempVars vars)
Lightdirectional lights,
ambient lights, or point lights
without influence radius, this method should always return true.intersectsFrustum in class Lightcamera - The camera frustum to check intersection against.vars - TempVars in case it is needed.public void write(JmeExporter ex) throws java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
public PointLight clone()