Skip to content

Refactor: optimize ShadowUtility and reduce object allocations #2481

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants