summaryrefslogtreecommitdiff
path: root/src/effects/vignette.wgsl
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-28 11:50:13 +0100
committerskal <pascal.massimino@gmail.com>2026-02-28 11:50:13 +0100
commitb9c2a0394343ff3586880d118b7d549b3e748cad (patch)
treebfc437f805c6b7344951107df8c7cd69a7ec421f /src/effects/vignette.wgsl
parent21d8a0b86ceda19812e9869a72e49c56c90ae3da (diff)
refactor(effects): co-locate effect WGSL shaders with their .h/.cc in src/effects/
Move 13 effect-specific shaders from workspaces/main/shaders/ to src/effects/ so each effect's .h, .cc, and .wgsl are together. Update assets.txt paths in both main and test workspaces. Update EFFECT_WORKFLOW.md to reflect new location. Shared/reusable snippets remain in src/shaders/. handoff(Gemini): shaders moved; src/effects/ now has .h, .cc, and .wgsl per effect. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/effects/vignette.wgsl')
-rw-r--r--src/effects/vignette.wgsl24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/effects/vignette.wgsl b/src/effects/vignette.wgsl
new file mode 100644
index 0000000..9b98ec9
--- /dev/null
+++ b/src/effects/vignette.wgsl
@@ -0,0 +1,24 @@
+@group(0) @binding(0) var input_sampler: sampler;
+@group(0) @binding(1) var input_tex: texture_2d<f32>;
+#include "common_uniforms"
+
+struct VignetteParams {
+ radius: f32,
+ softness: f32,
+};
+
+@group(0) @binding(2) var<uniform> common_uniforms: CommonUniforms;
+@group(0) @binding(3) var<uniform> params: VignetteParams;
+
+#include "render/fullscreen_vs"
+
+@fragment
+fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f {
+ let uv = pos.xy / common_uniforms.resolution;
+ let color = textureSample(input_tex, input_sampler, uv);
+
+ let d = distance(uv, vec2f(0.5, 0.5));
+ let vignette = smoothstep(params.radius, params.radius - params.softness, d);
+
+ return vec4f(color.rgb * mix(1.0, vignette, common_uniforms.audio_intensity), color.a);
+} \ No newline at end of file