pub struct IblBaker { /* private fields */ }Expand description
One-time IBL bake service. Registered as a shared resource at bootstrap and
driven by the ibl_bake DataSystem, which calls ensure_baked every
frame; the bake itself runs only on the first call.
Implementations§
Source§impl IblBaker
impl IblBaker
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an unbaked baker. The bake happens lazily on the first
ensure_baked once a device is available.
Sourcepub fn wait_for_environment(&self) -> bool
pub fn wait_for_environment(&self) -> bool
Records one tick spent waiting for the scene’s environment asset to
load. Returns true while the caller should keep waiting, and false
once the budget is spent and it must bake the procedural sky instead.
Sourcepub fn ensure_baked(
&self,
device: &dyn GraphicsDevice,
pipeline_system: &dyn PipelineSystem,
sun_direction: Vec3,
env_source: Option<&CpuTexture>,
)
pub fn ensure_baked( &self, device: &dyn GraphicsDevice, pipeline_system: &dyn PipelineSystem, sun_direction: Vec3, env_source: Option<&CpuTexture>, )
Bakes the IBL resources on the first call; a no-op afterwards. Idempotent and safe to call every frame.
sun_direction points toward the sun in world space — the scene’s
directional light, so the procedural sky’s sun disk agrees with the
light that casts the shadows. A zero/degenerate vector falls back to
[DEFAULT_SUN_DIRECTION]. The bake is one-time, so this captures the
light as it stands on the first tick.
env_source is an authored equirectangular environment map (see
EnvironmentMap); None bakes the procedural sky instead. Both fill
the same env cube, so the rest of the chain is unaffected.