diff --git a/lib/common/src/bvh.rs b/lib/common/src/bvh.rs index b5d0c13..c5345c3 100644 --- a/lib/common/src/bvh.rs +++ b/lib/common/src/bvh.rs @@ -10,27 +10,27 @@ use crate::aabb::Aabb; //sort the centerpoints on each axis (3 lists) //bv is put into octant based on whether it is upper or lower in each list -pub enum RecursiveContent<R,T>{ - Branch(Vec<R>), - Leaf(T), +pub enum RecursiveContent<N,L>{ + Branch(Vec<N>), + Leaf(L), } -impl<R,T> RecursiveContent<R,T>{ +impl<N,L> RecursiveContent<N,L>{ pub fn empty()->Self{ Self::Branch(Vec::new()) } } -pub struct BvhNode<T>{ - content:RecursiveContent<BvhNode<T>,T>, +pub struct BvhNode<L>{ + content:RecursiveContent<BvhNode<L>,L>, aabb:Aabb, } -impl<T> BvhNode<T>{ +impl<L> BvhNode<L>{ pub fn empty()->Self{ Self{ content:RecursiveContent::empty(), aabb:Aabb::default(), } } - pub fn sample_aabb<F:FnMut(&T)>(&self,aabb:&Aabb,f:&mut F){ + pub fn sample_aabb<F:FnMut(&L)>(&self,aabb:&Aabb,f:&mut F){ match &self.content{ RecursiveContent::Leaf(model)=>f(model), RecursiveContent::Branch(children)=>for child in children{ @@ -44,10 +44,10 @@ impl<T> BvhNode<T>{ }, } } - pub fn into_inner(self)->(RecursiveContent<BvhNode<T>,T>,Aabb){ + pub fn into_inner(self)->(RecursiveContent<BvhNode<L>,L>,Aabb){ (self.content,self.aabb) } - pub fn into_visitor<F:FnMut(T)>(self,f:&mut F){ + pub fn into_visitor<F:FnMut(L)>(self,f:&mut F){ match self.content{ RecursiveContent::Leaf(model)=>f(model), RecursiveContent::Branch(children)=>for child in children{