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{
fn default()->Self{
Self{
bvh:bvh::BvhNode::default(),
bvh:bvh::BvhNode::empty(),
models:Default::default(),
modes:Default::default(),
hitbox_mesh:StyleModifiers::default().calculate_mesh(),

@ -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),