Skip to content

1.12.2 Frustum Optimization Forward-Port - #85

Merged
NotStirred merged 9 commits into
OpenCubicChunks:devfrom
Zonix-Official:optimized-frustrum
Nov 23, 2026
Merged

NotStirred merged 9 commits into
OpenCubicChunks:devfrom
Zonix-Official:optimized-frustrum

Conversation

@Zonix-Official

Copy link
Copy Markdown
Contributor

For my first contribution to CC3; with permission of DaPorkchop, I have ported their 1.12.2 Frustrum Optimization PR (OpenCubicChunks/CubicChunks#782) into CC3 on 1.21.6

I tackled this as this felt like a decent first thing for me to ease myself into such a large project like this, hoping over the coming days/weeks I can contribute much more significant developments.

@DaMatrix

DaMatrix commented Sep 3, 2026

Copy link
Copy Markdown
Member

huh this code looks familiar

@DaMatrix DaMatrix 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.

why not leave the original comments? or write better ones if you don't like them (i admit that mine may be somewhat inscrutable to anyone other than me), but this code is somewhat incomprehensible by itself

@Zonix-Official

Copy link
Copy Markdown
Contributor Author

I left out the comments when writing the code, admittedly I didn't do a direct copy + paste and went about it by referencing piece by piece; starting with cleanup of the vanilla loop, then getting the rest of the logic converted correctly adding my comments as a final step before the PR

Zonix-Official and others added 8 commits September 4, 2026 00:20
…a movement

In CC2 section and cube sizes differ, moving to a different section in the same cube caused no update.

Use the section position passed to repositionCamera instead. This comes from the camera rather than the camera entity, which can differ (e.g. in third person), and repositioning is no longer skipped when there is no camera entity.
The ported calculation mixed cube and section coordinates and once those were both in sections (ec6b610), always resolved to the same index regardless of the camera position, so the wrong slab was updated.
px/py/pz are the lowest visible section on each axis, so name them minX/minY/minZ and compute them from cameraX/Y/Z like the rest of the method.

originX/Y/Z are section coordinates passed to setSectionNode rather than block origins, so name them sectionX/Y/Z.

Use idxZ/idxYZ consistently for the flattened array offsets.

No functional change.

@NotStirred NotStirred 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.

Fixed incorrectly mixing cube & section coords (ec6b610), and updating a constant slab because minX == px as px was redefined from 1.12 (0428a8f).

Plus some dedup/variable renames

@NotStirred
NotStirred merged commit 1143442 into OpenCubicChunks:dev Nov 23, 2026
3 checks 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.

3 participants