use crate::optics::raytracer::{
LightingPreset,
environment::{TRAY_ALBEDO_BLACK, TRAY_ALBEDO_GREY, TRAY_ALBEDO_WHITE, tray_radiance},
};
const SHIM_LIGHT_YAW_DEG: f32 = 48.0;
const SHIM_LIGHT_PITCH_DEG: f32 = 72.0;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Backdrop {
AsLit,
Grey,
#[default]
White,
Black,
}
impl Backdrop {
#[must_use]
pub const fn albedo(self) -> f32 {
match self {
Self::AsLit => 0.0,
Self::Grey => TRAY_ALBEDO_GREY,
Self::White => TRAY_ALBEDO_WHITE,
Self::Black => TRAY_ALBEDO_BLACK,
}
}
#[must_use]
pub fn resolve(self, preset: LightingPreset, light_yaw: f32, light_pitch: f32) -> f32 {
tray_radiance(self.albedo(), preset, light_yaw, light_pitch)
}
#[must_use]
pub fn level(self) -> f32 {
self.resolve(
LightingPreset::default(),
SHIM_LIGHT_YAW_DEG.to_radians(),
SHIM_LIGHT_PITCH_DEG.to_radians(),
)
}
#[must_use]
pub const fn index(self) -> i32 {
match self {
Self::AsLit => 0,
Self::Grey => 1,
Self::White => 2,
Self::Black => 3,
}
}
#[must_use]
pub const fn from_index(index: i32) -> Self {
match index {
0 => Self::AsLit,
1 => Self::Grey,
3 => Self::Black,
_ => Self::White,
}
}
}