RFR: 8234920: Add SpotLight to the selection of 3D light types [v9]

Nir Lisker nlisker at openjdk.java.net
Sun Mar 21 17:50:49 UTC 2021


On Fri, 19 Mar 2021 21:01:58 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> There is an outstanding API question regarding the direction vector: Should the transforms of the SpotLight node to scene coordinates affect the direction vector (e.g., such that a rotation would rotate the direction the spotlight is pointing)? If so, do we even need the direction vector or could we define the direction as `(0,0,1)` in the local coordinates of the SpotLight, and tell applications to apply the appropriate rotation to define the direction.
> 
> I think for consistency, the answer is "Yes" to the first question (that's how the position works and it would be odd for the transform to affect the position and not the direction). I'm less certain about the answer to the second question. Without utility functions like `lookAt` to help compute the appropriate transform, it seems important to be able to specify the direction as an explicit parameter. And even if we had utility functions, an app might want the control (although you might argue it would be unneeded). My instinct is to keep it as defined. If we go with this, the only change that is needed is a note that the transforms applied to the SpotLight node affect it's direction as well as its position.

I would like to allow a developer to achieve a functionality like is shown in https://www.youtube.com/watch?v=CFgwZX5dkcM at 9:50. The rotations are intuitive there. If we allow both rotation transforms and a direction, wouldn't that cause the direction to be unintuitive? Or do you mean that the direction is always the look-at regardless of rotation transforms and if it's `null` then the rotations take over?

> On Mac I no longer get a GLSL shader error at runtime, but spotlights aren't working correctly, either.

I don't see this on Linux and I don't have a Mac. Can you try on Linux and see what you get? If Linux works, I'm afraid I would not be able to debug the Mac.

-------------

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


More information about the openjfx-dev mailing list