Package javafx.scene

Class DirectionalLight

All Implemented Interfaces:
Styleable, EventTarget

public class DirectionalLight extends LightBase
A light that illuminates an object from a specific direction. The direction is defined by the direction vector property of the light. The direction can be rotated by setting a rotation transform on the DirectionalLight. For example, if the direction vector is (1, 1, 1) and the light is not rotated, it will point in the (1, 1, 1) direction, and if the light is rotated 90 degrees on the y axis, it will point in the (1, 1, -1) direction.

DirectionalLights can represent strong light sources that are far enough from the objects they illuminate that their light rays appear to be parallel. Because these light sources are considered to be infinitely far, they cannot be attenuated. A decrease in intensity can be achieved by using a darker color. The sun is a common light source that can be simulated with this light type.

Since:
18
See Also:
  • Property Details

    • direction

      public final ObjectProperty<Point3D> directionProperty
      The direction vector of the directional light. It can be rotated by setting a rotation transform on the DirectionalLight. The vector need not be normalized.
      Default value:
      Point3D(0, 0, 1)
      See Also:
  • Constructor Details

    • DirectionalLight

      public DirectionalLight()
      Creates a new DirectionalLight with a default Color.WHITE color.
    • DirectionalLight

      public DirectionalLight(Color color)
      Creates a new DirectionalLight with the specified color.
      Parameters:
      color - the color of the light source
  • Method Details

    • setDirection

      public final void setDirection(Point3D value)
      Sets the value of the property direction.
      Property description:
      The direction vector of the directional light. It can be rotated by setting a rotation transform on the DirectionalLight. The vector need not be normalized.
      Default value:
      Point3D(0, 0, 1)
    • getDirection

      public final Point3D getDirection()
      Gets the value of the property direction.
      Property description:
      The direction vector of the directional light. It can be rotated by setting a rotation transform on the DirectionalLight. The vector need not be normalized.
      Default value:
      Point3D(0, 0, 1)
    • directionProperty

      public final ObjectProperty<Point3D> directionProperty()
      The direction vector of the directional light. It can be rotated by setting a rotation transform on the DirectionalLight. The vector need not be normalized.
      Default value:
      Point3D(0, 0, 1)
      See Also: