A ray tracer written in rust, using Peter Shirley book as guide: https://raytracing.github.io/books/RayTracingInOneWeekend.html
- Why do we need this type of MaterialClone trait? And also why cant we call
clone
ongeometry.rs
and can only callclone_box
?
pub trait MaterialClone {
fn clone_box(&self) -> Box<dyn Material>;
}
impl<T> MaterialClone for T
where
T: 'static + Material + Clone,
{
fn clone_box(&self) -> Box<dyn Material> {
Box::new(self.clone())
}
}
impl Clone for Box<dyn Material> {
fn clone(&self) -> Box<dyn Material> {
self.clone_box()
}
}
- Fix bug on thread tilling logic.