summaryrefslogtreecommitdiff
path: root/assets/common/shaders/render
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-13 08:21:34 +0100
committerskal <pascal.massimino@gmail.com>2026-02-13 08:21:34 +0100
commiteb15703a3f87e4eadc8839b06de12b9c6ec54023 (patch)
tree06dcbb3e40df2f08b433927c96335e104b4d0aa7 /assets/common/shaders/render
parent10673f00dfece584ba81d581b69c9ba706a5ea5a (diff)
Refactor: Reorganize workspaces and remove assets/ directory
Workspace structure now: - workspaces/{main,test}/obj/ (3D models) - workspaces/{main,test}/shaders/ (WGSL shaders) - workspaces/{main,test}/music/ (audio samples) Changes: - Moved workspaces/*/assets/music/ → workspaces/*/music/ - Updated assets.txt paths (assets/music/ → music/) - Moved test_demo.{seq,track} to tools/ - Moved assets/originals/ → tools/originals/ - Removed assets/common/ (legacy, duplicated in workspaces) - Removed assets/final/ (legacy, superseded by workspaces) - Updated hot-reload paths in main.cc - Updated CMake references for test_demo and validation - Updated gen_spectrograms.sh paths handoff(Claude): Workspace reorganization complete
Diffstat (limited to 'assets/common/shaders/render')
-rw-r--r--assets/common/shaders/render/lighting_utils.wgsl6
-rw-r--r--assets/common/shaders/render/scene_query_bvh.wgsl67
-rw-r--r--assets/common/shaders/render/scene_query_linear.wgsl56
-rw-r--r--assets/common/shaders/render/shadows.wgsl13
4 files changed, 0 insertions, 142 deletions
diff --git a/assets/common/shaders/render/lighting_utils.wgsl b/assets/common/shaders/render/lighting_utils.wgsl
deleted file mode 100644
index d2fd2e2..0000000
--- a/assets/common/shaders/render/lighting_utils.wgsl
+++ /dev/null
@@ -1,6 +0,0 @@
-fn calculate_lighting(color: vec3<f32>, normal: vec3<f32>, pos: vec3<f32>, shadow: f32) -> vec3<f32> {
- let light_dir = normalize(vec3<f32>(1.0, 1.0, 1.0));
- let diffuse = max(dot(normal, light_dir), 0.0);
- let lighting = diffuse * (0.1 + 0.9 * shadow) + 0.1; // Ambient + Shadowed Diffuse
- return color * lighting;
-}
diff --git a/assets/common/shaders/render/scene_query_bvh.wgsl b/assets/common/shaders/render/scene_query_bvh.wgsl
deleted file mode 100644
index 3e6f895..0000000
--- a/assets/common/shaders/render/scene_query_bvh.wgsl
+++ /dev/null
@@ -1,67 +0,0 @@
-#include "math/sdf_shapes"
-#include "math/sdf_utils"
-
-struct BVHNode {
- min: vec3<f32>,
- left_idx: i32,
- max: vec3<f32>,
- obj_idx_or_right: i32,
-};
-
-@group(0) @binding(2) var<storage, read> bvh_nodes: array<BVHNode>;
-
-fn get_dist(p: vec3<f32>, obj_params: vec4<f32>) -> f32 {
- let obj_type = obj_params.x;
- if (obj_type == 1.0) { return length(p) - 1.0; } // Unit Sphere
- if (obj_type == 2.0) { return sdBox(p, vec3<f32>(1.0)); } // Unit Box
- if (obj_type == 3.0) { return sdTorus(p, vec2<f32>(1.0, 0.4)); } // Unit Torus
- if (obj_type == 4.0) { return sdPlane(p, vec3<f32>(0.0, 1.0, 0.0), 0.0); }
- if (obj_type == 5.0) { return sdBox(p, obj_params.yzw); } // MESH AABB
- return 100.0;
-}
-
-fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 {
- var d = 1000.0;
- var stack: array<i32, 32>;
- var stack_ptr = 0;
-
- if (arrayLength(&bvh_nodes) > 0u) {
- stack[stack_ptr] = 0;
- stack_ptr++;
- }
-
- while (stack_ptr > 0) {
- stack_ptr--;
- let node_idx = stack[stack_ptr];
- let node = bvh_nodes[node_idx];
-
- if (aabb_sdf(p, node.min, node.max) < d) {
- if (node.left_idx < 0) { // Leaf
- let obj_idx = u32(node.obj_idx_or_right);
- if (obj_idx == skip_idx) { continue; }
- let obj = object_data.objects[obj_idx];
- let q = (obj.inv_model * vec4<f32>(p, 1.0)).xyz;
-
- // Extract scale factors from the model matrix
- let sx = length(obj.model[0].xyz);
- let sy = length(obj.model[1].xyz);
- let sz = length(obj.model[2].xyz);
-
- var s = min(sx, min(sy, sz));
- if (obj.params.x == 4.0) {
- s = sy; // Plane normal is (0,1,0) in local space
- }
-
- d = min(d, get_dist(q, obj.params) * s);
- } else { // Internal
- if (stack_ptr < 31) {
- stack[stack_ptr] = node.left_idx;
- stack_ptr++;
- stack[stack_ptr] = node.obj_idx_or_right;
- stack_ptr++;
- }
- }
- }
- }
- return d;
-}
diff --git a/assets/common/shaders/render/scene_query_linear.wgsl b/assets/common/shaders/render/scene_query_linear.wgsl
deleted file mode 100644
index 0497a40..0000000
--- a/assets/common/shaders/render/scene_query_linear.wgsl
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "math/sdf_shapes"
-#include "math/sdf_utils"
-
-fn get_dist(p: vec3<f32>, obj_params: vec4<f32>) -> f32 {
- let obj_type = obj_params.x;
- if (obj_type == 1.0) { return length(p) - 1.0; } // Unit Sphere
- if (obj_type == 2.0) { return sdBox(p, vec3<f32>(1.0)); } // Unit Box
- if (obj_type == 3.0) { return sdTorus(p, vec2<f32>(1.0, 0.4)); } // Unit Torus
- if (obj_type == 4.0) { return sdPlane(p, vec3<f32>(0.0, 1.0, 0.0), 0.0); }
- if (obj_type == 5.0) { return sdBox(p, obj_params.yzw); } // MESH AABB
- return 100.0;
-}
-
-fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 {
-
- var d = 1000.0;
-
- let num_objects = arrayLength(&object_data.objects);
-
- for (var i = 0u; i < num_objects; i++) {
-
- if (i == skip_idx) { continue; }
-
- let obj = object_data.objects[i];
-
- let q = (obj.inv_model * vec4<f32>(p, 1.0)).xyz;
-
-
-
- // Extract scale factors from the model matrix
-
- let sx = length(obj.model[0].xyz);
-
- let sy = length(obj.model[1].xyz);
-
- let sz = length(obj.model[2].xyz);
-
-
-
- var s = min(sx, min(sy, sz));
-
- if (obj.params.x == 4.0) {
-
- s = sy; // Plane normal is (0,1,0) in local space
-
- }
-
-
-
- d = min(d, get_dist(q, obj.params) * s);
-
- }
-
- return d;
-
-}
diff --git a/assets/common/shaders/render/shadows.wgsl b/assets/common/shaders/render/shadows.wgsl
deleted file mode 100644
index 7cba089..0000000
--- a/assets/common/shaders/render/shadows.wgsl
+++ /dev/null
@@ -1,13 +0,0 @@
-fn calc_shadow(ro: vec3<f32>, rd: vec3<f32>, tmin: f32, tmax: f32, skip_idx: u32) -> f32 {
- var res = 1.0;
- var t = tmin;
- if (t < 0.05) { t = 0.05; }
- for (var i = 0; i < 32; i = i + 1) {
- let h = map_scene(ro + rd * t, skip_idx);
- if (h < 0.001) { return 0.0; }
- res = min(res, 16.0 * h / t);
- t = t + clamp(h, 0.02, 0.4);
- if (t > tmax) { break; }
- }
- return clamp(res, 0.0, 1.0);
-}