Skip to main content

mirage_engine/
tonemap.rs

1/// The curve a frame is drawn to the screen through.
2///
3/// Set with [`Config::with_tonemap`](crate::Config::with_tonemap); a curve is
4/// a look, so it belongs to the whole run.
5#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
6pub enum Tonemap {
7    /// Keeps colors where they are, and folds only the brightest light back
8    /// into range.
9    #[default]
10    Neutral,
11    /// The filmic curve: more contrast, and the brightest colors fade
12    /// towards white.
13    Aces,
14    /// No curve: light past the screen's range is clamped to it.
15    Off,
16}
17
18impl Tonemap {
19    /// This curve's index among the shader's curves.
20    pub(crate) fn index(self) -> u32 {
21        match self {
22            Self::Neutral => 0,
23            Self::Aces => 1,
24            Self::Off => 2,
25        }
26    }
27}