Top Description Fields Constructors Methods
javafx.scene

public non-sealed Class PointLight

extends LightBase
Class Inheritance
Known Direct Subclasses
javafx.scene.SpotLight
Imports
com.sun.javafx.scene.DirtyBits, .PointLightHelper, com.sun.javafx.sg.prism.NGNode, .NGPointLight, javafx.beans.property.DoubleProperty, javafx.scene.paint.Color, .PhongMaterial

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
PhongMaterial

Field Summary

Modifier and TypeField and Description
private DoubleProperty
constantAttenuation

The constant attenuation coefficient.

private static final double
private static final double
private static final double
private static final double
private DoubleProperty
linearAttenuation

The linear attenuation coefficient.

private DoubleProperty
maxRange

The maximum range of this PointLight.

private DoubleProperty
quadraticAttenuation

The quadratic attenuation coefficient.

Constructor Summary

AccessConstructor and Description
public
PointLight()

Creates a new instance of PointLight class with a default Color.WHITE light source.

public
PointLight(Color
the color of the light source
color
)

Creates a new instance of PointLight class using the specified color.

Method Summary

Modifier and TypeMethod and Description
public final DoubleProperty
private NGNode
private void
public final double
public final double
public final double
public final double
public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
public final void
setConstantAttenuation(double value)

public final void
setLinearAttenuation(double value)

public final void
setMaxRange(double value)

public final void
Inherited from javafx.scene.LightBase:
colorPropertygetColorgetExclusionScopegetLightDoublePropertygetScopeisLightOnlightOnPropertyscenesChangedsetColorsetLightOn

Field Detail

constantAttenuationback to summary
private DoubleProperty constantAttenuation

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
DEFAULT_CONSTANT_ATTENUATIONback to summary
private static final double DEFAULT_CONSTANT_ATTENUATION
DEFAULT_LINEAR_ATTENUATIONback to summary
private static final double DEFAULT_LINEAR_ATTENUATION
DEFAULT_MAX_RANGEback to summary
private static final double DEFAULT_MAX_RANGE
DEFAULT_QUADRATIC_ATTENUATIONback to summary
private static final double DEFAULT_QUADRATIC_ATTENUATION
linearAttenuationback to summary
private DoubleProperty linearAttenuation

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
maxRangeback to summary
private DoubleProperty maxRange

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
quadraticAttenuationback to summary
private DoubleProperty quadraticAttenuation

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

Constructor Detail

PointLightback to summary
public PointLight()

Creates a new instance of PointLight class with a default Color.WHITE light source.

PointLightback to summary
public PointLight(Color color)

Creates a new instance of PointLight class using the specified color.

Parameters
color:Color

the color of the light source

Method Detail

constantAttenuationPropertyback to summary
public final DoubleProperty constantAttenuationProperty()
doCreatePeerback to summary
private NGNode doCreatePeer()
doUpdatePeerback to summary
private void doUpdatePeer()

Hides javafx.scene.LightBase.doUpdatePeer.

getConstantAttenuationback to summary
public final double getConstantAttenuation()
getLinearAttenuationback to summary
public final double getLinearAttenuation()
getMaxRangeback to summary
public final double getMaxRange()
getQuadraticAttenuationback to summary
public final double getQuadraticAttenuation()
linearAttenuationPropertyback to summary
public final DoubleProperty linearAttenuationProperty()
maxRangePropertyback to summary
public final DoubleProperty maxRangeProperty()
quadraticAttenuationPropertyback to summary
public final DoubleProperty quadraticAttenuationProperty()
setConstantAttenuationback to summary
public final void setConstantAttenuation(double value)
setLinearAttenuationback to summary
public final void setLinearAttenuation(double value)
setMaxRangeback to summary
public final void setMaxRange(double value)
setQuadraticAttenuationback to summary
public final void setQuadraticAttenuation(double value)