fix indexing of cubes

This commit is contained in:
zomseffen 2025-04-07 11:28:20 +02:00
parent 680039cdfa
commit 3f199ce4a6
4 changed files with 10 additions and 9 deletions

Binary file not shown.

View file

@ -26,7 +26,7 @@ layout(binding = 6) buffer Indices {
uint indices[];
};
layout (local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
layout (local_size_x = 16, local_size_y = 1, local_size_z = 1) in;
uvec4 unpack_color(uint val) {
// left most 8 bits first
@ -241,14 +241,9 @@ void main() {
}
if (render) {
add_cube(index * compound_grid_size + z, compound_scale, check_pos, color);
add_cube(gl_GlobalInvocationID.x * compound_grid_size + z, compound_scale, check_pos, color);
}
}
//add_cube(0, compound_scale, compound_pos + mid_offset, vec3(1.0, 0.0, 0.0));
//add_cube(1, compound_scale, compound_pos + vec3(float(compound_grid_size) * compound_scale, float(compound_grid_size) * compound_scale, float(compound_grid_size) * compound_scale) + mid_offset, vec3(1.0, 0.0, 0.0));
volumes[index] = compounds[index];
//volumes[index] = compounds[index];
}

View file

@ -70,7 +70,7 @@ pub unsafe fn create_command_buffers(device: &Device, data: &mut app_data::AppDa
&[data.descriptor_sets[i]],
&[]);
device.cmd_dispatch(*command_buffer, (data.compute_task_one_size as f64 / 256.0).ceil() as u32, 1, 1);
device.cmd_dispatch(*command_buffer, (data.compute_task_one_size as f64 / 16.0).ceil() as u32, 1, 1);
let buffer_memory_barrier_vertex = vk::BufferMemoryBarrier::builder()
.buffer(data.compute_out_cuboid_buffers[i])

View file

@ -124,6 +124,12 @@ pub fn generate_test_scene(scene: &mut Scene, data: &mut AppData) -> Result<(Poi
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))));
scene.volumetrics.push(Rc::new(RefCell::new(comp)));
let mut comp = ShapeComposition::new(64);
comp.included_shapes.push(Rc::new(RefCell::new(Sphere::new(Vector3 { x: 20.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: 20.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: 20.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))));
scene.volumetrics.push(Rc::new(RefCell::new(comp)));
Ok((cgmath::point3(5.0, 5.0, 10.0)))
}