Package javafx.scene

Class PointLight

All Implemented Interfaces:
Styleable, EventTarget
Direct Known Subclasses:
SpotLight

public class PointLight extends LightBase
A light source that radiates light equally in all directions away from itself. The location of the light source is a single point in space. It is attenuated with the constantAttenuation, linearAttenuation, quadraticAttenuation, and maxRange properties.

PointLights can represent point-like light sources with little to no directionality. Light bulbs and candles are common light sources that can be simulated with this light type.

Since:
JavaFX 8.0
See Also:
  • Property Details

    • maxRange

      public final DoubleProperty maxRangeProperty
      The maximum range of this PointLight. For a pixel to be affected by this light, its distance to the light source must be less than or equal to the light's maximum range. Any negative value will be treated as 0.

      Lower maxRange values can give better performance as pixels outside the range of the light will not require complex calculation. The attenuation formula can be used to calculate a realistic maxRange value by finding the distance where the attenuation is close enough to 0.

      Nodes that are inside the light's range can still be excluded from the light's effect by removing them from its scope (or including them in its exclusion scope). If a node is known to always be outside of the light's range, it is more performant to exclude it from its scope.

      Default value:
      Double.POSITIVE_INFINITY
      Since:
      16
      See Also:
    • constantAttenuation

      public final DoubleProperty constantAttenuationProperty
      The constant attenuation coefficient. This is the term ca in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      1
      Since:
      16
      See Also:
    • linearAttenuation

      public final DoubleProperty linearAttenuationProperty
      The linear attenuation coefficient. This is the term la in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      0
      Since:
      16
      See Also:
    • quadraticAttenuation

      public final DoubleProperty quadraticAttenuationProperty
      The quadratic attenuation coefficient. This is the term qa in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      0
      Since:
      16
      See Also:
  • Constructor Details

    • PointLight

      public PointLight()
      Creates a new instance of PointLight class with a default Color.WHITE light source.
    • PointLight

      public PointLight(Color color)
      Creates a new instance of PointLight class using the specified color.
      Parameters:
      color - the color of the light source
  • Method Details

    • setMaxRange

      public final void setMaxRange(double value)
      Sets the value of the maxRange property.
      Property description:
      The maximum range of this PointLight. For a pixel to be affected by this light, its distance to the light source must be less than or equal to the light's maximum range. Any negative value will be treated as 0.

      Lower maxRange values can give better performance as pixels outside the range of the light will not require complex calculation. The attenuation formula can be used to calculate a realistic maxRange value by finding the distance where the attenuation is close enough to 0.

      Nodes that are inside the light's range can still be excluded from the light's effect by removing them from its scope (or including them in its exclusion scope). If a node is known to always be outside of the light's range, it is more performant to exclude it from its scope.

      Default value:
      Double.POSITIVE_INFINITY
      Parameters:
      value - the value for the maxRange property
      Since:
      16
      See Also:
    • getMaxRange

      public final double getMaxRange()
      Gets the value of the maxRange property.
      Property description:
      The maximum range of this PointLight. For a pixel to be affected by this light, its distance to the light source must be less than or equal to the light's maximum range. Any negative value will be treated as 0.

      Lower maxRange values can give better performance as pixels outside the range of the light will not require complex calculation. The attenuation formula can be used to calculate a realistic maxRange value by finding the distance where the attenuation is close enough to 0.

      Nodes that are inside the light's range can still be excluded from the light's effect by removing them from its scope (or including them in its exclusion scope). If a node is known to always be outside of the light's range, it is more performant to exclude it from its scope.

      Default value:
      Double.POSITIVE_INFINITY
      Returns:
      the value of the maxRange property
      Since:
      16
      See Also:
    • maxRangeProperty

      public final DoubleProperty maxRangeProperty()
      The maximum range of this PointLight. For a pixel to be affected by this light, its distance to the light source must be less than or equal to the light's maximum range. Any negative value will be treated as 0.

      Lower maxRange values can give better performance as pixels outside the range of the light will not require complex calculation. The attenuation formula can be used to calculate a realistic maxRange value by finding the distance where the attenuation is close enough to 0.

      Nodes that are inside the light's range can still be excluded from the light's effect by removing them from its scope (or including them in its exclusion scope). If a node is known to always be outside of the light's range, it is more performant to exclude it from its scope.

      Default value:
      Double.POSITIVE_INFINITY
      Returns:
      the maxRange property
      Since:
      16
      See Also:
    • setConstantAttenuation

      public final void setConstantAttenuation(double value)
      Sets the value of the constantAttenuation property.
      Property description:
      The constant attenuation coefficient. This is the term ca in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      1
      Parameters:
      value - the value for the constantAttenuation property
      Since:
      16
      See Also:
    • getConstantAttenuation

      public final double getConstantAttenuation()
      Gets the value of the constantAttenuation property.
      Property description:
      The constant attenuation coefficient. This is the term ca in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      1
      Returns:
      the value of the constantAttenuation property
      Since:
      16
      See Also:
    • constantAttenuationProperty

      public final DoubleProperty constantAttenuationProperty()
      The constant attenuation coefficient. This is the term ca in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      1
      Returns:
      the constantAttenuation property
      Since:
      16
      See Also:
    • setLinearAttenuation

      public final void setLinearAttenuation(double value)
      Sets the value of the linearAttenuation property.
      Property description:
      The linear attenuation coefficient. This is the term la in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      0
      Parameters:
      value - the value for the linearAttenuation property
      Since:
      16
      See Also:
    • getLinearAttenuation

      public final double getLinearAttenuation()
      Gets the value of the linearAttenuation property.
      Property description:
      The linear attenuation coefficient. This is the term la in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      0
      Returns:
      the value of the linearAttenuation property
      Since:
      16
      See Also:
    • linearAttenuationProperty

      public final DoubleProperty linearAttenuationProperty()
      The linear attenuation coefficient. This is the term la in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      0
      Returns:
      the linearAttenuation property
      Since:
      16
      See Also:
    • setQuadraticAttenuation

      public final void setQuadraticAttenuation(double value)
      Sets the value of the quadraticAttenuation property.
      Property description:
      The quadratic attenuation coefficient. This is the term qa in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      0
      Parameters:
      value - the value for the quadraticAttenuation property
      Since:
      16
      See Also:
    • getQuadraticAttenuation

      public final double getQuadraticAttenuation()
      Gets the value of the quadraticAttenuation property.
      Property description:
      The quadratic attenuation coefficient. This is the term qa in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      0
      Returns:
      the value of the quadraticAttenuation property
      Since:
      16
      See Also:
    • quadraticAttenuationProperty

      public final DoubleProperty quadraticAttenuationProperty()
      The quadratic attenuation coefficient. This is the term qa in the attenuation formula:

      attn = 1 / (ca + la * dist + qa * dist^2)

      where dist is the distance between the light source and the pixel.

      Default value:
      0
      Returns:
      the quadraticAttenuation property
      Since:
      16
      See Also: