From dfd934867f17e1c4b58eee690e069bd344bed94c Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Sun, 28 Jan 2024 15:23:34 -0500 Subject: [PATCH] Clean up camera code a bit --- .../sodium/client/render/SodiumWorldRenderer.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java b/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java index 958236112..03d6e83f1 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java @@ -198,24 +198,24 @@ public void updateChunks(Frustum frustum, float ticks, boolean hasForcedFrustum, } double x = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * ticks; - double y = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * ticks; + double y = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * ticks + (double) viewEntity.getEyeHeight(); double z = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * ticks; - this.chunkRenderManager.setCameraPosition(x, y + (double) viewEntity.getEyeHeight(), z); + this.chunkRenderManager.setCameraPosition(x, y, z); float fogDistance = FogHelper.getFogCutoff(); - boolean dirty = viewEntity.posX != this.lastCameraX || viewEntity.posY != this.lastCameraY || - viewEntity.posZ != this.lastCameraZ || (double) viewEntity.rotationPitch != this.lastCameraPitch | + boolean dirty = x != this.lastCameraX || y != this.lastCameraY || + z != this.lastCameraZ || (double) viewEntity.rotationPitch != this.lastCameraPitch | (double) viewEntity.rotationYaw != this.lastCameraYaw; if (dirty) { this.chunkRenderManager.markDirty(); } - this.lastCameraX = viewEntity.posX; - this.lastCameraY = viewEntity.posY; - this.lastCameraZ = viewEntity.posZ; + this.lastCameraX = x; + this.lastCameraY = y; + this.lastCameraZ = z; this.lastCameraPitch = viewEntity.rotationPitch; this.lastCameraYaw = viewEntity.rotationYaw; this.lastFogDistance = fogDistance;