Skip to content

Commit

Permalink
Add support for emissive textures (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
TBlueF authored Aug 19, 2024
1 parent d5fe717 commit bca6647
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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()));
}
Expand Down Expand Up @@ -132,6 +134,10 @@ public boolean isShade() {
return shade;
}

public int getLightEmission() {
return lightEmission;
}

public EnumMap<Direction, Face> getFaces() {
return faces;
}
Expand Down

0 comments on commit bca6647

Please sign in to comment.