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) -> AutoExposureState
pub fn new(settings: &AutoExposureSettings) -> AutoExposureState
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 moreimpl Copy for AutoExposureState
Auto Trait Implementations§
impl Freeze for AutoExposureState
impl RefUnwindSafe for AutoExposureState
impl Send for AutoExposureState
impl Sync for AutoExposureState
impl Unpin for AutoExposureState
impl UnsafeUnpin for AutoExposureState
impl UnwindSafe for AutoExposureState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more