From 547e96ab9d22e1bacec2fc08454519560caca919 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Thu, 27 Mar 2025 20:06:49 +0100 Subject: init js --- src/spatial/octtree.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/spatial/octtree.rs') diff --git a/src/spatial/octtree.rs b/src/spatial/octtree.rs index f8919f5..e86b471 100644 --- a/src/spatial/octtree.rs +++ b/src/spatial/octtree.rs @@ -19,6 +19,7 @@ impl Octtree { } } } +const MAX_CHILDREN: usize = 1024; impl SpatialTree for Octtree { fn insert(&mut self, pos: DVec3, id: NodeID) { if let Some(c) = &mut self.children { @@ -28,7 +29,7 @@ impl SpatialTree for Octtree { c[x][y][z].insert(pos, id); } else { self.elems.push((pos, id)); - if self.elems.len() > 64 { + if self.elems.len() > MAX_CHILDREN { self.children = Some(Box::new([-1., 1.].map(|x| { [-1., 1.].map(|y| { [-1., 1.].map(|z| Octtree { -- cgit v1.2.3-70-g09d2