summaryrefslogtreecommitdiff
path: root/assets/final/shaders/math/common_utils.wgsl
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/final/shaders/math/common_utils.wgsl
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/final/shaders/math/common_utils.wgsl')
-rw-r--r--assets/final/shaders/math/common_utils.wgsl36
1 files changed, 0 insertions, 36 deletions
diff --git a/assets/final/shaders/math/common_utils.wgsl b/assets/final/shaders/math/common_utils.wgsl
deleted file mode 100644
index 7131216..0000000
--- a/assets/final/shaders/math/common_utils.wgsl
+++ /dev/null
@@ -1,36 +0,0 @@
-// Common utility functions for WGSL shaders.
-// Reduces duplication across renderer_3d, mesh_render, etc.
-
-// Constants
-const PI: f32 = 3.14159265359;
-const TAU: f32 = 6.28318530718;
-
-// Transform normal from local to world space using inverse model matrix
-fn transform_normal(inv_model: mat4x4<f32>, normal_local: vec3<f32>) -> vec3<f32> {
- let normal_matrix = mat3x3<f32>(inv_model[0].xyz, inv_model[1].xyz, inv_model[2].xyz);
- return normalize(normal_matrix * normal_local);
-}
-
-// Spherical UV mapping (sphere or any radial surface)
-// Returns UV in [0,1] range
-fn spherical_uv(p: vec3<f32>) -> vec2<f32> {
- let u = atan2(p.x, p.z) / TAU + 0.5;
- let v = acos(clamp(p.y / length(p), -1.0, 1.0)) / PI;
- return vec2<f32>(u, v);
-}
-
-// Spherical UV from direction vector (for skybox, etc.)
-fn spherical_uv_from_dir(dir: vec3<f32>) -> vec2<f32> {
- let u = atan2(dir.z, dir.x) / TAU + 0.5;
- let v = asin(clamp(dir.y, -1.0, 1.0)) / PI + 0.5;
- return vec2<f32>(u, v);
-}
-
-// Grid pattern for procedural texturing (checkerboard-like)
-fn grid_pattern(uv: vec2<f32>) -> f32 {
- let grid = 0.5 + 0.5 * sin(uv.x * PI) * sin(uv.y * PI);
- return smoothstep(0.45, 0.55, grid);
-}
-
-// NOTE: calc_sdf_normal_bumped() removed - too specialized, depends on get_dist()
-// from scene_query snippets. Keep bump mapping code inline in shaders that use it.