Let a terrain draw use its own model space as the pack's block grid

Packs pick parts of some blocks by where a pixel sits inside its world block (cauldron water, end portal
frame eyes, brewing stands), which goes wrong for geometry drawn turned or off the grid. While a local grid
is on, the camera and matrix uniforms describe a world where the draw's model space is the block grid. View
space, clip space and the shadow map come out the same. Not on the SDL GPU backend.

The remapping is one table in LocalGridFrame, applied where the custom uniform inputs are built, so the Iris
uniform classes stay as they are. Custom uniforms the pack builds from remapped ones get evaluated again too,
and smooth() smooths from the frame's starting value when it's called twice in one frame so it doesn't step
twice.

beginLocalGrid hands back a LocalGrid to close, and warns once if the modelview was left changed. Also adds the
at_midBlock location to TerrainRendering for packs that don't need the grid.
This commit is contained in:
Connor Colenso committed 2026-11-16 16:21:20 +00:00
1 parent 6dda240a34
commit e59e4662f2
8 files changed
+438 -5

No files matched your search

@@ -967,6 +967,15 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
return current;
}
/** Evaluates these built-in uniforms again and pushes them to the bound pass, see LocalGridFrame. */
public void refreshUniforms(String[] names) {
customUniforms.refreshInputs(names);
if (current != null && current.liveProgram != null
&& GLSMPrograms.getActiveProgram() == current.liveProgram.getProgramId()) {
current.pushCustomUniforms();
}
}
public int getActivePassProgramId() {
if (current == null) return -1;
final Program p = current.boundProgram();
@@ -1497,6 +1506,10 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
}
}
void pushCustomUniforms() {
DeferredWorldRenderingPipeline.this.customUniforms.push(liveProgram == program ? this : liveProgram);
}
private void bindSelected() {
final Program selected = select(activeInstancing, GLSMRasterizer.clipEmulationActive());
liveProgram = selected;