pub struct AutoExposureState {
pub current_ev: f32,
}Expand description
Running auto-exposure state. The current adapted EV moves toward the target EV (derived from the GPU-measured average log-luminance) via an exponential moving average so a sudden brightness change ramps in over a fraction of a second rather than snapping. One instance lives on each backend that runs auto-exposure.
Fields§
§current_ev: f32EV currently applied to the scene. Updated each frame by
AutoExposureState::update; the backend reads it back out to set the
exposure multiplier the post passes push to the GPU.
Implementations§
Source§impl AutoExposureState
impl AutoExposureState
Sourcepub fn new(settings: &AutoExposureSettings) -> Self
pub fn new(settings: &AutoExposureSettings) -> Self
Initial state. The current EV is the midpoint of the settings’ clamp
range: a neutral starting point before the first GPU measurement
arrives. The first update call snaps it toward the real scene EV.
Sourcepub fn update(
&mut self,
avg_log_lum: f32,
ev_bias: f32,
settings: &AutoExposureSettings,
dt: f32,
) -> f32
pub fn update( &mut self, avg_log_lum: f32, ev_bias: f32, settings: &AutoExposureSettings, dt: f32, ) -> f32
Step the EMA one frame: take the GPU-measured average log-luminance
(base-2), turn it into a target EV (the offset that maps the scene
mean onto settings.target_log_lum plus the authored ev_bias),
then move current_ev toward it by the clamped EMA rate. Returns
the new clamped EV. dt is the frame time in seconds; non-finite or
non-positive values short-circuit (the EV stays where it was, no
NaN propagation into the post pass).
Trait Implementations§
Source§impl Clone for AutoExposureState
impl Clone for AutoExposureState
Source§fn clone(&self) -> AutoExposureState
fn clone(&self) -> AutoExposureState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more