add default depth cue params

This commit is contained in:
Michael Zhang 2023-02-15 02:11:23 -06:00
parent 0000037052
commit 000003802c

View file

@ -6,8 +6,8 @@ use nalgebra::Vector3;
use crate::image::Color; use crate::image::Color;
use crate::ray::Ray; use crate::ray::Ray;
use super::Scene;
use super::illumination::IntersectionContext; use super::illumination::IntersectionContext;
use super::Scene;
pub trait ObjectKind: Debug + Send + Sync { pub trait ObjectKind: Debug + Send + Sync {
/// Determine where the ray intersects this object, returning the earliest /// Determine where the ray intersects this object, returning the earliest
@ -65,7 +65,7 @@ pub struct Light {
pub color: Vector3<f64>, pub color: Vector3<f64>,
} }
#[derive(Debug, Default)] #[derive(Debug)]
pub struct DepthCueing { pub struct DepthCueing {
pub color: Color, pub color: Color,
pub a_max: f64, pub a_max: f64,
@ -74,6 +74,22 @@ pub struct DepthCueing {
pub dist_min: f64, 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 { impl Scene {
/// Determine the boundaries of the viewing window in world coordinates /// Determine the boundaries of the viewing window in world coordinates
pub fn compute_viewing_window(&self, distance: f64) -> Rect { pub fn compute_viewing_window(&self, distance: f64) -> Rect {