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
FieldsFields inherited from class com.jme3.light.Light
color, enabled, lastDistance, name -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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()voidcomputeLastDistance(Spatial owner) Used internally to compute the last distance value.Returns the direction vector of the light.getType()Returns the light typebooleanintersectsBox(BoundingBox box, TempVars vars) Determines if the light intersects with the given bounding box.booleanintersectsFrustum(Camera camera, TempVars vars) Determines if the light intersects with the given camera frustum.booleanintersectsSphere(BoundingSphere sphere, TempVars vars) Determines if the light intersects with the given bounding sphere.voidread(JmeImporter im) final voidsetDirection(Vector3f dir) Sets the direction of the light.toString()voidwrite(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:LightUsed internally to compute the last distance value.- Specified by:
computeLastDistancein 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:LightDetermines 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.- Specified by:
intersectsBoxin 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:LightDetermines 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.- Specified by:
intersectsSpherein 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:LightDetermines 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.- Specified by:
intersectsFrustumin 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:LightReturns the light type -
toString
-
write
- Specified by:
writein interfaceSavable- Overrides:
writein classLight- Throws:
IOException
-
read
- Specified by:
readin interfaceSavable- Overrides:
readin classLight- Throws:
IOException
-
clone
-