some refactoring and proper DoF support
All checks were successful
Build & Test / build (push) Successful in 32s

This commit is contained in:
2026-02-18 18:33:27 +01:00
parent 23e86e6655
commit b3de1760b4
8 changed files with 203 additions and 93 deletions

View File

@@ -8,12 +8,12 @@ use crate::Ray;
pub struct Sphere {
center: Point3,
radius: f64,
mat_ptr: Box<dyn Material>,
material: Box<dyn Material>,
}
impl Sphere {
pub fn new<T: Material + 'static>(center: Point3, radius: f64, mat_ptr: Box<T>) -> Self {
Sphere {center, radius, mat_ptr}
pub fn new<T: Material + 'static>(center: Point3, radius: f64, material: Box<T>) -> Self {
Sphere {center, radius, material}
}
}
@@ -54,7 +54,7 @@ impl Hittable for Sphere {
p: p,
normal: outward_normal,
front_face,
mat_ptr: self.mat_ptr.deref(),
material: self.material.deref(),
})
}
}