Skip to content

Commit

Permalink
fix translucent rendering by correctly decoding vertex segments
Browse files Browse the repository at this point in the history
  • Loading branch information
douira committed Sep 28, 2024
1 parent 2163c9e commit c01a6bd
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ public int[] computeVertexCounts() {
var vertexCounts = new int[ModelQuadFacing.COUNT];

for (int i : this.vertexSegments) {
vertexCounts[SectionRenderDataUnsafe.decodeFacing(i)] = SectionRenderDataUnsafe.decodeVertexCount(i);
var count = SectionRenderDataUnsafe.decodeVertexCount(i);

// it's important to only write non-zero vertex counts since the decoded facing is wrong if the count is zero
// (the whole segment is just zero, which decodes to the first facing, but it's not actually that facing, just no vertexes)
if (count > 0) {
vertexCounts[SectionRenderDataUnsafe.decodeFacing(i)] = count;
}
}

return vertexCounts;
Expand Down

0 comments on commit c01a6bd

Please sign in to comment.