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.
This commit is contained in:
parent
2cdbdfa218
commit
0ff67382ee
5 changed files with 14 additions and 10 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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<Contraption
|
|||
@Override
|
||||
public void renderLayer(RenderLayerEvent event) {
|
||||
super.renderLayer(event);
|
||||
visible.forEach(info -> 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<Contraption
|
|||
return new ContraptionRenderInfo(c, renderWorld);
|
||||
}
|
||||
|
||||
private void renderContraptionLayerSBB(RenderLayerEvent event, ContraptionRenderInfo renderInfo) {
|
||||
RenderType layer = event.getType();
|
||||
|
||||
private void renderContraptionLayerSBB(ContraptionRenderInfo renderInfo, RenderType layer, VertexConsumer consumer) {
|
||||
if (!renderInfo.isVisible()) return;
|
||||
|
||||
SuperByteBuffer contraptionBuffer = CreateClient.BUFFER_CACHE.get(CONTRAPTION, Pair.of(renderInfo.contraption, layer), () -> ContraptionRenderDispatcher.buildStructureBuffer(renderInfo.renderWorld, renderInfo.contraption, layer));
|
||||
|
@ -51,8 +55,7 @@ public class SBBContraptionManager extends ContraptionRenderingWorld<Contraption
|
|||
contraptionBuffer.transform(matrices.getModel())
|
||||
.light(matrices.getWorld())
|
||||
.hybridLight()
|
||||
.renderInto(matrices.getViewProjection(), event.buffers.bufferSource()
|
||||
.getBuffer(layer));
|
||||
.renderInto(matrices.getViewProjection(), consumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import com.jozufozu.flywheel.api.vertex.VertexList;
|
||||
import com.jozufozu.flywheel.backend.OptifineHandler;
|
||||
import com.jozufozu.flywheel.core.vertex.BlockVertexList;
|
||||
import com.jozufozu.flywheel.util.transform.Rotate;
|
||||
import com.jozufozu.flywheel.util.transform.Scale;
|
||||
|
@ -129,7 +130,7 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
|||
b = template.getB(i);
|
||||
a = template.getA(i);
|
||||
}
|
||||
if (disableDiffuseMult) {
|
||||
if (disableDiffuseMult || OptifineHandler.usingShaders()) {
|
||||
builder.color(r, g, b, a);
|
||||
} else {
|
||||
float instanceDiffuse = LightUtil.diffuseLight(nx, ny, nz);
|
||||
|
|
Loading…
Reference in a new issue