summaryrefslogtreecommitdiff
path: root/workspaces/test/shaders
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-16 16:16:13 +0100
committerskal <pascal.massimino@gmail.com>2026-02-16 16:16:13 +0100
commita3583f4c704bb14e02f49cade6996e215d0ee6b4 (patch)
tree340258c6791ac56ce54bc144befe83af4b0c5fea /workspaces/test/shaders
parent6ac4fa8fb8c045232575036f4a140b9a0ec1995a (diff)
feat: Add FlashEffect for audio/visual sync testing
- FlashEffect: Beat-synchronized white flash using ShaderComposer - Loads shader from assets (flash.wgsl) with sequence_uniforms include - Uses pow(1.0 - beat_phase, 4.0) for sharp flash at beat start - Updated test_demo.seq to use FlashEffect (was HeptagonEffect) - Added FlashEffect to test suite (test_demo_effects.cc) - Made cnn_test conditional on main workspace (fixes build error) - Flash intensity: 1.0 at beat start, fades to 0.0 by beat end Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'workspaces/test/shaders')
-rw-r--r--workspaces/test/shaders/flash.wgsl27
1 files changed, 27 insertions, 0 deletions
diff --git a/workspaces/test/shaders/flash.wgsl b/workspaces/test/shaders/flash.wgsl
new file mode 100644
index 0000000..8f8c64c
--- /dev/null
+++ b/workspaces/test/shaders/flash.wgsl
@@ -0,0 +1,27 @@
+// Flash shader for visual sync testing
+// Pulses white on beat
+#include "sequence_uniforms"
+
+@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams;
+
+struct VertexOutput {
+ @builtin(position) position: vec4<f32>,
+ @location(0) uv: vec2<f32>,
+};
+
+@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 = vec4<f32>(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0);
+ out.uv = vec2<f32>(x, y);
+ return out;
+}
+
+@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
+ // 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 vec4<f32>(final_intensity, final_intensity, final_intensity, 1.0);
+}