summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.md1
-rw-r--r--src/gpu/effects/shaders.cc4
2 files changed, 5 insertions, 0 deletions
diff --git a/TODO.md b/TODO.md
index 6f259e1..30dda64 100644
--- a/TODO.md
+++ b/TODO.md
@@ -19,6 +19,7 @@ This file tracks prioritized tasks with detailed attack plans.
## Priority 3: Shader Optimization (Task #21)
**Goal:** Improve GPU performance and reduce shader source bloat.
- [ ] **Attack Plan - Normal Factorization:** Create a standard WGSL helper for normal calculation to avoid duplicate code in every effect.
+- [ ] **Tri-planar or bi-planar mapping**: see https://iquilezles.org/articles/biplanar/ for instance
## Future Goals
- [ ] **Task #5: Spectrogram Editor**: Web-based visual tool for extreme audio compression.
diff --git a/src/gpu/effects/shaders.cc b/src/gpu/effects/shaders.cc
index 6d86d2b..746392a 100644
--- a/src/gpu/effects/shaders.cc
+++ b/src/gpu/effects/shaders.cc
@@ -40,6 +40,8 @@ fn sdTorus(p: vec3<f32>, t: vec2<f32>) -> f32 {
fn sdPlane(p: vec3<f32>, n: vec3<f32>, h: f32) -> f32 {
return dot(p, n) + h;
}
+)");
+
sc.RegisterSnippet("lighting", R"(
fn get_normal_basic(p: vec3<f32>, obj_type: f32) -> vec3<f32> {
if (obj_type == 1.0) { return normalize(p); }
@@ -64,6 +66,8 @@ fn calc_shadow(ro: vec3<f32>, rd: vec3<f32>, tmin: f32, tmax: f32, skip_idx: u32
}
return clamp(res, 0.0, 1.0);
}
+)");
+
sc.RegisterSnippet("ray_box", R"(
struct RayBounds {
t_entry: f32,