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_spray_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_spray_compute.wgsl')
| -rw-r--r-- | assets/final/shaders/particle_spray_compute.wgsl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/assets/final/shaders/particle_spray_compute.wgsl b/assets/final/shaders/particle_spray_compute.wgsl index 55fa8e9..f1a4d43 100644 --- a/assets/final/shaders/particle_spray_compute.wgsl +++ b/assets/final/shaders/particle_spray_compute.wgsl @@ -5,15 +5,16 @@ struct Particle { color: vec4<f32>, }; -struct Uniforms { - intensity: 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; fn hash(p: f32) -> f32 { return fract(sin(p) * 43758.5453); @@ -30,7 +31,7 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) { let r = hash(f32(i) + uniforms.time); let angle = r * 6.28318; p.pos = vec4<f32>(0.0, 0.0, 0.0, 1.0); - p.vel = vec4<f32>(cos(angle), sin(angle), 0.0, 0.0) * (0.5 + hash(r) * 0.5) * (1.0 + uniforms.intensity * 2.0); + p.vel = vec4<f32>(cos(angle), sin(angle), 0.0, 0.0) * (0.5 + hash(r) * 0.5) * (1.0 + uniforms.audio_intensity * 2.0); p.color = vec4<f32>(hash(r + 0.1), hash(r + 0.2), 1.0, 1.0); } let new_pos = p.pos.xyz + p.vel.xyz * 0.016; |
