Package com.jme3.light
Class DirectionalLight
java.lang.Object
com.jme3.light.Light
com.jme3.light.DirectionalLight
DirectionalLight
is a light coming from a certain direction in world space.
E.g. sun or moon light.
Directional lights have no specific position in the scene, they always come from their direction regardless of where an object is placed.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.light.Light
Light.Type
-
Field Summary
Fields inherited from class com.jme3.light.Light
color, enabled, lastDistance, name
-
Constructor Summary
ConstructorDescriptionCreates a DirectionalLightDirectionalLight
(Vector3f direction) Creates a DirectionalLight with the given directionDirectionalLight
(Vector3f direction, ColorRGBA color) Creates a DirectionalLight with the given direction and the given color -
Method Summary
Modifier and TypeMethodDescriptionclone()
void
computeLastDistance
(Spatial owner) Used internally to compute the last distance value.Returns the direction vector of the light.getType()
Returns the light typeboolean
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) final void
setDirection
(Vector3f dir) Sets the direction of the light.toString()
void
write
(JmeExporter ex) Methods inherited from class com.jme3.light.Light
getColor, getName, isEnabled, isFrustumCheckNeeded, isIntersectsFrustum, setColor, setEnabled, setFrustumCheckNeeded, setIntersectsFrustum, setName
-
Field Details
-
direction
-
-
Constructor Details
-
DirectionalLight
public DirectionalLight()Creates a DirectionalLight -
DirectionalLight
Creates a DirectionalLight with the given direction- Parameters:
direction
- the light's direction
-
DirectionalLight
Creates a DirectionalLight with the given direction and the given color- Parameters:
direction
- the light's directioncolor
- the light's color
-
-
Method Details
-
computeLastDistance
Description copied from class:Light
Used internally to compute the last distance value.- Specified by:
computeLastDistance
in classLight
- Parameters:
owner
- the Spatial whose distance is to be determined
-
getDirection
Returns the direction vector of the light.- Returns:
- The direction vector of the light.
- See Also:
-
setDirection
Sets the direction of the light.Represents the direction the light is shining. (1, 0, 0) would represent light shining in the +X direction.
- Parameters:
dir
- the direction of the light.
-
intersectsBox
Description copied from class:Light
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.- Specified by:
intersectsBox
in classLight
- 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
Description copied from class:Light
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.- Specified by:
intersectsSphere
in classLight
- 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
Description copied from class:Light
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.- Specified by:
intersectsFrustum
in classLight
- 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.
-
getType
Description copied from class:Light
Returns the light type -
toString
-
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classLight
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classLight
- Throws:
IOException
-
clone
-