pathtracer/beevee/src/bvh/intersected.rs
Bruno BELANYI 21c7aea1c0 beevee: bvh: use Intersected trait for objects
This avoids having black squares around the objects because we computed
that it was the closest but the ray didn't actually hit it...
2020-03-24 21:55:51 +01:00

12 lines
338 B
Rust

use crate::aabb::Bounded;
use crate::ray::Ray;
/// The trait for any object to be used in the [`BVH`].
///
/// [`BVH`]: struct.BVH.html
pub trait Intersected: Bounded {
/// Return None if there is no intersection, or the distance along the ray to the closest
/// intersection
fn intersect(&self, ray: &Ray) -> Option<f32>;
}