pub struct ToneMappingSettings {
pub mode: ToneMappingMode,
pub lut_texture: Option<TextureHandle>,
/* private fields */
}Expand description
Tone mapping configuration.
This struct holds all parameters for the tone mapping post-processing pass.
Changes to uniforms are tracked via CpuBuffer’s internal version for efficient GPU sync.
§Usage
// Get settings from scene
let settings = &mut scene.tone_mapping;
// Modify parameters (automatically updates version)
settings.set_exposure(1.5);
settings.set_mode(ToneMappingMode::ACESFilmic);Fields§
§mode: ToneMappingModeSelected tone mapping algorithm
lut_texture: Option<TextureHandle>Exposure multiplier (default: 1.0)
Optional 3D LUT texture handle. When Some, the USE_LUT shader macro is enabled
and the pipeline is recompiled. When None, no LUT is applied.
Implementations§
Source§impl ToneMappingSettings
impl ToneMappingSettings
Sourcepub fn new() -> ToneMappingSettings
pub fn new() -> ToneMappingSettings
Creates new tone mapping settings with default values.
pub fn uniforms(&self) -> BufferReadGuard<'_, ToneMappingUniforms>
pub fn uniforms_mut(&mut self) -> BufferGuard<'_, ToneMappingUniforms>
Sourcepub fn set_mode(&mut self, mode: ToneMappingMode)
pub fn set_mode(&mut self, mode: ToneMappingMode)
Sets the tone mapping mode.
Only updates the mode if the value actually changed.
Sourcepub fn set_exposure(&mut self, exposure: f32)
pub fn set_exposure(&mut self, exposure: f32)
Sets the exposure value.
Sourcepub fn set_contrast(&mut self, contrast: f32)
pub fn set_contrast(&mut self, contrast: f32)
Sets the contrast adjustment.
Sourcepub fn set_saturation(&mut self, saturation: f32)
pub fn set_saturation(&mut self, saturation: f32)
Sets the saturation adjustment.
Sourcepub fn set_chromatic_aberration(&mut self, intensity: f32)
pub fn set_chromatic_aberration(&mut self, intensity: f32)
Sets the chromatic aberration intensity.
Sourcepub fn set_film_grain(&mut self, intensity: f32)
pub fn set_film_grain(&mut self, intensity: f32)
Sets the film grain intensity.
Sourcepub fn set_vignette_intensity(&mut self, intensity: f32)
pub fn set_vignette_intensity(&mut self, intensity: f32)
Sets the vignette intensity.
A value of 0.0 disables the vignette effect.
Sourcepub fn set_vignette_smoothness(&mut self, smoothness: f32)
pub fn set_vignette_smoothness(&mut self, smoothness: f32)
Sets the vignette smoothness.
Controls how quickly the darkening falls off from the edges. Recommended range: 0.1 ~ 1.0. Default is 0.5 for a balanced look.
Sourcepub fn set_vignette_color(&mut self, color: Vec4)
pub fn set_vignette_color(&mut self, color: Vec4)
Sets the vignette color. This is the color used for the vignette effect (default: black with full alpha).
Sourcepub fn set_lut_texture(&mut self, lut: Option<TextureHandle>)
pub fn set_lut_texture(&mut self, lut: Option<TextureHandle>)
Sets the 3D LUT texture for color grading.
Pass Some(handle) to enable LUT-based color grading, or None to disable it.
Changing this triggers a pipeline rebuild (shader macro change).
Sourcepub fn set_lut_contribution(&mut self, contribution: f32)
pub fn set_lut_contribution(&mut self, contribution: f32)
Sets the LUT contribution weight.
0.0 = original color, 1.0 = fully LUT-graded.
Sourcepub fn vignette_intensity(&self) -> f32
pub fn vignette_intensity(&self) -> f32
Returns the current vignette intensity.
Sourcepub fn mode(&self) -> ToneMappingMode
pub fn mode(&self) -> ToneMappingMode
Returns the current tone mapping mode.
Sourcepub fn saturation(&self) -> f32
pub fn saturation(&self) -> f32
Returns the current saturation value.
Sourcepub fn chromatic_aberration(&self) -> f32
pub fn chromatic_aberration(&self) -> f32
Returns the current chromatic aberration intensity.
Sourcepub fn film_grain(&self) -> f32
pub fn film_grain(&self) -> f32
Returns the current film grain intensity.
Sourcepub fn vignette_smoothness(&self) -> f32
pub fn vignette_smoothness(&self) -> f32
Returns the current vignette smoothness.
Sourcepub fn vignette_color(&self) -> Vec4
pub fn vignette_color(&self) -> Vec4
Returns the current vignette color.
Sourcepub fn lut_contribution(&self) -> f32
pub fn lut_contribution(&self) -> f32
Returns the current LUT contribution.
Trait Implementations§
Source§impl Clone for ToneMappingSettings
impl Clone for ToneMappingSettings
Source§fn clone(&self) -> ToneMappingSettings
fn clone(&self) -> ToneMappingSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToneMappingSettings
impl Debug for ToneMappingSettings
Source§impl Default for ToneMappingSettings
impl Default for ToneMappingSettings
Source§fn default() -> ToneMappingSettings
fn default() -> ToneMappingSettings
Auto Trait Implementations§
impl !Freeze for ToneMappingSettings
impl !RefUnwindSafe for ToneMappingSettings
impl Send for ToneMappingSettings
impl Sync for ToneMappingSettings
impl Unpin for ToneMappingSettings
impl UnsafeUnpin for ToneMappingSettings
impl UnwindSafe for ToneMappingSettings
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().