Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8269514

Add DirectionalLight to the selection of 3D light types

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Draft
    • Priority: P3
    • Resolution: Unresolved
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      source
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      All new public API is in a new class, so there should be virtually no compatibility risk.
    • Interface Kind:
      Java API
    • Scope:
      JDK

      Description

      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 SpotLight}. 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 17
       * @see PhongMaterial
       */
      public class DirectionalLight extends LightBase {
      
          /**
           * Creates a new {@code DirectionalLight} with a default {@code Color.WHITE} color.
           */
          public DirectionalLight() {
              super();
          }
      
          /**
           * Creates a new {@code DirectionalLight} with the specified color.
           *
           * @param color the color of the light source
           */
          public DirectionalLight(Color color) {
              super(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()
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              nlisker Nir Lisker
              Reporter:
              nlisker Nir Lisker
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated: