use ray_tracing_core::prelude::*;

#[derive(Debug)]
pub struct Mirror {
    color: Color,
}

impl Mirror {
    pub fn new(color: Color) -> Self {
        Self { color }
    }
}

impl<R: Rng> Material<R> for Mirror {
    fn eval(&self, _w_in: Dir3, _w_out: Dir3, _rng: &mut R) -> Color {
        Color::black()
    }

    fn sample(&self, w_in: Dir3, _rng: &mut R) -> ray_tracing_core::material::SampleResult {
        let w_out = (2.0 * Dir3::up() * w_in.y()) - w_in;

        ray_tracing_core::material::SampleResult::new(w_out, self.color, true)
    }

    fn pdf(&self, w_in: Dir3, w_out: Dir3) -> Float {
        let _ = w_out;
        let _ = w_in;
        0.0
    }
}
