From dc8c0b04c038a67110f087ace42e136e4b30f0dd Mon Sep 17 00:00:00 2001 From: JuiceyDev Date: Sat, 28 Mar 2026 11:25:58 +0100 Subject: [PATCH] apply setchuckoffset to direct shader matrix --- Minecraft.Client/Rendering/LevelRenderer.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index ad1c0642e..7990e1737 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -856,24 +856,22 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) { if ((globalChunkFlags[pClipChunk->globalIdx] & emptyFlag) == emptyFlag) continue; // Check that this particular layer isn't empty - glPushMatrix(); - - // 4jcraft: added this. On OpenGL 2.1 this breaks, but the 3.3 renderer - // requires it. - // FIXME: find a way to get rid of this. - glTranslatef((float)pClipChunk->chunk->x, (float)pClipChunk->chunk->y, - (float)pClipChunk->chunk->z); // List can be calculated directly from the chunk's global idex int list = pClipChunk->globalIdx * 2 + layer; list += chunkLists; + // 4jcraft: replaced glPushMatrix/glTranslatef/glPopMatrix per chunk + // no more full MVP upload per chunk, can also be bkwards compat + RenderManager.SetChunkOffset((float)pClipChunk->chunk->x, + (float)pClipChunk->chunk->y, + (float)pClipChunk->chunk->z); + if (RenderManager.CBuffCall(list, first)) { first = false; } - - glPopMatrix(); count++; } + RenderManager.SetChunkOffset(0.f, 0.f, 0.f); #ifdef __PSVITA__ // AP - alpha cut out is expensive on vita. Now we render all the alpha cut