From e6c2e5418d67e9b4d12d2da74a81fc57e1147865 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 8 Feb 2026 22:44:37 +0100 Subject: feat(shaders): Standardize all shaders to use CommonUniforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define CommonUniforms struct with standard fields: - resolution: vec2 - aspect_ratio: f32 - time: f32 - beat: f32 - audio_intensity: f32 Updated 14 shaders to use CommonUniforms: - Replaced width/height with resolution - Unified intensity/audio_peak → audio_intensity - Moved effect-specific params to EffectParams struct - visual_debug.wgsl now uses GlobalUniforms.view_proj All shaders now have consistent uniform interface. Co-Authored-By: Claude Sonnet 4.5 --- assets/final/shaders/particle_compute.wgsl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'assets/final/shaders/particle_compute.wgsl') diff --git a/assets/final/shaders/particle_compute.wgsl b/assets/final/shaders/particle_compute.wgsl index a6c96db..f2f7ae3 100644 --- a/assets/final/shaders/particle_compute.wgsl +++ b/assets/final/shaders/particle_compute.wgsl @@ -5,15 +5,16 @@ struct Particle { color: vec4, }; -struct Uniforms { - audio_peak: f32, +struct CommonUniforms { + resolution: vec2, aspect_ratio: f32, time: f32, beat: f32, + audio_intensity: f32, }; @group(0) @binding(0) var particles: array; -@group(0) @binding(1) var uniforms: Uniforms; +@group(0) @binding(1) var uniforms: CommonUniforms; @compute @workgroup_size(64) fn main(@builtin(global_invocation_id) id: vec3) { @@ -24,11 +25,11 @@ fn main(@builtin(global_invocation_id) id: vec3) { var p = particles[i]; let new_pos = p.pos.xyz + p.vel.xyz * 0.016; p.pos = vec4(new_pos, p.pos.w); - p.vel.y = p.vel.y - 0.01 * (1.0 + uniforms.audio_peak * 5.0); + p.vel.y = p.vel.y - 0.01 * (1.0 + uniforms.audio_intensity * 5.0); p.rot.x = p.rot.x + p.rot.y * 0.016; if (p.pos.y < -1.5) { p.pos.y = 1.5; - p.pos.x = (f32(i % 100u) / 50.0) - 1.0 + (uniforms.audio_peak * 0.5); + p.pos.x = (f32(i % 100u) / 50.0) - 1.0 + (uniforms.audio_intensity * 0.5); p.vel.y = 0.0; } particles[i] = p; -- cgit v1.2.3