Skip to content
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

Cache AxisAlignedBB for tile entity render frustrum check #771

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Alexdoru
Copy link
Member

@Alexdoru Alexdoru commented Dec 5, 2024

The vanilla code creates a new AxisAlignedBB instance everytime TileEntity#getRenderBoundingBox() is called, this spams allocation a lot during rendering.
I made it cache and return the same bounding box if the coordinates of the tile entity are the same.
This might introduce a bug if the implementation of getRenderBoundingBox is overwritten and depends on other parameters than just the tile entity position.

Needs to be tested with the TE that change the default implementation of TileEntity#getRenderBoundingBox()

Fixes : #689

@Alexdoru Alexdoru marked this pull request as ready for review December 13, 2024 23:59
@Alexdoru Alexdoru requested a review from a team December 13, 2024 23:59
@Alexdoru Alexdoru marked this pull request as draft December 14, 2024 00:23
@Alexdoru
Copy link
Member Author

Alexdoru commented Dec 14, 2024

needs further profiling to determine if the amount of AABB is actually huge or if it was a build up cause during capturing the memory snapshot

This pr might not be needed

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.

Allocation Spam of AxisAlignedBB
1 participant