common: bvh: empty not Default

This commit is contained in:
Quaternions 2025-02-06 10:25:03 -08:00
parent 72e0caa84a
commit 0c991715ab
2 changed files with 6 additions and 9 deletions
engine/physics/src
lib/common/src

@ -935,7 +935,7 @@ pub struct PhysicsData{
impl Default for PhysicsData{ impl Default for PhysicsData{
fn default()->Self{ fn default()->Self{
Self{ Self{
bvh:bvh::BvhNode::default(), bvh:bvh::BvhNode::empty(),
models:Default::default(), models:Default::default(),
modes:Default::default(), modes:Default::default(),
hitbox_mesh:StyleModifiers::default().calculate_mesh(), hitbox_mesh:StyleModifiers::default().calculate_mesh(),

@ -14,8 +14,8 @@ pub enum RecursiveContent<R,T>{
Branch(Vec<R>), Branch(Vec<R>),
Leaf(T), Leaf(T),
} }
impl<R,T> Default for RecursiveContent<R,T>{ impl<R,T> RecursiveContent<R,T>{
fn default()->Self{ pub fn empty()->Self{
Self::Branch(Vec::new()) Self::Branch(Vec::new())
} }
} }
@ -23,16 +23,13 @@ pub struct BvhNode<T>{
content:RecursiveContent<BvhNode<T>,T>, content:RecursiveContent<BvhNode<T>,T>,
aabb:Aabb, aabb:Aabb,
} }
impl<T> Default for BvhNode<T>{ impl<T> BvhNode<T>{
fn default()->Self{ pub fn empty()->Self{
Self{ Self{
content:Default::default(), content:RecursiveContent::empty(),
aabb:Aabb::default(), aabb:Aabb::default(),
} }
} }
}
impl<T> BvhNode<T>{
pub fn the_tester<F:FnMut(&T)>(&self,aabb:&Aabb,f:&mut F){ pub fn the_tester<F:FnMut(&T)>(&self,aabb:&Aabb,f:&mut F){
match &self.content{ match &self.content{
RecursiveContent::Leaf(model)=>f(model), RecursiveContent::Leaf(model)=>f(model),