Fix camera position off-by-one with immersive portals
This commit is contained in:
+2
-4
@@ -450,8 +450,6 @@ public class GlGenericObjectRenderer implements IDhGenericRenderer
|
||||
|
||||
this.boxIndexBuffer.bind();
|
||||
|
||||
DhVec3d camPos = MC_RENDER.getCameraExactPosition();
|
||||
|
||||
|
||||
|
||||
// rendering //
|
||||
@@ -512,11 +510,11 @@ public class GlGenericObjectRenderer implements IDhGenericRenderer
|
||||
{
|
||||
if (this.instancedRenderingAvailable)
|
||||
{
|
||||
this.renderBoxGroupInstanced(shaderProgram, renderEventParam, boxGroup, camPos, profiler);
|
||||
this.renderBoxGroupInstanced(shaderProgram, renderEventParam, boxGroup, renderEventParam.exactCameraPosition, profiler);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderBoxGroupDirect(shaderProgram, renderEventParam, boxGroup, camPos, profiler);
|
||||
this.renderBoxGroupDirect(shaderProgram, renderEventParam, boxGroup, renderEventParam.exactCameraPosition, profiler);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -208,7 +208,7 @@ public class GlDhFogShader extends GlAbstractShaderRenderer
|
||||
this.shader.setUniform(this.uHeightFogAppliesDown, heightFogDirection.fogAppliesDown);
|
||||
this.shader.setUniform(this.uUseSphericalFog, useSphericalFog);
|
||||
this.shader.setUniform(this.uHeightFogMixingMode, heightFogMixingMode.value);
|
||||
this.shader.setUniform(this.uCameraBlockYPos, (float)MC_RENDER.getCameraExactPosition().y);
|
||||
this.shader.setUniform(this.uCameraBlockYPos, (float)renderParams.exactCameraPosition.y);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+14
-2
@@ -22,6 +22,7 @@ package com.seibel.distanthorizons.common.wrappers.minecraft;
|
||||
import java.awt.Color;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
@@ -216,10 +217,21 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public DhVec3d getCameraExactPosition()
|
||||
{
|
||||
if (DelayedAccessors.IMMERSIVE_PORTALS != null)
|
||||
// When immersive portals is enabled getting the camera position
|
||||
// outside the render thread means you may get the camera for any one of the dimensions
|
||||
// immersive portals is currently rendering, which isn't what DH wants.
|
||||
// We want the camera that the player is currently looking through.
|
||||
if (DelayedAccessors.IMMERSIVE_PORTALS != null
|
||||
&& !RenderThreadTaskHandler.INSTANCE.isCurrentThread())
|
||||
{
|
||||
// this camera position will likely be delayed by 1 frame, so it shouldn't
|
||||
// be used for rendering,
|
||||
// but anything else that doesn't require that level of percision is fine.
|
||||
DhVec3d cameraPos = DelayedAccessors.IMMERSIVE_PORTALS.getActualCameraPos();
|
||||
if (cameraPos != null) return cameraPos;
|
||||
if (cameraPos != null)
|
||||
{
|
||||
return cameraPos;
|
||||
}
|
||||
}
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
|
||||
+1
-1
Submodule coreSubProjects updated: 44aed79e78...c28cf643b3
Reference in New Issue
Block a user