diff --git a/src/bvh.rs b/src/bvh.rs index 5235790..e4f0bf6 100644 --- a/src/bvh.rs +++ b/src/bvh.rs @@ -40,6 +40,14 @@ impl BvhNode{ }, } } + pub fn into_visitor(self,f:&mut F){ + match self.content{ + BvhNodeContent::Leaf(model)=>f(model), + BvhNodeContent::Branch(children)=>for child in children{ + child.into_visitor(f) + }, + } + } } pub fn generate_bvh(boxen:Vec<(T,Aabb)>)->BvhNode{