Fix terrain not rendering with OF shaders enabled (fixes #122)

This was caused by us setting `needsTerrainUpdate` to false during the shadow
pass in order to break out of the ForceChunkLoading loop (cause OF doesn't
update chunks during the shadow pass). However, this inadvertently caused the
chunk updates to be skipped during the normal pass as well if there didn't
happen to be another reasons for updating.

To fix this, we simply move the shadow pass check into the ForceChunkLoading
mixin and skip the entire loop during the shadow pass.
This commit is contained in:
Jonas Herzig
2020-04-08 17:00:58 +02:00
parent 8f7d263ad9
commit c5476025ec
3 changed files with 9 additions and 74 deletions

View File

@@ -1,6 +1,7 @@
package com.replaymod.render.mixin;
//#if MC>=10800
import com.replaymod.compat.shaders.ShaderReflection;
import com.replaymod.render.hooks.ChunkLoadingRenderGlobal;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.Frustum;
@@ -57,13 +58,16 @@ public abstract class Mixin_ForceChunkLoading {
private boolean passThrough;
@Inject(method = "setupTerrain", at = @At("HEAD"), cancellable = true)
private void forceAllChunks(Camera camera_1, Frustum frustum_1, boolean boolean_1, int int_1, boolean boolean_2, CallbackInfo ci) {
private void forceAllChunks(Camera camera_1, Frustum frustum_1, boolean boolean_1, int int_1, boolean boolean_2, CallbackInfo ci) throws IllegalAccessException {
if (replayModRender_hook == null) {
return;
}
if (passThrough) {
return;
}
if (ShaderReflection.shaders_isShadowPass != null && (boolean) ShaderReflection.shaders_isShadowPass.get(null)) {
return;
}
ci.cancel();
passThrough = true;
@@ -131,7 +135,10 @@ public abstract class Mixin_ForceChunkLoading {
//$$ int frameCount,
//$$ boolean playerSpectator,
//$$ CallbackInfo ci
//$$ ) {
//$$ ) throws IllegalAccessException {
//$$ if (ShaderReflection.shaders_isShadowPass != null && (boolean) ShaderReflection.shaders_isShadowPass.get(null)) {
//$$ return;
//$$ }
//$$ if (replayModRender_hook != null && !replayModRender_passThroughSetupTerrain) {
//$$ replayModRender_passThroughSetupTerrain = true;
//$$