1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Tone mapping configuration.
use serde::{Deserialize, Serialize};
/// Tone mapping configuration.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ToneMappingConfig {
/// Exposure multiplier (default 1.0).
pub exposure: f32,
/// White level for highlight compression (default 1.0).
pub white_level: f32,
/// Gamma correction exponent (default 2.2).
pub gamma: f32,
}
impl Default for ToneMappingConfig {
fn default() -> Self {
Self {
exposure: 1.0,
white_level: 1.0,
gamma: 2.2,
}
}
}
impl ToneMappingConfig {
/// Creates a new tone mapping configuration with default values.
#[must_use]
pub fn new() -> Self {
Self::default()
}
/// Sets the exposure value.
#[must_use]
pub fn with_exposure(mut self, exposure: f32) -> Self {
self.exposure = exposure;
self
}
/// Sets the white level.
#[must_use]
pub fn with_white_level(mut self, white_level: f32) -> Self {
self.white_level = white_level;
self
}
/// Sets the gamma value.
#[must_use]
pub fn with_gamma(mut self, gamma: f32) -> Self {
self.gamma = gamma;
self
}
}