-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor: SpotLightShadowRenderer reduce object allocations #2515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Refactor: SpotLightShadowRenderer reduce object allocations #2515
Conversation
🖼️ Screenshot tests have failed. The purpose of these tests is to ensure that changes introduced in this PR don't break visual features. They are visual unit tests. 📄 Where to find the report:
✅ If you did mean to change things: ✨ If you are creating entirely new tests: Note; it is very important that the committed reference images are created on the build pipeline, locally created images are not reliable. Similarly tests will fail locally but you can look at the report to check they are "visually similar". See https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-screenshot-tests/README.md for more information |
protected void getReceivers(GeometryList lightReceivers) { | ||
lightReceivers.clear(); | ||
Camera[] cameras = new Camera[1]; | ||
cameras[0] = shadowCam; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest keeping cameras[0] = shadowCam
in, rather than only assigning during initialization. It makes this section much clearer.
protected Vector3f[] points = new Vector3f[8]; | ||
//Holding the info for fading shadows in the far distance | ||
|
||
protected final Camera[] cameras = new Camera[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps rename to tempCams
since it is used as temporary storage of shadowCam.
This PR refactors the
SpotLightShadowRenderer
class to improve code readability, consistency, and performance. Key changes include:Camera[] cameras
in methods with a class-level field to avoid redundant allocations.These changes do not modify the core logic or functionality but streamline the implementation and improve maintainability.