Skip to content

Reduce object allocations in SpotLightShadowRenderer#2515

Merged
yaRnMcDonuts merged 8 commits into
jMonkeyEngine:masterfrom
capdevon:capdevon-SpotLightShadowRenderer
Feb 4, 2026
Merged

Reduce object allocations in SpotLightShadowRenderer#2515
yaRnMcDonuts merged 8 commits into
jMonkeyEngine:masterfrom
capdevon:capdevon-SpotLightShadowRenderer

Conversation

@capdevon

@capdevon capdevon commented Jun 23, 2025

Copy link
Copy Markdown
Contributor

This PR refactors the SpotLightShadowRenderer class to improve code readability, consistency, and performance. Key changes include:

  • Replaces hardcoded array allocation of Camera[] cameras in methods with a class-level field to avoid redundant allocations.
  • Cleans up and clarifies Javadocs and comments.
  • Minor improvements to method parameter usage (e.g., use of temporary vectors).
  • Removes unnecessary lines and improves code formatting and spacing.

These changes do not modify the core logic or functionality but streamline the implementation and improve maintainability.

@github-actions

Copy link
Copy Markdown

🖼️ 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:

  • Go to the (failed run) > Summary > Artifacts > screenshot-test-report
  • Download the zip and open jme3-screenshot-tests/build/reports/ScreenshotDiffReport.html

⚠️ If you didn't expect to change anything visual:
Fix your changes so the screenshot tests pass.

If you did mean to change things:
Review the replacement images in jme3-screenshot-tests/build/changed-images to make sure they really are improvements and then replace and commit the replacement images at jme3-screenshot-tests/src/test/resources.

If you are creating entirely new tests:
Find the new images in jme3-screenshot-tests/build/changed-images and commit the new images at jme3-screenshot-tests/src/test/resources.

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

@codex128 codex128 added the Refactoring and Cleanup This PR is all about improving code quality and javadoc. label Aug 22, 2025
Comment thread jme3-core/src/main/java/com/jme3/shadow/SpotLightShadowRenderer.java Outdated
@codex128 codex128 closed this Dec 22, 2025
@riccardobl riccardobl added defect Something that is supposed to work, but doesn't. Less severe than a "bug" and removed Refactoring and Cleanup This PR is all about improving code quality and javadoc. labels Jan 13, 2026
@riccardobl riccardobl reopened this Jan 13, 2026
@riccardobl riccardobl self-requested a review January 13, 2026 19:31
@riccardobl riccardobl self-assigned this Jan 13, 2026

@riccardobl riccardobl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the minor issues in this PR are resolved now, should be good to go

@riccardobl riccardobl changed the title Refactor: SpotLightShadowRenderer reduce object allocations Reduce object allocations in SpotLightShadowRenderer Jan 17, 2026
@yaRnMcDonuts yaRnMcDonuts merged commit d3efabc into jMonkeyEngine:master Feb 4, 2026
17 checks passed
@yaRnMcDonuts yaRnMcDonuts added this to the v3.10.0 milestone Feb 4, 2026
@capdevon capdevon deleted the capdevon-SpotLightShadowRenderer branch February 4, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

defect Something that is supposed to work, but doesn't. Less severe than a "bug"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants