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

Fix blocks overflowing over the top of octree bounds #1768

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

NotStirred
Copy link
Member

Due to an incorrect maxDimension calculation

This happened because we were trying to set a cube of height 16 less than 16 blocks from the edge of the octree. (which was then masked to within bounds and so wrapped)
Thoughts on adding some assertions in packedoctree that the arguments are even valid?

This was due to an incorrect maxDimension calculation
@leMaik
Copy link
Member

leMaik commented Sep 19, 2024

Assertions would be great, but why in PackedOctree? Why not throw some IllegalArgumentExceptions in Octree to fix these bugs fast? Or at least warn and tell the user to report a bug?

@NotStirred
Copy link
Member Author

👍 I'd forgotten that the octree wrapper existed

@leMaik leMaik linked an issue Sep 20, 2024 that may be closed by this pull request
@NotStirred
Copy link
Member Author

NotStirred commented Sep 20, 2024

Bounds on the assertions are off-by-one.
if the octree is 32 size, and we're placing a 16 size cube at 16,0,0 it's checking 16+16 < 32 which is obviously not right
needs to be <=

Will fix tonight

@NotStirred
Copy link
Member Author

NotStirred commented Sep 21, 2024

Thoughts on splitting calculateOctreeOrigin into two methods, one for legacy one for current?

Also this method is pretty horrible, internally modifies this.origin but returns requiredDepth with a boolean flag for legacy path

@leMaik
Copy link
Member

leMaik commented Sep 23, 2024

@NotStirred Splitting calculateOctreeOrigin or refactoring it not to be horrible sounds good, probably something for another PR. 👍

@leMaik leMaik merged commit 41a9797 into chunky-dev:master Sep 23, 2024
1 check passed
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.

Certain scene y-clip ranges cause chunk loading errors
2 participants