Revert "Optimize canBeSeenThroughOtherBlock" since it caused visual bugs.

This reverts commit c405f336ddc7ecd0ab3bd0821d4dd10fccbcd4de.
This commit is contained in:
IntegratedQuantum 2024-06-08 14:58:58 +02:00
parent 1df04351de
commit 01e4184387

View File

@ -696,11 +696,14 @@ pub const ChunkMesh = struct {
}
fn canBeSeenThroughOtherBlock(block: Block, other: Block, neighbor: u3) bool {
if(block.typ == 0) return false;
if(other.typ == 0) return true;
if(@as(u32, @bitCast(block)) == @as(u32, @bitCast(other))) return block.alwaysViewThrough();
if(other.viewThrough()) return true;
return !models.models.items[blocks.meshes.model(other)].isNeighborOccluded[neighbor ^ 1]; // TODO: Should this also solve faces between partial blocks, like fences?
const rotatedModel = blocks.meshes.model(block);
const model = &models.models.items[rotatedModel];
_ = model; // TODO: Check if the neighbor model occludes this one. (maybe not that relevant)
return block.typ != 0 and (
other.typ == 0
or (!std.meta.eql(block, other) and other.viewThrough()) or other.alwaysViewThrough()
or !models.models.items[blocks.meshes.model(other)].isNeighborOccluded[neighbor ^ 1]
);
}
fn initLight(self: *ChunkMesh) void {