Set useLegacyLights only if necessary to remove warning about deprecated api #5389
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #5297 we changed to use renderer.useLegacyLights setter instead of the deprecated renderer.physicallyCorrectLights in three r150, and kept the physicallyCorrectLights property name for the renderer system for backward compatibility. The changelog in aframe 1.5.0 release is wrong about this change, it says the reverse, I fixed it in this PR.
In three r155, the useLegacyLights api was also deprecated, such giving this warning
THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.
The warning is shown when you use the setter useLegacyLights.
Because useLegacyLights is false by default now in threejs, we should only set useLegacyLights to true if renderer="physicallyCorrectLights:false" which is still the default in aframe 1.5.0.
I thought we changed the default to match three decision, but we didn't do it for 1.5.0. useLegacyLights will probably be removed in r165, so aframe 1.6.0 will need to switch the default for sure.
I propose to not set useLegacyLights at all when we use renderer="physicallyCorrectLights:true" to remove this warning, this is what this PR does.