diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java | 2 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODRenderer.java | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java b/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java index dcfcbac..12f1eea 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java +++ b/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java @@ -32,7 +32,7 @@ abstract class MixinEntityRenderer { private void afterSortAndRender(float alpha, long something, CallbackInfo ci) { if(LODMod.isActive()) { Minecraft.getMinecraft().entityRenderer.enableLightmap((double)alpha); - LODMod.renderer.beforeRenderTerrain(); + LODMod.renderer.beforeRenderTerrain(alpha); Minecraft.getMinecraft().entityRenderer.disableLightmap((double)alpha); } } diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java index dd41fdd..ca95be4 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java +++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java @@ -86,7 +86,7 @@ public class LODRenderer { hasInited = init(); } - public void beforeRenderTerrain() { + public void beforeRenderTerrain(float alpha) { if(hasInited) { mainLoop(); handleKeyboard(); @@ -99,7 +99,7 @@ public class LODRenderer { if(renderLOD) { sort(); initIndexBuffers(); - render(); + render(alpha); } } } @@ -242,7 +242,7 @@ public class LODRenderer { glBindVertexArray(0); } - private void render() { + private void render(float alpha) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_TEXTURE_2D); @@ -301,7 +301,12 @@ public class LODRenderer { float originY = 0; float originZ = 0; - glUniform3f(u_playerPos, (float)EntityFX.interpPosX - originX, (float)EntityFX.interpPosY - originY, (float)EntityFX.interpPosZ - originZ); + Entity rve = Minecraft.getMinecraft().renderViewEntity; + double interpX = rve.lastTickPosX + (rve.posX - rve.lastTickPosX) * (double)alpha; + double interpY = rve.lastTickPosY + (rve.posY - rve.lastTickPosY) * (double)alpha + rve.getEyeHeight(); + double interpZ = rve.lastTickPosZ + (rve.posZ - rve.lastTickPosZ) * (double)alpha; + + glUniform3f(u_playerPos, (float)interpX - originX, (float)interpY - originY, (float)interpZ - originZ); glUniform1i(u_light, 1); } |