diff --git a/assignment-1b/src/scene/data.rs b/assignment-1b/src/scene/data.rs index 6ce9b0f..6389d9b 100644 --- a/assignment-1b/src/scene/data.rs +++ b/assignment-1b/src/scene/data.rs @@ -6,8 +6,8 @@ use nalgebra::Vector3; use crate::image::Color; use crate::ray::Ray; -use super::Scene; use super::illumination::IntersectionContext; +use super::Scene; pub trait ObjectKind: Debug + Send + Sync { /// Determine where the ray intersects this object, returning the earliest @@ -65,7 +65,7 @@ pub struct Light { pub color: Vector3, } -#[derive(Debug, Default)] +#[derive(Debug)] pub struct DepthCueing { pub color: Color, pub a_max: f64, @@ -74,6 +74,22 @@ pub struct DepthCueing { pub dist_min: f64, } +/// A default implementation here needs to simulate what would happen if there +/// was no depth cueing. In this case, if we have both a_max and a_min be 1.0, +/// then the original color will always apply and there will be no need for +/// depth color +impl Default for DepthCueing { + fn default() -> Self { + Self { + color: Default::default(), + a_max: 1.0, + a_min: 1.0, + dist_max: 0.0, + dist_min: 0.0, + } + } +} + impl Scene { /// Determine the boundaries of the viewing window in world coordinates pub fn compute_viewing_window(&self, distance: f64) -> Rect {