Package com.jme3.light
Class Light
java.lang.Object
com.jme3.light.Light
- Direct Known Subclasses:
AmbientLight
,DirectionalLight
,LightProbe
,PointLight
,SpotLight
Abstract class for representing a light source.
All light source types have a color.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
protected abstract void
computeLastDistance
(Spatial owner) Used internally to compute the last distance value.getColor()
Returns the color of the light.getName()
Return the light name.abstract Light.Type
getType()
Returns the light typeabstract boolean
intersectsBox
(BoundingBox box, TempVars vars) Determines if the light intersects with the given bounding box.abstract boolean
intersectsFrustum
(Camera camera, TempVars vars) Determines if the light intersects with the given camera frustum.abstract boolean
intersectsSphere
(BoundingSphere sphere, TempVars vars) Determines if the light intersects with the given bounding sphere.boolean
Returns true if this light is enabled.boolean
boolean
void
read
(JmeImporter im) void
Sets the light color.void
setEnabled
(boolean enabled) Set to false in order to disable a light and have it filtered out from being included in rendering.void
setFrustumCheckNeeded
(boolean frustumCheckNeeded) void
setIntersectsFrustum
(boolean intersectsFrustum) void
This method sets the light name.void
write
(JmeExporter ex)
-
Field Details
-
color
-
lastDistance
protected transient float lastDistanceUsed in LightList for caching the distance to the owner spatial. Should be reset after the sorting. -
enabled
protected boolean enabled -
name
The light name.
-
-
Constructor Details
-
Light
protected Light() -
Light
-
-
Method Details
-
getColor
Returns the color of the light.- Returns:
- The color of the light.
-
setName
This method sets the light name.- Parameters:
name
- the light name
-
getName
Return the light name.- Returns:
- the light name
-
setColor
Sets the light color.- Parameters:
color
- the light color.
-
isEnabled
public boolean isEnabled()Returns true if this light is enabled.- Returns:
- true if enabled, otherwise false.
-
setEnabled
public void setEnabled(boolean enabled) Set to false in order to disable a light and have it filtered out from being included in rendering.- Parameters:
enabled
- true to enable and false to disable the light.
-
isFrustumCheckNeeded
public boolean isFrustumCheckNeeded() -
setFrustumCheckNeeded
public void setFrustumCheckNeeded(boolean frustumCheckNeeded) -
isIntersectsFrustum
public boolean isIntersectsFrustum() -
setIntersectsFrustum
public void setIntersectsFrustum(boolean intersectsFrustum) -
intersectsBox
Determines if the light intersects with the given bounding box.For non-local lights, such as
directional lights
,ambient lights
, orpoint lights
without influence radius, this method should always return true.- Parameters:
box
- The box to check intersection against.vars
- TempVars in case it is needed.- Returns:
- True if the light intersects the box, false otherwise.
-
intersectsSphere
Determines if the light intersects with the given bounding sphere.For non-local lights, such as
directional lights
,ambient lights
, orpoint lights
without influence radius, this method should always return true.- Parameters:
sphere
- The sphere to check intersection against.vars
- TempVars in case it is needed.- Returns:
- True if the light intersects the sphere, false otherwise.
-
intersectsFrustum
Determines if the light intersects with the given camera frustum. For non-local lights, such asdirectional lights
,ambient lights
, orpoint lights
without influence radius, this method should always return true.- Parameters:
camera
- The camera frustum to check intersection against.vars
- TempVars in case it is needed.- Returns:
- True if the light intersects the frustum, false otherwise.
-
clone
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
computeLastDistance
Used internally to compute the last distance value.- Parameters:
owner
- the Spatial whose distance is to be determined
-
getType
Returns the light type- Returns:
- the light type
- See Also:
-