Apply baked-in lightmap data to rendering

- Fix ForgeHooksClient.fillNormal injecting data to lightmap
- Fix OBJModel not filling lightmap data
- Fix NewModelLoaderTest blockitem not linking with block
This commit is contained in:
tterrag committed 2019-12-30 16:12:14 -05:00
1 parent e1b0a8c153
commit 53747b0cb5
5 files changed
+21 -9

No files matched your search

@@ -742,7 +742,7 @@ public class ForgeHooksClient
for(int i = 0; i < 4; i++)
{
faceData[i * 8 + 6] = normal;
faceData[i * 8 + 7] = normal;
}
}
@@ -91,7 +91,7 @@ public interface IForgeVertexBuilder
ca = alpha;
}
int lightmapCoord = lightmapCoords[v];
int lightmapCoord = applyBakedLighting(lightmapCoords[v], bytebuffer);
float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20);
Vector4f pos = new Vector4f(f, f1, f2, 1.0F);
@@ -99,6 +99,13 @@ public interface IForgeVertexBuilder
((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());
}
}
}
default int applyBakedLighting(int lightmapCoord, ByteBuffer data) {
int sl = (lightmapCoord >> 16) & 0xFFFF;
int bl = lightmapCoord & 0xFFFF;
sl = Math.max(sl, Short.toUnsignedInt(data.getShort(24)));
bl = Math.max(bl, Short.toUnsignedInt(data.getShort(26)));
return (sl << 16) | bl;
}
}
@@ -504,7 +504,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
texture.getInterpolatedV((flipV ? (1 - texCoord0.y) : texCoord0.y) * 16)
);
break;
case 1:
case 2:
consumer.put(j, uv2.x, uv2.y);
break;
default: