Skip to content

Commit 73798a9

Browse files
committed
fix: remesh neighbors in .meshing state to prevent boundary holes
1 parent c8ce4c2 commit 73798a9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/client/world/ChunkManager.zig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,11 @@ pub const ChunkManager = struct {
10071007
fn remeshNeighborIfLoaded(self: *Self, chunk_x: i32, chunk_z: i32, section_y: i32) void {
10081008
const neighbor_pos = ChunkPos{ .x = chunk_x, .z = chunk_z, .section_y = section_y };
10091009
const neighbor_chunk = self.chunk_storage.get(neighbor_pos) orelse return;
1010-
if (neighbor_chunk.getState() == .ready) {
1010+
const state = neighbor_chunk.getState();
1011+
// Also remesh .meshing chunks: the in-flight worker may have already captured
1012+
// neighbors before this chunk was in storage. Setting .dirty causes the stale
1013+
// result to be discarded (state/generation guards) and a fresh mesh scheduled.
1014+
if (state == .ready or state == .meshing) {
10111015
self.queueChunkRemesh(neighbor_pos);
10121016
}
10131017
}

0 commit comments

Comments
 (0)