diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-08 22:44:37 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-08 22:44:37 +0100 |
| commit | e6c2e5418d67e9b4d12d2da74a81fc57e1147865 (patch) | |
| tree | b5879186fb6717b59a62a4e341425fea3d4e398f /assets/final/shaders/particle_compute.wgsl | |
| parent | 1b89a26a750cc32725564a0c5186a437f372fd93 (diff) | |
feat(shaders): Standardize all shaders to use CommonUniforms
Define CommonUniforms struct with standard fields:
- resolution: vec2<f32>
- 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 <noreply@anthropic.com>
Diffstat (limited to 'assets/final/shaders/particle_compute.wgsl')
| -rw-r--r-- | assets/final/shaders/particle_compute.wgsl | 11 |
1 files changed, 6 insertions, 5 deletions
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<f32>, }; -struct Uniforms { - audio_peak: f32, +struct CommonUniforms { + resolution: vec2<f32>, aspect_ratio: f32, time: f32, beat: f32, + audio_intensity: f32, }; @group(0) @binding(0) var<storage, read_write> particles: array<Particle>; -@group(0) @binding(1) var<uniform> uniforms: Uniforms; +@group(0) @binding(1) var<uniform> uniforms: CommonUniforms; @compute @workgroup_size(64) fn main(@builtin(global_invocation_id) id: vec3<u32>) { @@ -24,11 +25,11 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) { var p = particles[i]; let new_pos = p.pos.xyz + p.vel.xyz * 0.016; p.pos = vec4<f32>(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; |
