From 4a81ae644088c0309d05c8ac8a9c52991c66b3f1 Mon Sep 17 00:00:00 2001 From: zomseffen <steffen@tom.bi> Date: Tue, 8 Apr 2025 11:18:43 +0200 Subject: [PATCH] fix different grid sizes --- shaders/compiled/rt_compute.spv | Bin 33268 -> 33284 bytes shaders/rt_compute.comp | 6 +++--- src/main.rs | 2 +- src/scene/generators.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/shaders/compiled/rt_compute.spv b/shaders/compiled/rt_compute.spv index c0e451b5c7634959a077e82cc2c88d265d0021e1..1cbfcfe558f3ecb8ab5d39926f5b0777a88cebbf 100644 GIT binary patch delta 1394 zcmZ8hOKTHR7`>CnBt>FF$3&$XjHTA1MpP)2qWDUa3L%uD^+`#?L?R?p(pFcJqS@$9 z?!v#|R%R{Og)997ZWXQ1sI^vGTlJjD+?ZtG_I~Gl=X>1m-gM=zr&jZXyq>;*5SrK` zLgLTk(2`&J^l;{bUx=ApC07zc_=Qh=>cI6j91yF(=gY-{RVkgGFBHs5cKU{ypA$Nw zSLL{F9HK%)w(F)<nyOfHFdJU*9@saF=B*|tALzzTM)*MGb0xEqo0_p^8G%~ziQYT- z3*Px@3;6?L9ri@tESqEHg4L*hROMQiTENgY>`0(ji~oR7hbN4cMsk+m$1UAxHE3K@ zEauXtWcy7e4B|ellUPo)%XP-_c+EJu7&J1hK(<rqZB;@;%nDDjR0VSX<2c@Umr-R# z)}T6!#!`q?RZ=)9$F&zeehSAM(7|i)b21z_D{-X!n2#Uxkz;knZ?xy@aR?@40tz<m zXI)u;^*eMSm)-$-1(+OVyYN@t$UTfBCW21S)U>W{XsO!+{ZH(i9M3l5VxEoMZgi*4 z5o`3Da0mwec11h{1BrPE1|G!G_v2)n_G0%j?~(VQIbq7SV&{)RVZI#x7+P`N?l-bp z^%Sy1k?t%q4Py;KdItM(q~U0ju<28H6!u{(6_<jo;^<SlG;I26xEAIagUwvzmFApR z$iLe%{sg!MIUd=rC1f%3usQ&I$BnxPdlKsc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hjK7;*OEg%Km4kL@%34EW6P@)$G6hx8S`^m4pN#wxc8|Am*sf4G<+kie_tBl!kD kf|boE%HoP#Ne=XVhu65hHN?c;;gNF-%&j?z(YHhY09Tp9`v3p{ diff --git a/shaders/rt_compute.comp b/shaders/rt_compute.comp index 13f9361..f1854b4 100644 --- a/shaders/rt_compute.comp +++ b/shaders/rt_compute.comp @@ -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); } } diff --git a/src/main.rs b/src/main.rs index 9b36399..71bae1b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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; diff --git a/src/scene/generators.rs b/src/scene/generators.rs index 3aa7c64..b86a385 100644 --- a/src/scene/generators.rs +++ b/src/scene/generators.rs @@ -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))));