summaryrefslogtreecommitdiff
path: root/src/gpu/gpu.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-01-28 10:26:12 +0100
committerskal <pascal.massimino@gmail.com>2026-01-28 10:26:12 +0100
commitf12b5ebc74825817df54677e261b92200bfac84a (patch)
tree29c1c938b3aabac5a3825e09d6af7c6db3afe570 /src/gpu/gpu.cc
parent68015c1e326f78afa0637b99a9e3f755086f557e (diff)
feat(visuals): Enhance colors and add background flashes
Improves the audio-visual synchronization by increasing peak amplification and adding dynamic background flashes. - src/gpu/gpu.cc: Updated fragment shader with more vibrant hue calculation and implemented reactive clear color for flashes. - src/main.cc: Increased peak multiplier to 150x and added non-linear boost for strong peaks.
Diffstat (limited to 'src/gpu/gpu.cc')
-rw-r--r--src/gpu/gpu.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc
index 43aef7c..1f2c7f8 100644
--- a/src/gpu/gpu.cc
+++ b/src/gpu/gpu.cc
@@ -129,10 +129,11 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<
@fragment
fn fs_main() -> @location(0) vec4<f32> {
- let hue = uniforms.audio_peak * 0.5;
- let r = sin(hue + 0.0) * 0.5 + 0.5;
- let g = sin(hue + 2.0) * 0.5 + 0.5;
- let b = sin(hue + 4.0) * 0.5 + 0.5;
+ // More vibrant hue: shift through colors based on peak
+ let h = uniforms.audio_peak * 2.0;
+ let r = sin(h + 0.0) * 0.5 + 0.5;
+ let g = sin(h + 2.0) * 0.5 + 0.5;
+ let b = sin(h + 4.0) * 0.5 + 0.5;
return vec4<f32>(r, g, b, 1.0);
}
)";
@@ -289,7 +290,10 @@ void gpu_draw(float audio_peak, float aspect_ratio) {
color_attachment.resolveTarget = nullptr;
color_attachment.loadOp = WGPULoadOp_Clear;
color_attachment.storeOp = WGPUStoreOp_Store;
- color_attachment.clearValue = {0.1, 0.2, 0.3, 1.0};
+
+ // Background flash based on peak
+ float flash = uniforms.audio_peak * 0.4f;
+ color_attachment.clearValue = {0.05 + flash, 0.1 + flash, 0.2 + flash, 1.0};
color_attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
WGPURenderPassDescriptor render_pass_desc = {};