Skip to content

Conversation

@capdevon
Copy link
Contributor

@capdevon capdevon commented Jun 7, 2025

Refactor: Optimize Shadow Utility & Enhance Javadoc

This PR introduces significant improvements to the ShadowUtil class, focusing on performance optimization, code refinement, and comprehensive Javadoc documentation.

Key changes include:

  • Reduced Object Allocations: Minimized the creation of new Vector3f and other temporary objects, especially within performance-critical loops in methods like updateFrustumPoints and computeBoundForPoints, by leveraging TempVars. This aims to reduce garbage collection overhead and improve runtime performance.
  • Refined OccludersExtractor: The OccludersExtractor inner class has been enhanced for better clarity and self-containment. Its constructor now explicitly handles all necessary state, making it more robust and easier to use.
  • Comprehensive Javadoc: Added detailed Javadoc comments to all public methods, private helper methods, and the OccludersExtractor class. This improves code readability and maintainability for future development.
  • Minor Code Clean-up: Removed commented-out code and applied minor formatting adjustments for better consistency.

These changes collectively make the ShadowUtil class more efficient, maintainable, and easier to understand for anyone working with shadow mapping in the engine, directly benefiting the performance of LightShadowRenderer and LightShadowFilter

@capdevon capdevon changed the title Refactor: Optimize Shadow Utility Refactor: Optimize Shadow Utility and reduce object allocations Jun 7, 2025
@yaRnMcDonuts yaRnMcDonuts added this to the v3.9.0 milestone Jun 8, 2025
@capdevon capdevon changed the title Refactor: Optimize Shadow Utility and reduce object allocations Refactor: optimize ShadowUtility and reduce object allocations Jun 13, 2025
@codex128 codex128 added the Refactoring and Cleanup This PR is all about improving code quality and javadoc. label Dec 22, 2025
@codex128
Copy link
Contributor

Too much review required for too little gain.

@codex128 codex128 closed this Dec 22, 2025
@riccardobl riccardobl reopened this Jan 13, 2026
@github-actions
Copy link

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

Contact @richardTingle (aka richtea) for guidance if required

@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 self-assigned this Jan 13, 2026
@riccardobl
Copy link
Member

I took some time to review this carefully. It actually removes quite a lot of unnecessary allocations, so it's a pretty solid PR. However, it also included a fair amount of refactoring, so I reverted those changes to make the review easier and to avoid potential conflicts with other pending PRs.

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