some refactoring and proper DoF support
All checks were successful
Build & Test / build (push) Successful in 32s
All checks were successful
Build & Test / build (push) Successful in 32s
This commit is contained in:
@@ -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(),
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user