From b9c2a0394343ff3586880d118b7d549b3e748cad Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 28 Feb 2026 11:50:13 +0100 Subject: 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 --- src/effects/flash.wgsl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/effects/flash.wgsl (limited to 'src/effects/flash.wgsl') diff --git a/src/effects/flash.wgsl b/src/effects/flash.wgsl new file mode 100644 index 0000000..379086e --- /dev/null +++ b/src/effects/flash.wgsl @@ -0,0 +1,27 @@ +// Flash shader for visual sync testing +// Pulses white on beat +#include "sequence_uniforms" + +@group(0) @binding(2) var uniforms: UniformsSequenceParams; + +struct VertexOutput { + @builtin(position) position: vec4f, + @location(0) uv: vec2f, +}; + +@vertex fn vs_main(@builtin(vertex_index) vid: u32) -> VertexOutput { + var out: VertexOutput; + let x = f32((vid & 1u) << 1u); + let y = f32((vid & 2u)); + out.position = vec4f(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); + out.uv = vec2f(x, y); + return out; +} + +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f { + // Strong flash on beat, fades quickly + let intensity = pow(1.0 - uniforms.beat_phase, 4.0); + // Add audio intensity for extra punch + let final_intensity = intensity * (1.0 + uniforms.audio_intensity * 0.5); + return vec4f(final_intensity, final_intensity, final_intensity, 1.0); +} -- cgit v1.2.3