Merge pull request #297 from ludovic111/fix/leaves-option-remesh

Rebuild every section when See-Through Leaves, Smooth Lighting or Biome Blend changes
This commit is contained in:
Ludovic Marie
2026-10-15 09:30:39 +02:00
committed by GitHub
2 changed files with 17 additions and 7 deletions
+16
View File
@@ -7269,9 +7269,17 @@ impl Game<'_> {
.clamp_gui_scale([r.config.width as i32, r.config.height as i32]);
}
self.streaming.radius = self.settings.render_distance;
// Options.biomeBlendRadius, ambientOcclusion and cutoutLeaves:
// LevelExtractor.allChanged when they change.
let (s, st) = (&self.settings, &self.streaming);
let remesh = (s.biome_blend, s.smooth_lighting, s.cutout_leaves)
!= (st.biome_blend, st.smooth_lighting, st.cutout_leaves);
self.streaming.biome_blend = self.settings.biome_blend;
self.streaming.smooth_lighting = self.settings.smooth_lighting;
self.streaming.cutout_leaves = self.settings.cutout_leaves;
if remesh {
self.all_sections_changed();
}
self.audio.master = self.settings.master_volume;
horizon_client::hud::GUI_SCALE.store(
self.settings.gui_scale,
@@ -7279,6 +7287,14 @@ impl Game<'_> {
);
self.apply_ui_settings();
}
/// `LevelExtractor.allChanged`: every loaded section is rebuilt.
fn all_sections_changed(&mut self) {
for &(x, z) in self.world.chunks.keys() {
for sy in 0..horizon_client::chunk::HEIGHT / 16 {
self.world.dirty_sections.insert((x, sy, z));
}
}
}
/// Whether precipitation at a column is snow (Biome.coldEnoughToSnow:
/// base temperature lowered above y 80) or none (no precipitation).
fn precipitation(&self, x: i32, y: i32, z: i32) -> Option<bool> {
+1 -7
View File
@@ -227,13 +227,7 @@ impl Game<'_> {
let player = self.player.is_some() && !self.reduced_debug_info();
match action {
DebugAction::ReloadChunks => {
// LevelExtractor.allChanged: every section is rebuilt.
let keys: Vec<(i32, i32)> = self.world.chunks.keys().copied().collect();
for (x, z) in keys {
for sy in 0..horizon_client::chunk::HEIGHT / 16 {
self.world.dirty_sections.insert((x, sy, z));
}
}
self.all_sections_changed();
self.debug_translated("debug.reload_chunks.message");
true
}