forked from StrafesNET/strafe-project
common: bvh: empty not Default
This commit is contained in:
parent
72e0caa84a
commit
0c991715ab
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user