#[derive(Clone, Copy, Debug, PartialEq)] pub struct LinearRGB { pub r: f32, pub g: f32, pub b: f32, } impl LinearRGB { pub fn new(r: f32, g: f32, b: f32) -> Self { Self { r, g, b } } } impl std::ops::AddAssign for LinearRGB { fn add_assign(&mut self, other: LinearRGB) { self.r += other.r; self.g += other.g; self.b += other.b; } } impl std::ops::MulAssign for LinearRGB { fn mul_assign(&mut self, scalar: f32) { self.r *= scalar; self.g *= scalar; self.b *= scalar; } } impl std::ops::DivAssign for LinearRGB { fn div_assign(&mut self, scalar: f32) { self.r /= scalar; self.g /= scalar; self.b /= scalar; } } impl std::ops::Mul for LinearRGB { type Output = Self; fn mul(mut self, scalar: f32) -> Self { self *= scalar; self } } impl std::ops::Div for LinearRGB { type Output = Self; fn div(mut self, scalar: f32) -> Self { self /= scalar; self } } impl std::default::Default for LinearRGB { fn default() -> Self { Self { r: 0.0, g: 0.0, b: 0.0, } } }