use std::sync::Arc; use crate::aabb::AABB; use crate::material::Material; use crate::ray::Ray; use crate::vec3::Vec3; pub struct HitRecord<'m> { pub t: f32, pub uv: (f32, f32), pub p: Vec3, pub normal: Vec3, pub material: &'m dyn Material, } pub trait Hit: Send + Sync { fn hit(&self, r: Ray, t_min: f32, t_max: f32) -> Option; fn bounding_box(&self, t_min: f32, t_max: f32) -> Option; } impl Hit for Arc { fn hit(&self, r: Ray, t_min: f32, t_max: f32) -> Option { (**self).hit(r, t_min, t_max) } fn bounding_box(&self, t_min: f32, t_max: f32) -> Option { (**self).bounding_box(t_min, t_max) } }