[Rev 01] RFR: 8217472: Add attenuation for PointLight

Kevin Rushforth kcr at openjdk.java.net
Fri Jan 3 22:23:46 UTC 2020

On Fri, 3 Jan 2020 19:36:35 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGPointLight.java line 64:
>>> 63: 
>>> 64:     private double ca = DEFAULT_CA;
>>> 65: 
>> The coefficients are not directly used in any arithmetic on java side. They are converted to `float` and passed to GL or D3D pipeline. Should these be `float `instead of `double` ?
> I was wondering about it myself, but all the other values are `double`s that are cast to `float`s. Wouldn't it also be odd to have the API properties `DoubleProperty` and the peer to use `float`s? Isn't it just a matter of where the cast happens?

Yes, it's just a matter of where the cast happens. While we aren't entirely consistent, I think you'll find more places where the peers hold floats rather than double (one notable exception is transforms where we need the extra precision). In particular, Color and position values for shapes are stored in the peer as floats. Also, PhongMaterial stores the power as a float even though the API is double.


PR: https://git.openjdk.java.net/jfx/pull/43

More information about the openjfx-dev mailing list