recursive reflection for nontransparnt elements

This commit is contained in:
zomseffen 2025-02-05 16:50:57 +01:00
parent ffbba3be19
commit dc66ae4b3d
5 changed files with 162 additions and 101 deletions

View file

@ -66,9 +66,12 @@ impl EmptyVolume {
let start_time = Instant::now();
// iterate over all block positions in the oct tree
let mut check_its = 0;
for x_index in 0..tree.size {
for y_index in 0..tree.size {
for z_index in 0..tree.size {
let mut x_index = 0;
while x_index < tree.size {
let mut y_index = 0;
while y_index < tree.size {
let mut z_index = 0;
while z_index < tree.size {
// check if there is a block at that position
let query_result = tree.test_element(x_index, y_index, z_index);
let mut transparent = false;
@ -86,6 +89,7 @@ impl EmptyVolume {
for volume in &volumes {
if volume.borrow().contains(&Vector3{x: x_index, y: y_index, z: z_index}) {
contained = true;
z_index = volume.borrow().size_z + volume.borrow().position.z;
break;
}
}
@ -479,9 +483,12 @@ impl EmptyVolume {
println!("new volume done");
//push to the list
volumes.push(reference);
}
}
z_index += 1
}
y_index += 1;
}
x_index += 1;
}
println!("Did {} oct tree checks!", check_its);
println!("add the neighbor linkage for all the volumes of the oct tree");