Revert "Indigo Flat-Shading Lighting Fix ()"

This reverts commit 28388fad
This commit is contained in:
modmuss50 2020-07-20 19:52:17 +01:00
parent 28388fadd8
commit 7548be6d43
3 changed files with 14 additions and 7 deletions
fabric-renderer-indigo
build.gradle
src/main/java/net/fabricmc/fabric/impl/client/indigo/renderer/render

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-renderer-indigo"
version = getSubprojectVersion(project, "0.3.4")
version = getSubprojectVersion(project, "0.3.3")
dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')

View file

@ -173,12 +173,7 @@ public abstract class AbstractQuadRenderer {
int flatBrightness(MutableQuadViewImpl quad, BlockState blockState, BlockPos pos) {
mpos.set(pos);
// To mirror Vanilla's behavior, if the face has a cull-face, always sample the light value
// offset in that direction. See net.minecraft.client.render.block.BlockModelRenderer.renderFlat
// for reference.
if (quad.cullFace() != null) {
mpos.move(quad.cullFace());
} else if ((quad.geometryFlags() & LIGHT_FACE_FLAG) != 0 || Block.isShapeFullCube(blockState.getCollisionShape(blockInfo.blockView, pos))) {
if ((quad.geometryFlags() & LIGHT_FACE_FLAG) != 0 || Block.isShapeFullCube(blockState.getCollisionShape(blockInfo.blockView, pos))) {
mpos.move(quad.lightFace());
}

View file

@ -35,6 +35,7 @@ import net.fabricmc.fabric.api.renderer.v1.render.RenderContext.QuadTransform;
import net.fabricmc.fabric.impl.client.indigo.renderer.IndigoRenderer;
import net.fabricmc.fabric.impl.client.indigo.renderer.RenderMaterialImpl.Value;
import net.fabricmc.fabric.impl.client.indigo.renderer.aocalc.AoCalculator;
import net.fabricmc.fabric.impl.client.indigo.renderer.helper.GeometryHelper;
import net.fabricmc.fabric.impl.client.indigo.renderer.mesh.EncodingFormat;
import net.fabricmc.fabric.impl.client.indigo.renderer.mesh.MutableQuadViewImpl;
@ -143,6 +144,17 @@ public abstract class TerrainFallbackConsumer extends AbstractQuadRenderer imple
aoCalc.compute(editorQuad, true);
tesselateSmooth(editorQuad, blockInfo.defaultLayer, editorQuad.colorIndex());
} else {
// vanilla compatibility hack
// For flat lighting, cull face drives everything and light face is ignored.
if (cullFace == null) {
editorQuad.invalidateShape();
// Can't rely on lazy computation in tesselateFlat() because needs to happen before offsets are applied
editorQuad.geometryFlags();
} else {
editorQuad.geometryFlags(GeometryHelper.LIGHT_FACE_FLAG);
editorQuad.lightFace(cullFace);
}
tesselateFlat(editorQuad, blockInfo.defaultLayer, editorQuad.colorIndex());
}
}