Summary
Add a DirectionalLight to the JavaFX 3D API.
Problem
JavaFX contains only an AmbientLight, a PointLight and a SpotLight. A DirectionalLight is a common light that isn't provided by JavaFX currently.
Solution
Add a DirectionalLight implementation.
Specification
/**
* A light that illuminates an object from a specific direction.
* The direction is defined by the {@link #directionProperty() direction} vector property of the light. The direction
* can be rotated by setting a rotation transform on the {@code DirectionalLight}. For example, if the direction vector is
* {@code (1, 1, 1)} and the light is not rotated, it will point in the {@code (1, 1, 1)} direction, and if the light is
* rotated 90 degrees on the y axis, it will point in the {@code (1, 1, -1)} direction.
* <p>
* {@code DirectionalLight}s 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 PhongMaterial
*/
public class DirectionalLight extends LightBase {
/**
* Creates a new {@code DirectionalLight} with a default {@code Color.WHITE} color.
*/
public DirectionalLight()
/**
* Creates a new {@code DirectionalLight} with the specified color.
*
* @param color the color of the light source
*/
public DirectionalLight(Color color)
/**
* The direction vector of the directional light. It can be rotated by setting a rotation transform on the
* {@code DirectionalLight}. The vector need not be normalized.
*
* @defaultValue {@code Point3D(0, 0, 1)}
*/
public final ObjectProperty<Point3D> directionProperty()
public final void setDirection(Point3D value)
public final Point3D getDirection()
}
- csr of
-
JDK-8234921 Add DirectionalLight to the selection of 3D light types
-
- Resolved
-