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 SummaryNested Classes
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionclone()protected abstract voidcomputeLastDistance(Spatial owner) Used internally to compute the last distance value.getColor()Returns the color of the light.getName()Return the light name.abstract Light.TypegetType()Returns the light typeabstract booleanintersectsBox(BoundingBox box, TempVars vars) Determines if the light intersects with the given bounding box.abstract booleanintersectsFrustum(Camera camera, TempVars vars) Determines if the light intersects with the given camera frustum.abstract booleanintersectsSphere(BoundingSphere sphere, TempVars vars) Determines if the light intersects with the given bounding sphere.booleanReturns true if this light is enabled.booleanbooleanvoidread(JmeImporter im) voidSets the light color.voidsetEnabled(boolean enabled) Set to false in order to disable a light and have it filtered out from being included in rendering.voidsetFrustumCheckNeeded(boolean frustumCheckNeeded) voidsetIntersectsFrustum(boolean intersectsFrustum) voidThis method sets the light name.voidwrite(JmeExporter ex) 
- 
Field Details- 
color
- 
lastDistanceprotected transient float lastDistanceUsed in LightList for caching the distance to the owner spatial. Should be reset after the sorting.
- 
enabledprotected boolean enabled
- 
nameThe light name.
 
- 
- 
Constructor Details- 
Lightprotected Light()
- 
Light
 
- 
- 
Method Details- 
getColorReturns the color of the light.- Returns:
- The color of the light.
 
- 
setNameThis method sets the light name.- Parameters:
- name- the light name
 
- 
getNameReturn the light name.- Returns:
- the light name
 
- 
setColorSets the light color.- Parameters:
- color- the light color.
 
- 
isEnabledpublic boolean isEnabled()Returns true if this light is enabled.- Returns:
- true if enabled, otherwise false.
 
- 
setEnabledpublic 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.
 
- 
isFrustumCheckNeededpublic boolean isFrustumCheckNeeded()
- 
setFrustumCheckNeededpublic void setFrustumCheckNeeded(boolean frustumCheckNeeded) 
- 
isIntersectsFrustumpublic boolean isIntersectsFrustum()
- 
setIntersectsFrustumpublic void setIntersectsFrustum(boolean intersectsFrustum) 
- 
intersectsBoxDetermines if the light intersects with the given bounding box.For non-local lights, such as directional lights,ambient lights, orpoint lightswithout 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.
 
- 
intersectsSphereDetermines if the light intersects with the given bounding sphere.For non-local lights, such as directional lights,ambient lights, orpoint lightswithout 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.
 
- 
intersectsFrustumDetermines if the light intersects with the given camera frustum. For non-local lights, such asdirectional lights,ambient lights, orpoint lightswithout 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:
- writein interface- Savable
- Throws:
- IOException
 
- 
read- Specified by:
- readin interface- Savable
- Throws:
- IOException
 
- 
computeLastDistanceUsed internally to compute the last distance value.- Parameters:
- owner- the Spatial whose distance is to be determined
 
- 
getTypeReturns the light type- Returns:
- the light type
- See Also:
 
 
-