18 lines
383 B
Rust
18 lines
383 B
Rust
use aabb::AABB;
|
|
use material::Material;
|
|
use ray::Ray;
|
|
use vec3::Vec3;
|
|
|
|
pub struct HitRecord<'m> {
|
|
pub t: f32,
|
|
pub uv: (f32, f32),
|
|
pub p: Vec3,
|
|
pub normal: Vec3,
|
|
pub material: &'m Material,
|
|
}
|
|
|
|
pub trait Hit: Send + Sync {
|
|
fn hit(&self, r: Ray, t_min: f32, t_max: f32) -> Option<HitRecord>;
|
|
fn bounding_box(&self, t_min: f32, t_max: f32) -> Option<AABB>;
|
|
}
|