Fix breaking overlay weirdness. applyBakedNormals was not transforming the baked normals when applying them. Fixes #6432

This commit is contained in:
David Quintana committed 2020-01-16 03:29:46 +01:00
1 parent 088fc6b67f
commit 1936eb1f36
3 files changed
+6 -4

No files matched your search

@@ -23,6 +23,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.Matrix3f;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
@@ -98,7 +99,7 @@ public interface IForgeVertexBuilder
float f10 = bytebuffer.getFloat(20);
Vector4f pos = new Vector4f(f, f1, f2, 1.0F);
pos.func_229372_a_(matrix4f);
applyBakedNormals(normal, bytebuffer);
applyBakedNormals(normal, bytebuffer, matrixEntry.func_227872_b_());
((IVertexBuilder)this).func_225588_a_(pos.getX(), pos.getY(), pos.getZ(), cr, cg, cb, ca, f9, f10, overlayCoords, lightmapCoord, normal.getX(), normal.getY(), normal.getZ());
}
}
@@ -114,12 +115,13 @@ public interface IForgeVertexBuilder
return LightTexture.func_228451_a_(bl, sl);
}
default void applyBakedNormals(Vector3f generated, ByteBuffer data) {
default void applyBakedNormals(Vector3f generated, ByteBuffer data, Matrix3f normalTransform) {
byte nx = data.get(28);
byte ny = data.get(29);
byte nz = data.get(30);
if (nx != 0 || ny != 0 || nz != 0) {
generated.set(nx / 127f, ny / 127f, nz / 127f);
generated.func_229188_a_(normalTransform);
}
}
}