diff --git a/src/main/java/com/replaymod/render/mixin/MixinFrustum.java b/src/main/java/com/replaymod/render/mixin/MixinFrustum.java new file mode 100644 index 00000000..ed22976e --- /dev/null +++ b/src/main/java/com/replaymod/render/mixin/MixinFrustum.java @@ -0,0 +1,23 @@ +package com.replaymod.render.mixin; + +import com.replaymod.render.hooks.EntityRendererHandler; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.culling.Frustum; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Frustum.class) +public abstract class MixinFrustum { + @Inject(method = "isBoxInFrustum", at = @At("HEAD"), cancellable = true) + public void isBoxInFrustum(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, CallbackInfoReturnable ci) { + EntityRendererHandler handler = ((EntityRendererHandler.IEntityRenderer) Minecraft.getMinecraft().entityRenderer).replayModRender_getHandler(); + if (handler != null && handler.omnidirectional && handler.data == null) { + // Normally the camera is always facing the direction of the omnidirectional image face that is currently + // getting rendered. With ODS however, the camera is always facing forwards and the turning happens in the + // vertex shader (non-trivial due to stereo). As such, all chunks need to be rendered all the time for ODS. + ci.setReturnValue(true); + } + } +} diff --git a/src/main/resources/mixins.render.replaymod.json b/src/main/resources/mixins.render.replaymod.json index de808884..a2e940c8 100644 --- a/src/main/resources/mixins.render.replaymod.json +++ b/src/main/resources/mixins.render.replaymod.json @@ -4,6 +4,7 @@ "mixins": [ "MixinEffectRenderer", "MixinEntityRenderer", + "MixinFrustum", "MixinRender", "MixinRendererLivingEntity", "MixinRenderGlobal",