diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-16 10:00:30 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-16 10:00:30 +0100 |
| commit | a126caf9e52b8f7c5be8e09b303e741aa9a410cb (patch) | |
| tree | 12a74c3dfc4ca0eba5807a323564118713b957a8 /workspaces/main/shaders/particle_compute_v2.wgsl | |
| parent | ce246924ac12da5639cce049c7bb2e29de7ed637 (diff) | |
feat(sequence): port particles_effect to v2
- Add ParticlesEffectV2 with compute + render passes
- Create particle_compute_v2.wgsl and particle_render_v2.wgsl
- Use UniformsSequenceParams for beat-synchronized particles
- Update timeline_v2.seq particles sequence (simplified 2-effect chain)
- Add shader exports to shaders.{h,cc}
- All 36 tests passing
handoff(Claude): Particles v2 complete, rotating_cube next
Diffstat (limited to 'workspaces/main/shaders/particle_compute_v2.wgsl')
| -rw-r--r-- | workspaces/main/shaders/particle_compute_v2.wgsl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/workspaces/main/shaders/particle_compute_v2.wgsl b/workspaces/main/shaders/particle_compute_v2.wgsl new file mode 100644 index 0000000..3683826 --- /dev/null +++ b/workspaces/main/shaders/particle_compute_v2.wgsl @@ -0,0 +1,31 @@ +// Particle simulation (compute shader) - V2 +struct Particle { + pos: vec4<f32>, + vel: vec4<f32>, + rot: vec4<f32>, + color: vec4<f32>, +}; + +#include "sequence_v2_uniforms" + +@group(0) @binding(0) var<storage, read_write> particles: array<Particle>; +@group(0) @binding(1) var<uniform> uniforms: UniformsSequenceParams; + +@compute @workgroup_size(64) +fn main(@builtin(global_invocation_id) id: vec3<u32>) { + let i = id.x; + if (i >= arrayLength(&particles)) { + return; + } + 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_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_intensity * 0.5); + p.vel.y = 0.0; + } + particles[i] = p; +} |
