raster fixes + cheap opts #40

Merged
embeddedt merged 4 commits from rdh/celeritas:raster-3 into stonecutter 2026-09-05 16:55:36 -04:00
4 changed files with 18 additions and 4 deletions
Showing only changes of commit feeb0393f9 - Show all commits

No files matched your search

@@ -202,7 +202,7 @@ public final class RasterOccluder extends BoxOccluder {
return SectionVisibility.VISIBLE;
}
// tests are dilated by a pixel inside the rasterizer, so no world-space fuzz is needed
// no world-space fuzz: RenderableBounds already carries the model extent
if (isBoxVisible(bounds, 0)) {
return SectionVisibility.VISIBLE;
}
@@ -24,7 +24,10 @@ final class RenderableBounds {
return PackedBox.FULL_BOX;
}
return PackedBox.pack(this.minX, this.minY, this.minZ,
this.maxX + 1, this.maxY + 1, this.maxZ + 1, PackedBox.RANGE_EXTREME);
return PackedBox.pack(
Math.max(0, this.minX - 1), Math.max(0, this.minY - 1), Math.max(0, this.minZ - 1),
Math.min(16, this.maxX + 2), Math.min(16, this.maxY + 2), Math.min(16, this.maxZ + 2),
PackedBox.RANGE_EXTREME
);
}
}
@@ -71,6 +71,11 @@ public class SectionVisibilityBuilder {
this.renderableBounds.mark(x & 15, y & 15, z & 15);
}
public void markSectionRenderable() {
this.renderableBounds.mark(0, 0, 0);
this.renderableBounds.mark(SECTION_AXIS_MASK, SECTION_AXIS_MASK, SECTION_AXIS_MASK);
}
public int @Nullable [] computeOccluderBoxes() {
return dataFrom(this.blocks, this.renderableBounds);
}
@@ -233,7 +233,13 @@ public class ChunkBuilderMeshingTask extends ChunkBuilderTask<ChunkBuildOutput>
}
}
MeshAppenderRenderer.renderMeshAppenders(renderContext.getMeshAppenders(), context.localSlice(), renderContext.getOrigin(), buffers);
var meshAppenders = renderContext.getMeshAppenders();
if (this.rasterOcclusion && !meshAppenders.isEmpty()) {
occluder.markSectionRenderable();
}
MeshAppenderRenderer.renderMeshAppenders(meshAppenders, context.localSlice(), renderContext.getOrigin(), buffers);
} catch (ReportedException ex) {
// Propagate existing crashes (add context)
throw fillCrashInfo(ex.getReport(), slice, blockPos);