ray_tracer/hitable/
mod.rs

1use crate::float::Float;
2use crate::vector::Vec3;
3use crate::ray::Ray;
4use crate::hit::Hit;
5use crate::boundingbox::BoundingBox;
6
7pub mod primitive;
8pub mod transform;
9
10pub trait Hitable<T>
11    where T: Float
12{
13    fn hit(&self, ray: &Ray<T>, t_min: T, t_max: T) -> Option<Hit<T>>;
14    fn get_bounds(&self) -> &BoundingBox<T>;
15    fn unwrap(self: Box<Self>) -> Box<dyn Hitable<T>>;
16    fn is_primitive(&self) -> bool {
17        // Primitives (i.e. spheres, boxes, rectangles) return true,
18        // Decorators (i.e. translations, rotations) return false
19        true
20    }
21}