Orient camera for ODS in game instead of in vertex shader

This makes it work more like regular 360 mode and is generally more compatible
because it doesn't require the frustum culling workarounds which the GPU
solution needs.
In particular, this fixes frustum culling with newer sodium versions (which no
longer use the vanilla intersection checking method) and fixes the clouds on
modern Iris (which seems to be using a different shader program for clouds).
This commit is contained in:
Jonas Herzig
2022-03-06 14:30:24 +01:00
parent f2425a693a
commit c010a437fc
6 changed files with 84 additions and 88 deletions

View File

@@ -129,7 +129,7 @@ public class IrisODSFrameCapturer implements FrameCapturer<ODSOpenGlFrame> {
@Override
protected OpenGlFrame renderFrame(int frameId, float partialTicks, CubicOpenGlFrameCapturer.Data captureData) {
direction = captureData.ordinal();
return super.renderFrame(frameId, partialTicks, null);
return super.renderFrame(frameId, partialTicks, captureData);
}
}
}

View File

@@ -160,7 +160,7 @@ public class ODSFrameCapturer implements FrameCapturer<ODSOpenGlFrame> {
@Override
protected OpenGlFrame renderFrame(int frameId, float partialTicks, CubicOpenGlFrameCapturer.Data captureData) {
directionVariable.set(captureData.ordinal());
return super.renderFrame(frameId, partialTicks, null);
return super.renderFrame(frameId, partialTicks, captureData);
}
}
}

View File

@@ -1,37 +0,0 @@
package com.replaymod.render.mixin;
import com.replaymod.core.versions.MCVer;
import com.replaymod.render.hooks.EntityRendererHandler;
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;
//#if MC>=10800
import net.minecraft.client.render.Frustum;
//#else
//$$ import net.minecraft.client.renderer.culling.Frustrum;
//#endif
//#if MC>=10800
@Mixin(Frustum.class)
//#else
//$$ @Mixin(Frustrum.class)
//#endif
public abstract class Mixin_Omnidirectional_DisableFrustumCulling {
//#if MC>=11500
@Inject(method = "isAnyCornerVisible", at = @At("HEAD"), cancellable = true)
//#else
//$$ @Inject(method = "intersects", at = @At("HEAD"), cancellable = true)
//#endif
public void intersects(CallbackInfoReturnable<Boolean> ci) {
EntityRendererHandler handler = ((EntityRendererHandler.IEntityRenderer) MCVer.getMinecraft().gameRenderer).replayModRender_getHandler();
if (handler != null && handler.omnidirectional) {
// Note the following used to be true but for simplicity non-ODS omnidirectional is the same now too.
// 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);
}
}
}