From 78f206bc223ec4c80378f2840db4d979598fada8 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 15 Oct 2026 02:24:57 +0200 Subject: [PATCH] Mesh only when no neighbour is being lit; skip columns that can't be lit yet Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/streaming.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/horizon-client/src/streaming.rs b/crates/horizon-client/src/streaming.rs index 1837216e5..9d5c7dd50 100644 --- a/crates/horizon-client/src/streaming.rs +++ b/crates/horizon-client/src/streaming.rs @@ -822,16 +822,18 @@ impl Streaming { continue; } // Once per column: the 3x3 check would otherwise repeat for each - // of its sections every frame. A neighbour being lit or waiting - // for light dirties this column again when it finishes (new - // chunks relight their eight neighbours), so mesh once its light - // has settled rather than once per neighbour. - let (lit, lighting, dirty_light) = (&self.lit, &self.lighting, &world.dirty_light); + // of its sections every frame. A neighbour being lit dirties this + // column again when its light job finishes (new chunks relight + // their eight neighbours), so wait for it rather than mesh once + // per neighbour. Columns still in `dirty_light` here can't be lit + // yet (a neighbour of theirs is missing): waiting for them could + // last until the player comes back. + let (lit, lighting) = (&self.lit, &self.lighting); let ready = *ready_columns.entry((x, z)).or_insert_with(|| { (-1..=1).all(|dz| { (-1..=1).all(|dx| { let n = (x + dx, z + dz); - lit.contains(&n) && !lighting.contains_key(&n) && !dirty_light.contains(&n) + lit.contains(&n) && !lighting.contains_key(&n) }) }) });