fix different grid sizes

This commit is contained in:
zomseffen 2025-04-08 11:18:43 +02:00
parent a39cf62b0b
commit 4a81ae6440
4 changed files with 5 additions and 5 deletions

Binary file not shown.

View file

@ -175,9 +175,9 @@ void main() {
uint compound_start = 0;
// iterate over the compounds and find the work index inside of it
while (index > compounds[compound_start] * compounds[compound_start]) {
compound_start = compounds[compound_start + 2];
index -= compounds[compound_start] * compounds[compound_start];
output_offset += compounds[compound_start] * compounds[compound_start] * compounds[compound_start];
index -= compounds[compound_start] * compounds[compound_start];
compound_start = compounds[compound_start + 2];
}
// grid pos in the task
uint compound_grid_size = compounds[compound_start];
@ -307,7 +307,7 @@ void main() {
}
if (render) {
add_cube(gl_GlobalInvocationID.x * compound_grid_size + z, compound_scale, check_pos, color);
add_cube(output_offset + index * compound_grid_size + z, compound_scale, check_pos, color);
}
}

View file

@ -124,7 +124,7 @@ fn main() -> Result<()> {
},
WindowEvent::KeyboardInput { device_id, event, is_synthetic } => {
if event.logical_key == "w" {
app.cur_pos += app.view_direction * 0.1;
app.cur_pos += app.view_direction * 0.5;
}
if event.logical_key == "s" {
app.cur_pos -= app.view_direction * 0.1;

View file

@ -118,7 +118,7 @@ pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<(Poi
let tree_ref_two = Rc::new(RefCell::new(oct_tree2.clone()));
scene.oct_trees = vec![vec![vec![tree_ref_two.clone(), tree_ref_two.clone(), tree_ref_two.clone()], vec![tree_ref_two.clone(), tree_ref_one.clone(), tree_ref_two.clone()], vec![tree_ref_two.clone(), tree_ref_two.clone(), tree_ref_two.clone()]], vec![vec![tree_ref_two.clone(), tree_ref_two.clone(), tree_ref_two.clone()], vec![tree_ref_two.clone(), tree_ref_one.clone(), tree_ref_two.clone()], vec![tree_ref_two.clone(), tree_ref_two.clone(), tree_ref_two.clone()]]];
let mut comp = ShapeComposition::new(64);
let mut comp = ShapeComposition::new(128);
comp.included_shapes.push(Rc::new(RefCell::new(Sphere::new(Vector3 { x: 5.0 + grid_size as f32, y: 5.0 + grid_size as f32, z: 10.0 }, Vector3 { x: 0.0, y: 0.0, z: 0.0 }, 2.0, Vector3 { x: 0, y: 255, z: 0 }, 64, false))));
comp.included_shapes.push(Rc::new(RefCell::new(Sphere::new(Vector3 { x: 5.0 + grid_size as f32, y: 5.0 + grid_size as f32, z: 10.0 }, Vector3 { x: 0.0, y: 0.0, z: 0.0 }, 2.5, Vector3 { x: 255, y: 0, z: 0 }, 64, false))));
comp.excluded_shapes.push(Rc::new(RefCell::new(Sphere::new(Vector3 { x: 5.0 + grid_size as f32, y: 5.0 + grid_size as f32, z: 11.5 }, Vector3 { x: 0.0, y: 0.0, z: 0.0 }, 1.5, Vector3 { x: 0, y: 255, z: 0 }, 64, false))));