pub struct Bvh<T: Clone> {
pub item_count: usize,
/* private fields */
}Expand description
A complete BVH tree.
Fields§
§item_count: usizeImplementations§
Source§impl<T: Clone> Bvh<T>
impl<T: Clone> Bvh<T>
Sourcepub fn build(items: Vec<(Aabb, T)>) -> Self
pub fn build(items: Vec<(Aabb, T)>) -> Self
Build a BVH from a list of (bounds, item) pairs using SAH heuristic.
pub fn query_sphere(&self, center: Vec3, radius: f32) -> Vec<T>
pub fn query_ray(&self, origin: Vec3, dir: Vec3, max_t: f32) -> Vec<(T, f32)>
pub fn query_aabb(&self, bounds: &Aabb) -> Vec<T>
pub fn is_empty(&self) -> bool
pub fn item_count(&self) -> usize
Auto Trait Implementations§
impl<T> Freeze for Bvh<T>where
T: Freeze,
impl<T> RefUnwindSafe for Bvh<T>where
T: RefUnwindSafe,
impl<T> Send for Bvh<T>where
T: Send,
impl<T> Sync for Bvh<T>where
T: Sync,
impl<T> Unpin for Bvh<T>where
T: Unpin,
impl<T> UnsafeUnpin for Bvh<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Bvh<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.