19 lines
391 B
Rust
19 lines
391 B
Rust
use ray_tracing_core::prelude::*;
|
|
|
|
pub struct DiffuseMaterial {
|
|
pub(crate) albedo: Color,
|
|
}
|
|
|
|
impl DiffuseMaterial {
|
|
pub fn new(color: Color) -> Self {
|
|
Self {
|
|
albedo: color * FloatConsts::FRAC_1_PI,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<R: Rng> Material<R> for DiffuseMaterial {
|
|
fn eval(&self, _w_in: Dir3, _w_out: Dir3, _rng: &mut R) -> Color {
|
|
self.albedo
|
|
}
|
|
}
|