From 0ff67382eefd09f7b915586ebcf2c29218007903 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Wed, 5 Jan 2022 22:03:37 -0800 Subject: [PATCH] Fix visual artifacts with contraptions while using opfine. - Fix darkening of tile entities while using shaders I think the buffers from the shadow pass were bleeding into the color pass. --- gradle.properties | 2 +- .../render/ContraptionRenderInfo.java | 2 +- .../structureMovement/render/FlwContraption.java | 2 +- .../render/SBBContraptionManager.java | 15 +++++++++------ .../create/foundation/render/SuperByteBuffer.java | 3 ++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index bbc2bd277..46a3cbd9d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ parchment_version = 2021.12.19 # dependency versions registrate_version = MC1.18-1.0.21 -flywheel_version = 1.18-0.5.1.39 +flywheel_version = 1.18-0.5.1.40 jei_minecraft_version = 1.18 jei_version = 9.0.0.40 diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderInfo.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderInfo.java index edbd00dd3..c9e18059f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderInfo.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderInfo.java @@ -34,7 +34,7 @@ public class ContraptionRenderInfo { AbstractContraptionEntity entity = contraption.entity; - visible = event.getClippingHelper().isVisible(entity.getBoundingBoxForCulling().inflate(2)); + visible = event.getFrustum().isVisible(entity.getBoundingBoxForCulling().inflate(2)); } public boolean isVisible() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java index cf2a561a7..42518e8f2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java @@ -92,7 +92,7 @@ public class FlwContraption extends ContraptionRenderInfo { if (!isVisible()) return; - instanceWorld.tileInstanceManager.beginFrame(SerialTaskEngine.INSTANCE, event.getInfo()); + instanceWorld.tileInstanceManager.beginFrame(SerialTaskEngine.INSTANCE, event.getCamera()); Vec3 cameraPos = event.getCameraPos(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/SBBContraptionManager.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/SBBContraptionManager.java index 971ef777d..ce34578b3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/SBBContraptionManager.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/SBBContraptionManager.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.re import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.event.RenderLayerEvent; +import com.mojang.blaze3d.vertex.VertexConsumer; import com.simibubi.create.CreateClient; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.foundation.render.SuperByteBuffer; @@ -21,7 +22,12 @@ public class SBBContraptionManager extends ContraptionRenderingWorld renderContraptionLayerSBB(event, info)); + RenderType type = event.getType(); + VertexConsumer consumer = event.buffers.bufferSource() + .getBuffer(type); + visible.forEach(info -> renderContraptionLayerSBB(info, type, consumer)); + + event.buffers.bufferSource().endBatch(type); } @Override @@ -38,9 +44,7 @@ public class SBBContraptionManager extends ContraptionRenderingWorld ContraptionRenderDispatcher.buildStructureBuffer(renderInfo.renderWorld, renderInfo.contraption, layer)); @@ -51,8 +55,7 @@ public class SBBContraptionManager extends ContraptionRenderingWorld, Translate