diff options
Diffstat (limited to 'src/spatial/octtree.rs')
-rw-r--r-- | src/spatial/octtree.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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 { |