aabb list is no longer flat

This commit is contained in:
Quaternions 2024-02-06 22:44:38 -08:00
parent fc1e6581ec
commit cfbc486e12

View File

@ -42,11 +42,7 @@ impl<T:Copy+Eq+std::hash::Hash> BvhNode<T>{
} }
} }
pub fn generate_bvh<T:Copy+Eq+std::hash::Hash,F:Fn(usize)->T>(boxen:Vec<Aabb>,type_wrapper:F)->BvhNode<T>{ pub fn generate_bvh_node<T:Copy+Eq+std::hash::Hash>(boxen:Vec<(T,Aabb)>)->BvhNode<T>{
generate_bvh_node(boxen.into_iter().enumerate().map(|(i,b)|(type_wrapper(i),b)).collect())
}
fn generate_bvh_node<T:Copy+Eq+std::hash::Hash>(boxen:Vec<(T,Aabb)>)->BvhNode<T>{
let n=boxen.len(); let n=boxen.len();
if n<20{ if n<20{
let mut aabb=Aabb::default(); let mut aabb=Aabb::default();