3039607e4f
This will allow for the use of meshes inside the BVH. Returning the reference to a triangle inside the mesh directly instead of returning the reference to the mesh itself allows for more optimum execution.
15 lines
541 B
Rust
15 lines
541 B
Rust
use crate::aabb::Bounded;
|
|
use crate::ray::Ray;
|
|
|
|
/// The trait for any object to be used in the [`BVH`]. Its derivation for [`Accelerated`] is
|
|
/// automatically derived to return a reference to itself. If this not the intended semantics, see
|
|
/// [`Accelerated`].
|
|
///
|
|
/// [`Accelerated`]: struct.Accelerated.html
|
|
/// [`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>;
|
|
}
|