diff --git a/engine/physics/src/physics.rs b/engine/physics/src/physics.rs index ebfd3a0..b27ccd9 100644 --- a/engine/physics/src/physics.rs +++ b/engine/physics/src/physics.rs @@ -935,7 +935,7 @@ pub struct PhysicsData{ impl Default for PhysicsData{ fn default()->Self{ Self{ - bvh:bvh::BvhNode::default(), + bvh:bvh::BvhNode::empty(), models:Default::default(), modes:Default::default(), hitbox_mesh:StyleModifiers::default().calculate_mesh(), diff --git a/lib/common/src/bvh.rs b/lib/common/src/bvh.rs index 05b7cf3..4328bf3 100644 --- a/lib/common/src/bvh.rs +++ b/lib/common/src/bvh.rs @@ -14,8 +14,8 @@ pub enum RecursiveContent<R,T>{ Branch(Vec<R>), Leaf(T), } -impl<R,T> Default for RecursiveContent<R,T>{ - fn default()->Self{ +impl<R,T> RecursiveContent<R,T>{ + pub fn empty()->Self{ Self::Branch(Vec::new()) } } @@ -23,16 +23,13 @@ pub struct BvhNode<T>{ content:RecursiveContent<BvhNode<T>,T>, aabb:Aabb, } -impl<T> Default for BvhNode<T>{ - fn default()->Self{ +impl<T> BvhNode<T>{ + pub fn empty()->Self{ Self{ - content:Default::default(), + content:RecursiveContent::empty(), aabb:Aabb::default(), } } -} - -impl<T> BvhNode<T>{ pub fn the_tester<F:FnMut(&T)>(&self,aabb:&Aabb,f:&mut F){ match &self.content{ RecursiveContent::Leaf(model)=>f(model),