Skip to content

Commit ec0e945

Browse files
authored
Merge pull request #1055 from louis-e/fix/baked-chunk-lighting
Bake chunk lighting so generated worlds load lit
2 parents 7f44cbb + dbfda88 commit ec0e945

26 files changed

Lines changed: 519 additions & 7 deletions

src/args.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ pub struct Args {
104104
/// Print generation-only timing to stderr (excludes data fetching)
105105
#[arg(long, hide = true)]
106106
pub benchmark: bool,
107+
108+
/// Bake per-chunk lighting so distant chunks render lit in LOD mods
109+
/// (Voxy/Chunky) without visiting them. Slower; off by default.
110+
#[arg(long, default_value_t = false)]
111+
pub bake_lighting: bool,
107112
}
108113

109114
/// Validates CLI arguments after parsing.
@@ -220,6 +225,7 @@ mod tests {
220225
assert!(!args.terrain);
221226
assert!(!args.bedrock);
222227
assert!(!args.disable_height_limit);
228+
assert!(!args.bake_lighting);
223229
// interior, roof, land_cover default to true
224230
assert!(args.interior);
225231
assert!(args.roof);

src/data_processing.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ pub fn generate_world_with_options(
6666
args.disable_height_limit,
6767
)
6868
};
69+
editor.set_bake_lighting(args.bake_lighting);
6970
let ground = Arc::new(ground);
7071

7172
// Per-cell water depth field from the LC_WATER mask; empty without land cover.

src/gui.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ fn gui_start_generation(
846846
use_3d_enabled: bool,
847847
disable_height_limit: bool,
848848
aws_only_elevation: bool,
849+
bake_lighting_enabled: bool,
849850
is_new_world: bool,
850851
spawn_point: Option<(f64, f64)>,
851852
telemetry_consent: bool,
@@ -1096,6 +1097,7 @@ fn gui_start_generation(
10961097
disable_height_limit,
10971098
aws_only_elevation,
10981099
benchmark: false,
1100+
bake_lighting: bake_lighting_enabled,
10991101
};
11001102

11011103
// If skip_osm_objects is true (terrain-only mode), skip fetching and processing OSM data

src/gui/css/styles.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,14 @@ button:hover {
656656
accent-color: #fecc44;
657657
}
658658

659+
#aws-only-elevation-toggle {
660+
accent-color: #fecc44;
661+
}
662+
663+
#bake-lighting-toggle {
664+
accent-color: #fecc44;
665+
}
666+
659667
#enable-luanti-toggle {
660668
accent-color: #fecc44;
661669
}

src/gui/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,17 @@ <h2 data-localize="customization_settings">Settings</h2>
176176
</div>
177177
</div>
178178

179+
<!-- Bake Lighting Toggle -->
180+
<div class="settings-row">
181+
<label for="bake-lighting-toggle">
182+
<span data-localize="bake_lighting">Bake lighting</span>
183+
<span class="tooltip-icon" data-tooltip="Precompute lighting so distant chunks render lit in LOD mods (Voxy/Chunky) without visiting them. Not needed for vanilla; slower generation.">?</span>
184+
</label>
185+
<div class="settings-control">
186+
<input type="checkbox" id="bake-lighting-toggle" name="bake-lighting-toggle">
187+
</div>
188+
</div>
189+
179190
<!-- World Scale Slider -->
180191
<div class="settings-row">
181192
<label for="scale-value-slider">

src/gui/js/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ async function applyLocalization(localization) {
120120
"span[data-localize='three_dmr']": "three_dmr",
121121
"span[data-localize='disable_height_limit']": "disable_height_limit",
122122
"span[data-localize='aws_only_elevation']": "aws_only_elevation",
123+
"span[data-localize='bake_lighting']": "bake_lighting",
123124
"span[data-localize='anonymous_crash_reports']": "anonymous_crash_reports",
124125
"span[data-localize='map_theme']": "map_theme",
125126
"span[data-localize='save_path']": "save_path",
@@ -1378,6 +1379,7 @@ async function startGeneration() {
13781379
var use_3d = document.getElementById("use-3d-toggle").checked;
13791380
var disable_height_limit = document.getElementById("disable-height-limit-toggle").checked;
13801381
var aws_only_elevation = document.getElementById("aws-only-elevation-toggle").checked;
1382+
var bake_lighting = document.getElementById("bake-lighting-toggle").checked;
13811383
var scale = parseFloat(document.getElementById("scale-value-slider").value);
13821384
// var ground_level = parseInt(document.getElementById("ground-level").value, 10);
13831385
// DEPRECATED: Ground level input removed from UI
@@ -1407,6 +1409,7 @@ async function startGeneration() {
14071409
use3dEnabled: use_3d,
14081410
disableHeightLimit: disable_height_limit,
14091411
awsOnlyElevation: aws_only_elevation,
1412+
bakeLightingEnabled: bake_lighting,
14101413
isNewWorld: true,
14111414
spawnPoint: spawnPoint,
14121415
telemetryConsent: telemetryConsent || false,

src/gui/locales/ar.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"three_dmr": "استخدام نماذج ثلاثية الأبعاد",
4646
"disable_height_limit": "توسيع ارتفاع البناء",
4747
"aws_only_elevation": "تضاريس قديمة",
48+
"bake_lighting": "حساب الإضاءة مسبقًا",
4849
"bedrock_auto_generated": "يتم إنشاء عالم Bedrock تلقائيًا",
4950
"save_path": "مسار الحفظ",
5051
"rotation_angle": "زاوية الدوران",

src/gui/locales/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"three_dmr": "3D-Modelle verwenden",
4646
"disable_height_limit": "Bauhöhe erweitern",
4747
"aws_only_elevation": "Klassisches Terrain",
48+
"bake_lighting": "Licht vorberechnen",
4849
"bedrock_auto_generated": "Bedrock-Welt wird automatisch generiert",
4950
"save_path": "Speicherpfad",
5051
"rotation_angle": "Rotationswinkel",

src/gui/locales/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"three_dmr": "Use 3D Models",
5353
"disable_height_limit": "Extend build height",
5454
"aws_only_elevation": "Legacy terrain",
55+
"bake_lighting": "Bake lighting",
5556
"bedrock_auto_generated": "Bedrock world is auto-generated",
5657
"save_path": "Save Path",
5758
"rotation_angle": "Rotation Angle",

src/gui/locales/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"three_dmr": "Usar modelos 3D",
4646
"disable_height_limit": "Ampliar altura de construcción",
4747
"aws_only_elevation": "Terreno clásico",
48+
"bake_lighting": "Precalcular iluminación",
4849
"bedrock_auto_generated": "El mundo Bedrock se genera automáticamente",
4950
"save_path": "Ruta de guardado",
5051
"rotation_angle": "Ángulo de Rotación",

0 commit comments

Comments
 (0)