start of second test generator. revealed issue with neighbor linkage overwriting

This commit is contained in:
zomseffen 2025-02-20 16:48:20 +01:00
parent d65a38200c
commit 5353f28acd
6 changed files with 112 additions and 19 deletions
src/scene

View file

@ -7,7 +7,7 @@ use crate::primitives::cube::Cube;
extern crate rand;
pub const CHUNK_SIZE_EXPONENT: u32 = 4;
pub const CHUNK_SIZE_EXPONENT: u32 = 6;
pub const CHUNK_SIZE: usize = (2 as usize).pow(CHUNK_SIZE_EXPONENT);
pub const MAX_TREE_DEPTH: usize = CHUNK_SIZE_EXPONENT as usize - 2;
pub const MIN_CHUNK_SIZE: usize = CHUNK_SIZE / (2 as usize).pow(MAX_TREE_DEPTH as u32);
@ -191,6 +191,9 @@ impl<T: Clone> OctTree<T> {
}
}
else {
if let Some(_) = self.blocks[z * MIN_CHUNK_SIZE * MIN_CHUNK_SIZE + y * MIN_CHUNK_SIZE + x] {
println!("overwriting block!")
}
self.blocks[z * MIN_CHUNK_SIZE * MIN_CHUNK_SIZE + y * MIN_CHUNK_SIZE + x] = Some(element);
}
}