From a2dfdd814dab42f23b4c4560e82674e9e4db854a Mon Sep 17 00:00:00 2001 From: pkuzic Date: Fri, 25 Sep 2026 16:48:19 +0100 Subject: [PATCH] MONKEY (skybox): WOW_SKYBOX_T capture clock for animated skies Co-Authored-By: Claude Opus 5.5 --- crates/benilla-world/src/skybox.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/benilla-world/src/skybox.rs b/crates/benilla-world/src/skybox.rs index 5c190b49..8ff00863 100644 --- a/crates/benilla-world/src/skybox.rs +++ b/crates/benilla-world/src/skybox.rs @@ -645,6 +645,19 @@ struct ModelClock { pose: Vec, } +/// MONKEY (skybox): `WOW_SKYBOX_T=` holds a capture's skybox clock there instead of 0, to +/// photograph an animated sky mid-loop. +fn capture_t() -> f32 { + static T: std::sync::OnceLock = std::sync::OnceLock::new(); + *T.get_or_init(|| { + std::env::var("WOW_SKYBOX_T") + .ok() + .and_then(|v| v.trim().parse().ok()) + .filter(|t: &f32| t.is_finite()) + .unwrap_or(0.0) + }) +} + /// MONKEY (skybox): pose every shown skybox and run its material loops on the model's clock: /// sequence 0 at `duration × day fraction` under flag `0x1`, else the scene clock. A capture holds /// `t = 0` unless the day drives the clock. @@ -676,7 +689,7 @@ fn animate_skyboxes( let g = if deterministic { 0.0 } else { f64::from(now) }; (rig.duration * day, g, true) } else if deterministic { - (0.0, 0.0, true) + (capture_t(), f64::from(capture_t()), true) } else { (now, f64::from(now), true) };