public class DirectionalLight extends Light
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.
Light.Type
Modifier and Type | Field and Description |
---|---|
protected Vector3f |
direction |
color, enabled, lastDistance, name
Constructor and Description |
---|
DirectionalLight()
Creates a DirectionalLight
|
DirectionalLight(Vector3f direction)
Creates a DirectionalLight with the given direction
|
DirectionalLight(Vector3f direction,
ColorRGBA color)
Creates a DirectionalLight with the given direction and the given color
|
Modifier and Type | Method and Description |
---|---|
DirectionalLight |
clone() |
void |
computeLastDistance(Spatial owner)
Used internally to compute the last distance value.
|
Vector3f |
getDirection()
Returns the direction vector of the light.
|
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 |
setDirection(Vector3f dir)
Sets the direction of the light.
|
java.lang.String |
toString() |
void |
write(JmeExporter ex) |
getColor, getName, isEnabled, isFrustumCheckNeeded, isIntersectsFrustum, setColor, setEnabled, setFrustumCheckNeeded, setIntersectsFrustum, setName
protected Vector3f direction
public DirectionalLight()
public DirectionalLight(Vector3f direction)
direction
- the light's directionpublic void computeLastDistance(Spatial owner)
Light
computeLastDistance
in class Light
owner
- the Spatial whose distance is to be determinedpublic Vector3f getDirection()
setDirection(com.jme3.math.Vector3f)
public final void setDirection(Vector3f dir)
Represents the direction the light is shining. (1, 0, 0) would represent light shining in the +X direction.
dir
- the direction of the light.public 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 Light
box
- 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 Light
sphere
- The sphere to check intersection against.vars
- TempVars in case it is needed.public boolean intersectsFrustum(Camera camera, TempVars vars)
Light
directional lights
,
ambient lights
, or point lights
without influence radius, this method should always return true.intersectsFrustum
in class Light
camera
- The camera frustum to check intersection against.vars
- TempVars in case it is needed.public Light.Type getType()
Light
getType
in class Light
Light.Type
public java.lang.String toString()
toString
in class java.lang.Object
public void write(JmeExporter ex) throws java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
public DirectionalLight clone()