Add support for emissive textures (#601)

This commit is contained in:
Lukas Rieger 2024-08-19 08:37:01 +02:00 committed by GitHub
parent d5fe7175c6
commit bca6647670
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -305,8 +305,9 @@ private void createElementFace(Element element, Direction faceDir, VectorM3f c0,
}
// ####### blocklight
tileModel.setBlocklight(face1, blockLight);
tileModel.setBlocklight(face2, blockLight);
int emissiveBlockLight = Math.max(blockLight, element.getLightEmission());
tileModel.setBlocklight(face1, emissiveBlockLight);
tileModel.setBlocklight(face2, emissiveBlockLight);
// ####### sunlight
tileModel.setSunlight(face1, sunLight);

View File

@ -46,6 +46,7 @@ public class Element {
private Vector3f from = FULL_BLOCK_MIN, to = FULL_BLOCK_MAX;
private Rotation rotation = Rotation.ZERO;
private boolean shade = true;
private int lightEmission = 0;
private EnumMap<Direction, Face> faces = new EnumMap<>(Direction.class);
@SuppressWarnings("unused")
@ -56,6 +57,7 @@ private Element(Element copyFrom) {
this.to = copyFrom.to;
this.rotation = copyFrom.rotation;
this.shade = copyFrom.shade;
this.lightEmission = copyFrom.lightEmission;
copyFrom.faces.forEach((direction, face) -> this.faces.put(direction, face.copy()));
}
@ -132,6 +134,10 @@ public boolean isShade() {
return shade;
}
public int getLightEmission() {
return lightEmission;
}
public EnumMap<Direction, Face> getFaces() {
return faces;
}