diff options
| -rw-r--r-- | assets/demo.seq | 33 | ||||
| -rw-r--r-- | assets/final/shaders/particle_render.wgsl | 19 | ||||
| -rw-r--r-- | src/generated/assets_data.cc | 190 | ||||
| -rw-r--r-- | src/generated/timeline.cc | 33 | ||||
| -rw-r--r-- | src/gpu/gpu.cc | 18 |
5 files changed, 187 insertions, 106 deletions
diff --git a/assets/demo.seq b/assets/demo.seq index b30dd68..79872d3 100644 --- a/assets/demo.seq +++ b/assets/demo.seq @@ -33,8 +33,9 @@ SEQUENCE 4b 0 EFFECT + FlashEffect 0.0 0.2 # Priority 0 (was 4, now contiguous) SEQUENCE 6b 1 - EFFECT + ParticlesEffect 0 4 # Priority 0 - EFFECT = GaussianBlurEffect 0 8 # Priority 0 (same layer) + EFFECT + ParticleSprayEffect 0 4 # Priority 0 (spray particles) + EFFECT + ParticlesEffect 0 4 # Priority 1 + EFFECT = GaussianBlurEffect 0 8 # Priority 1 (same layer) SEQUENCE 7b 0 EFFECT + HeptagonEffect 0.0 .2 # Priority 0 @@ -52,7 +53,8 @@ SEQUENCE 8b 3 SEQUENCE 12b 2 EFFECT - FlashCubeEffect .2 3 # Priority -1 (background) EFFECT + HeptagonEffect 0 4 # Priority 0 - EFFECT + ParticlesEffect 0 4 # Priority 1 + EFFECT + ParticleSprayEffect 0 4 # Priority 1 (spray particles) + EFFECT + ParticlesEffect 0 4 # Priority 2 SEQUENCE 15b 2 EFFECT - FlashCubeEffect .2 3 # Priority -1 (background) @@ -67,18 +69,20 @@ SEQUENCE 16b 10 SEQUENCE 17b 2 EFFECT + ThemeModulationEffect 0 4 # Priority 0 EFFECT + HeptagonEffect 0.2 2.0 # Priority 1 - EFFECT = ParticlesEffect 0 4 # Priority 1 (same layer) - EFFECT + Hybrid3DEffect 0 4 # Priority 2 - EFFECT + GaussianBlurEffect 0 8 # Priority 3 - EFFECT + ChromaAberrationEffect 0 6 # Priority 4 + EFFECT + ParticleSprayEffect 0 4 # Priority 2 (spray particles) + EFFECT = ParticlesEffect 0 4 # Priority 2 (same layer) + EFFECT + Hybrid3DEffect 0 4 # Priority 3 + EFFECT + GaussianBlurEffect 0 8 # Priority 4 + EFFECT + ChromaAberrationEffect 0 6 # Priority 5 SEQUENCE 24b 1 EFFECT + ThemeModulationEffect 0 8 # Priority 0 EFFECT + HeptagonEffect 0.2 2.0 # Priority 1 - EFFECT + Hybrid3DEffect 0 20 # Priority 2 - EFFECT + GaussianBlurEffect 0 8 # Priority 3 - EFFECT + ChromaAberrationEffect 0 10 # Priority 4 - EFFECT + SolarizeEffect 0 10 # Priority 5 + EFFECT + ParticleSprayEffect 0 8 # Priority 2 (spray particles - longer duration) + EFFECT + Hybrid3DEffect 0 20 # Priority 3 + EFFECT + GaussianBlurEffect 0 8 # Priority 4 + EFFECT + ChromaAberrationEffect 0 10 # Priority 5 + EFFECT + SolarizeEffect 0 10 # Priority 6 SEQUENCE 32b 0 EFFECT + ThemeModulationEffect 0 4 # Priority 0 @@ -96,9 +100,10 @@ SEQUENCE 56b 0 EFFECT + ThemeModulationEffect 0 8 # Priority 0 EFFECT = HeptagonEffect 0.2 2.0 # Priority 0 (same layer) EFFECT + Hybrid3DEffect 0 4 # Priority 1 - EFFECT + HeptagonEffect 0 16 # Priority 2 - EFFECT + ChromaAberrationEffect 0 16 # Priority 3 - EFFECT + GaussianBlurEffect 0 8 # Priority 4 + EFFECT + ParticleSprayEffect 0 8 # Priority 2 (spray particles) + EFFECT + HeptagonEffect 0 16 # Priority 3 + EFFECT + ChromaAberrationEffect 0 16 # Priority 4 + EFFECT + GaussianBlurEffect 0 8 # Priority 5 SEQUENCE 62b 0 EFFECT + ThemeModulationEffect 0 3 # Priority 0 diff --git a/assets/final/shaders/particle_render.wgsl b/assets/final/shaders/particle_render.wgsl index 6f115ec..6a955f0 100644 --- a/assets/final/shaders/particle_render.wgsl +++ b/assets/final/shaders/particle_render.wgsl @@ -18,6 +18,7 @@ struct Uniforms { struct VSOut { @builtin(position) pos: vec4<f32>, @location(0) color: vec4<f32>, + @location(1) uv: vec2<f32>, }; @vertex fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VSOut { @@ -36,9 +37,21 @@ struct VSOut { let s = sin(p.rot.x); let rotated_offset = vec2<f32>(offset.x * c - offset.y * s, offset.x * s + offset.y * c); let pos = vec2<f32>(p.pos.x + rotated_offset.x * size / uniforms.aspect_ratio, p.pos.y + rotated_offset.y * size); - return VSOut(vec4<f32>(pos, 0.0, 1.0), p.color * (0.5 + 0.5 * uniforms.audio_peak)); + + // Fade based on lifetime (p.pos.w goes from 1.0 to 0.0) + let lifetime_fade = p.pos.w; + let color_with_fade = vec4<f32>(p.color.rgb * (0.5 + 0.5 * uniforms.audio_peak), p.color.a * lifetime_fade); + + return VSOut(vec4<f32>(pos, 0.0, 1.0), color_with_fade, offset); } -@fragment fn fs_main(@location(0) color: vec4<f32>) -> @location(0) vec4<f32> { - return color; +@fragment fn fs_main(@location(0) color: vec4<f32>, @location(1) uv: vec2<f32>) -> @location(0) vec4<f32> { + // Calculate distance from center for circular shape + let dist = length(uv); + + // Smooth circular falloff (1.0 at center, 0.0 at edge) + let circle_alpha = smoothstep(1.0, 0.5, dist); + + // Apply circular fade to alpha channel + return vec4<f32>(color.rgb, color.a * circle_alpha); } diff --git a/src/generated/assets_data.cc b/src/generated/assets_data.cc index 3498e18..1ad54a9 100644 --- a/src/generated/assets_data.cc +++ b/src/generated/assets_data.cc @@ -370328,7 +370328,7 @@ alignas(16) static const uint8_t ASSET_DATA_SHADER_PARTICLE_COMPUTE[] = { 0x20, 0x20, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x5b, 0x69, 0x5d, 0x20, 0x3d, 0x20, 0x70, 0x3b, 0x0a, 0x7d, 0x0a, 0x00 }; -const size_t ASSET_SIZE_SHADER_PARTICLE_RENDER = 1296; +const size_t ASSET_SIZE_SHADER_PARTICLE_RENDER = 1825; alignas(16) static const uint8_t ASSET_DATA_SHADER_PARTICLE_RENDER[] = { 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70, 0x6f, @@ -370364,81 +370364,125 @@ alignas(16) static const uint8_t ASSET_DATA_SHADER_PARTICLE_RENDER[] = { 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x30, 0x29, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x76, 0x65, 0x63, 0x34, 0x3c, - 0x66, 0x33, 0x32, 0x3e, 0x2c, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x40, 0x76, - 0x65, 0x72, 0x74, 0x65, 0x78, 0x20, 0x66, 0x6e, 0x20, 0x76, 0x73, 0x5f, - 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x40, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, - 0x6e, 0x28, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6e, 0x64, - 0x65, 0x78, 0x29, 0x20, 0x76, 0x69, 0x3a, 0x20, 0x75, 0x33, 0x32, 0x2c, - 0x20, 0x40, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x28, 0x69, 0x6e, - 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x29, 0x20, 0x69, 0x69, 0x3a, 0x20, 0x75, 0x33, 0x32, 0x29, 0x20, 0x2d, - 0x3e, 0x20, 0x56, 0x53, 0x4f, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x70, 0x20, 0x3d, 0x20, 0x70, 0x61, - 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x5b, 0x69, 0x69, 0x5d, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x73, 0x69, 0x7a, - 0x65, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x32, 0x20, 0x2b, 0x20, 0x70, - 0x2e, 0x70, 0x6f, 0x73, 0x2e, 0x7a, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, - 0x31, 0x20, 0x2b, 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x73, - 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x5f, 0x70, 0x65, 0x61, 0x6b, 0x20, - 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x61, 0x72, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x20, - 0x3d, 0x20, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x76, 0x65, 0x63, 0x32, - 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x2c, 0x20, 0x36, 0x3e, 0x28, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x3c, - 0x66, 0x33, 0x32, 0x3e, 0x28, 0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x29, + 0x66, 0x33, 0x32, 0x3e, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x40, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x31, 0x29, 0x20, 0x75, + 0x76, 0x3a, 0x20, 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, + 0x2c, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x40, 0x76, 0x65, 0x72, 0x74, 0x65, + 0x78, 0x20, 0x66, 0x6e, 0x20, 0x76, 0x73, 0x5f, 0x6d, 0x61, 0x69, 0x6e, + 0x28, 0x40, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x28, 0x76, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x29, 0x20, + 0x76, 0x69, 0x3a, 0x20, 0x75, 0x33, 0x32, 0x2c, 0x20, 0x40, 0x62, 0x75, + 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x28, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x29, 0x20, 0x69, 0x69, + 0x3a, 0x20, 0x75, 0x33, 0x32, 0x29, 0x20, 0x2d, 0x3e, 0x20, 0x56, 0x53, + 0x4f, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x65, + 0x74, 0x20, 0x70, 0x20, 0x3d, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x6c, 0x65, 0x73, 0x5b, 0x69, 0x69, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x6c, 0x65, 0x74, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x3d, 0x20, + 0x30, 0x2e, 0x30, 0x32, 0x20, 0x2b, 0x20, 0x70, 0x2e, 0x70, 0x6f, 0x73, + 0x2e, 0x7a, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x20, 0x2b, 0x20, + 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x61, 0x75, 0x64, + 0x69, 0x6f, 0x5f, 0x70, 0x65, 0x61, 0x6b, 0x20, 0x2a, 0x20, 0x30, 0x2e, + 0x30, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x20, 0x3d, 0x20, 0x61, 0x72, + 0x72, 0x61, 0x79, 0x3c, 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, + 0x3e, 0x2c, 0x20, 0x36, 0x3e, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, + 0x28, 0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x29, 0x2c, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, + 0x33, 0x32, 0x3e, 0x28, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x29, 0x2c, 0x0a, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, + 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, 0x2d, 0x31, 0x2c, 0x20, 0x31, 0x29, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, - 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, 0x31, 0x2c, 0x20, 0x2d, + 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, 0x2d, 0x31, 0x2c, 0x20, 0x31, 0x29, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, 0x2d, 0x31, - 0x2c, 0x20, 0x31, 0x29, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, 0x31, 0x2c, + 0x20, 0x2d, 0x31, 0x29, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, - 0x2d, 0x31, 0x2c, 0x20, 0x31, 0x29, 0x2c, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, - 0x3e, 0x28, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x29, 0x2c, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, - 0x33, 0x32, 0x3e, 0x28, 0x31, 0x2c, 0x20, 0x31, 0x29, 0x0a, 0x20, 0x20, - 0x20, 0x20, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x65, 0x74, - 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x73, 0x5b, 0x76, 0x69, 0x5d, 0x3b, 0x0a, 0x20, - 0x20, 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x63, 0x20, 0x3d, 0x20, 0x63, - 0x6f, 0x73, 0x28, 0x70, 0x2e, 0x72, 0x6f, 0x74, 0x2e, 0x78, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x73, 0x20, 0x3d, - 0x20, 0x73, 0x69, 0x6e, 0x28, 0x70, 0x2e, 0x72, 0x6f, 0x74, 0x2e, 0x78, - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x72, - 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, - 0x3e, 0x28, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x78, 0x20, 0x2a, - 0x20, 0x63, 0x20, 0x2d, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, - 0x79, 0x20, 0x2a, 0x20, 0x73, 0x2c, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x73, 0x20, 0x2b, 0x20, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x63, 0x29, 0x3b, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x70, 0x6f, 0x73, - 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, - 0x28, 0x70, 0x2e, 0x70, 0x6f, 0x73, 0x2e, 0x78, 0x20, 0x2b, 0x20, 0x72, - 0x6f, 0x74, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x2f, - 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x61, 0x73, - 0x70, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x2c, 0x20, - 0x70, 0x2e, 0x70, 0x6f, 0x73, 0x2e, 0x79, 0x20, 0x2b, 0x20, 0x72, 0x6f, - 0x74, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x29, 0x3b, 0x0a, - 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x56, - 0x53, 0x4f, 0x75, 0x74, 0x28, 0x76, 0x65, 0x63, 0x34, 0x3c, 0x66, 0x33, - 0x32, 0x3e, 0x28, 0x70, 0x6f, 0x73, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, - 0x20, 0x31, 0x2e, 0x30, 0x29, 0x2c, 0x20, 0x70, 0x2e, 0x63, 0x6f, 0x6c, - 0x6f, 0x72, 0x20, 0x2a, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2b, 0x20, - 0x30, 0x2e, 0x35, 0x20, 0x2a, 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, - 0x6d, 0x73, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x5f, 0x70, 0x65, 0x61, - 0x6b, 0x29, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x40, 0x66, 0x72, 0x61, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x66, 0x6e, 0x20, 0x66, 0x73, 0x5f, - 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x30, 0x29, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3a, - 0x20, 0x76, 0x65, 0x63, 0x34, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x29, 0x20, - 0x2d, 0x3e, 0x20, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x28, 0x30, 0x29, 0x20, 0x76, 0x65, 0x63, 0x34, 0x3c, 0x66, 0x33, 0x32, - 0x3e, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x0a, - 0x00 + 0x31, 0x2c, 0x20, 0x31, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x29, 0x3b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x73, 0x5b, 0x76, 0x69, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, + 0x65, 0x74, 0x20, 0x63, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x70, + 0x2e, 0x72, 0x6f, 0x74, 0x2e, 0x78, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x6c, 0x65, 0x74, 0x20, 0x73, 0x20, 0x3d, 0x20, 0x73, 0x69, 0x6e, + 0x28, 0x70, 0x2e, 0x72, 0x6f, 0x74, 0x2e, 0x78, 0x29, 0x3b, 0x0a, 0x20, + 0x20, 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x72, 0x6f, 0x74, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20, + 0x76, 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x63, 0x20, 0x2d, + 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x79, 0x20, 0x2a, 0x20, + 0x73, 0x2c, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x78, 0x20, + 0x2a, 0x20, 0x73, 0x20, 0x2b, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x63, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x6c, 0x65, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x20, 0x3d, 0x20, 0x76, + 0x65, 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, 0x70, 0x2e, 0x70, + 0x6f, 0x73, 0x2e, 0x78, 0x20, 0x2b, 0x20, 0x72, 0x6f, 0x74, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x78, 0x20, + 0x2a, 0x20, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x2f, 0x20, 0x75, 0x6e, 0x69, + 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, + 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x2c, 0x20, 0x70, 0x2e, 0x70, 0x6f, + 0x73, 0x2e, 0x79, 0x20, 0x2b, 0x20, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x79, 0x20, 0x2a, + 0x20, 0x73, 0x69, 0x7a, 0x65, 0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x2f, 0x2f, 0x20, 0x46, 0x61, 0x64, 0x65, 0x20, 0x62, 0x61, 0x73, + 0x65, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, + 0x6d, 0x65, 0x20, 0x28, 0x70, 0x2e, 0x70, 0x6f, 0x73, 0x2e, 0x77, 0x20, + 0x67, 0x6f, 0x65, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x31, 0x2e, + 0x30, 0x20, 0x74, 0x6f, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x6c, 0x69, 0x66, 0x65, 0x74, 0x69, + 0x6d, 0x65, 0x5f, 0x66, 0x61, 0x64, 0x65, 0x20, 0x3d, 0x20, 0x70, 0x2e, + 0x70, 0x6f, 0x73, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, + 0x65, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x77, 0x69, 0x74, + 0x68, 0x5f, 0x66, 0x61, 0x64, 0x65, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, + 0x34, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, 0x70, 0x2e, 0x63, 0x6f, 0x6c, + 0x6f, 0x72, 0x2e, 0x72, 0x67, 0x62, 0x20, 0x2a, 0x20, 0x28, 0x30, 0x2e, + 0x35, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x20, 0x2a, 0x20, 0x75, 0x6e, + 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, + 0x5f, 0x70, 0x65, 0x61, 0x6b, 0x29, 0x2c, 0x20, 0x70, 0x2e, 0x63, 0x6f, + 0x6c, 0x6f, 0x72, 0x2e, 0x61, 0x20, 0x2a, 0x20, 0x6c, 0x69, 0x66, 0x65, + 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x66, 0x61, 0x64, 0x65, 0x29, 0x3b, 0x0a, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, + 0x56, 0x53, 0x4f, 0x75, 0x74, 0x28, 0x76, 0x65, 0x63, 0x34, 0x3c, 0x66, + 0x33, 0x32, 0x3e, 0x28, 0x70, 0x6f, 0x73, 0x2c, 0x20, 0x30, 0x2e, 0x30, + 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x2c, 0x20, 0x63, 0x6f, 0x6c, 0x6f, + 0x72, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x66, 0x61, 0x64, 0x65, 0x2c, + 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, + 0x0a, 0x40, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x66, + 0x6e, 0x20, 0x66, 0x73, 0x5f, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x40, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x30, 0x29, 0x20, 0x63, + 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x76, 0x65, 0x63, 0x34, 0x3c, 0x66, + 0x33, 0x32, 0x3e, 0x2c, 0x20, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x28, 0x31, 0x29, 0x20, 0x75, 0x76, 0x3a, 0x20, 0x76, 0x65, + 0x63, 0x32, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x29, 0x20, 0x2d, 0x3e, 0x20, + 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x30, 0x29, + 0x20, 0x76, 0x65, 0x63, 0x34, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x20, 0x7b, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x43, 0x61, 0x6c, 0x63, + 0x75, 0x6c, 0x61, 0x74, 0x65, 0x20, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x63, 0x65, 0x6e, 0x74, + 0x65, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x69, 0x72, 0x63, 0x75, + 0x6c, 0x61, 0x72, 0x20, 0x73, 0x68, 0x61, 0x70, 0x65, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x64, 0x69, 0x73, 0x74, 0x20, 0x3d, + 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x28, 0x75, 0x76, 0x29, 0x3b, + 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x53, 0x6d, 0x6f, + 0x6f, 0x74, 0x68, 0x20, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x72, + 0x20, 0x66, 0x61, 0x6c, 0x6c, 0x6f, 0x66, 0x66, 0x20, 0x28, 0x31, 0x2e, + 0x30, 0x20, 0x61, 0x74, 0x20, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2c, + 0x20, 0x30, 0x2e, 0x30, 0x20, 0x61, 0x74, 0x20, 0x65, 0x64, 0x67, 0x65, + 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x65, 0x74, 0x20, 0x63, 0x69, + 0x72, 0x63, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x20, 0x3d, + 0x20, 0x73, 0x6d, 0x6f, 0x6f, 0x74, 0x68, 0x73, 0x74, 0x65, 0x70, 0x28, + 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x35, 0x2c, 0x20, 0x64, 0x69, + 0x73, 0x74, 0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2f, 0x2f, + 0x20, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x20, 0x63, 0x69, 0x72, 0x63, 0x75, + 0x6c, 0x61, 0x72, 0x20, 0x66, 0x61, 0x64, 0x65, 0x20, 0x74, 0x6f, 0x20, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, + 0x20, 0x76, 0x65, 0x63, 0x34, 0x3c, 0x66, 0x33, 0x32, 0x3e, 0x28, 0x63, + 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x72, 0x67, 0x62, 0x2c, 0x20, 0x63, 0x6f, + 0x6c, 0x6f, 0x72, 0x2e, 0x61, 0x20, 0x2a, 0x20, 0x63, 0x69, 0x72, 0x63, + 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x29, 0x3b, 0x0a, 0x7d, + 0x0a, 0x00 }; const size_t ASSET_SIZE_SHADER_PASSTHROUGH = 665; alignas(16) static const uint8_t ASSET_DATA_SHADER_PASSTHROUGH[] = { diff --git a/src/generated/timeline.cc b/src/generated/timeline.cc index 0b69b09..cd03b77 100644 --- a/src/generated/timeline.cc +++ b/src/generated/timeline.cc @@ -48,9 +48,10 @@ void LoadTimeline(MainSequence& main_seq, WGPUDevice device, WGPUQueue queue, WG seq->add_effect(std::make_shared<ThemeModulationEffect>(device, queue, format), 0.000000f, 4.000000f, 0); seq->add_effect(std::make_shared<HeptagonEffect>(device, queue, format), 0.2f, 2.0f, 0); seq->add_effect(std::make_shared<Hybrid3DEffect>(device, queue, format), 0.000000f, 2.000000f, 1); - seq->add_effect(std::make_shared<HeptagonEffect>(device, queue, format), 0.000000f, 8.000000f, 2); - seq->add_effect(std::make_shared<ChromaAberrationEffect>(device, queue, format), 0.000000f, 8.000000f, 3); - seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), 0.000000f, 4.000000f, 4); + seq->add_effect(std::make_shared<ParticleSprayEffect>(device, queue, format), 0.000000f, 4.000000f, 2); + seq->add_effect(std::make_shared<HeptagonEffect>(device, queue, format), 0.000000f, 8.000000f, 3); + seq->add_effect(std::make_shared<ChromaAberrationEffect>(device, queue, format), 0.000000f, 8.000000f, 4); + seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), 0.000000f, 4.000000f, 5); main_seq.add_sequence(seq, 28.000000f, 0); } { @@ -61,25 +62,28 @@ void LoadTimeline(MainSequence& main_seq, WGPUDevice device, WGPUQueue queue, WG } { auto seq = std::make_shared<Sequence>(); - seq->add_effect(std::make_shared<ParticlesEffect>(device, queue, format), 0.000000f, 2.000000f, 0); - seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), 0.000000f, 4.000000f, 0); + seq->add_effect(std::make_shared<ParticleSprayEffect>(device, queue, format), 0.000000f, 2.000000f, 0); + seq->add_effect(std::make_shared<ParticlesEffect>(device, queue, format), 0.000000f, 2.000000f, 1); + seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), 0.000000f, 4.000000f, 1); main_seq.add_sequence(seq, 3.000000f, 1); } { auto seq = std::make_shared<Sequence>(); seq->add_effect(std::make_shared<ThemeModulationEffect>(device, queue, format), 0.000000f, 4.000000f, 0); seq->add_effect(std::make_shared<HeptagonEffect>(device, queue, format), 0.2f, 2.0f, 1); - seq->add_effect(std::make_shared<Hybrid3DEffect>(device, queue, format), 0.000000f, 10.000000f, 2); - seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), 0.000000f, 4.000000f, 3); - seq->add_effect(std::make_shared<ChromaAberrationEffect>(device, queue, format), 0.000000f, 5.000000f, 4); - seq->add_effect(std::make_shared<SolarizeEffect>(device, queue, format), 0.000000f, 5.000000f, 5); + seq->add_effect(std::make_shared<ParticleSprayEffect>(device, queue, format), 0.000000f, 4.000000f, 2); + seq->add_effect(std::make_shared<Hybrid3DEffect>(device, queue, format), 0.000000f, 10.000000f, 3); + seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), 0.000000f, 4.000000f, 4); + seq->add_effect(std::make_shared<ChromaAberrationEffect>(device, queue, format), 0.000000f, 5.000000f, 5); + seq->add_effect(std::make_shared<SolarizeEffect>(device, queue, format), 0.000000f, 5.000000f, 6); main_seq.add_sequence(seq, 12.000000f, 1); } { auto seq = std::make_shared<Sequence>(); seq->add_effect(std::make_shared<FlashCubeEffect>(device, queue, format), .2f, 1.500000f, -1); seq->add_effect(std::make_shared<HeptagonEffect>(device, queue, format), 0.000000f, 2.000000f, 0); - seq->add_effect(std::make_shared<ParticlesEffect>(device, queue, format), 0.000000f, 2.000000f, 1); + seq->add_effect(std::make_shared<ParticleSprayEffect>(device, queue, format), 0.000000f, 2.000000f, 1); + seq->add_effect(std::make_shared<ParticlesEffect>(device, queue, format), 0.000000f, 2.000000f, 2); main_seq.add_sequence(seq, 6.000000f, 2); } { @@ -92,10 +96,11 @@ void LoadTimeline(MainSequence& main_seq, WGPUDevice device, WGPUQueue queue, WG auto seq = std::make_shared<Sequence>(); seq->add_effect(std::make_shared<ThemeModulationEffect>(device, queue, format), 0.000000f, 2.000000f, 0); seq->add_effect(std::make_shared<HeptagonEffect>(device, queue, format), 0.2f, 2.0f, 1); - seq->add_effect(std::make_shared<ParticlesEffect>(device, queue, format), 0.000000f, 2.000000f, 1); - seq->add_effect(std::make_shared<Hybrid3DEffect>(device, queue, format), 0.000000f, 2.000000f, 2); - seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), 0.000000f, 4.000000f, 3); - seq->add_effect(std::make_shared<ChromaAberrationEffect>(device, queue, format), 0.000000f, 3.000000f, 4); + seq->add_effect(std::make_shared<ParticleSprayEffect>(device, queue, format), 0.000000f, 2.000000f, 2); + seq->add_effect(std::make_shared<ParticlesEffect>(device, queue, format), 0.000000f, 2.000000f, 2); + seq->add_effect(std::make_shared<Hybrid3DEffect>(device, queue, format), 0.000000f, 2.000000f, 3); + seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), 0.000000f, 4.000000f, 4); + seq->add_effect(std::make_shared<ChromaAberrationEffect>(device, queue, format), 0.000000f, 3.000000f, 5); main_seq.add_sequence(seq, 8.500000f, 2); } { diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc index 1f71711..1d661c7 100644 --- a/src/gpu/gpu.cc +++ b/src/gpu/gpu.cc @@ -105,9 +105,23 @@ RenderPass gpu_create_render_pass(WGPUDevice device, WGPUTextureFormat format, WGPUColorTargetState color_target = {}; color_target.format = format; // Use passed format color_target.writeMask = WGPUColorWriteMask_All; - color_target.blend = nullptr; - // Add additive blending for particles + // Enable alpha blending for transparent effects (particles) + // Check if shader contains "particle" to enable blending + WGPUBlendState blend_state = {}; + blend_state.color.srcFactor = WGPUBlendFactor_SrcAlpha; + blend_state.color.dstFactor = WGPUBlendFactor_OneMinusSrcAlpha; + blend_state.color.operation = WGPUBlendOperation_Add; + blend_state.alpha.srcFactor = WGPUBlendFactor_One; + blend_state.alpha.dstFactor = WGPUBlendFactor_OneMinusSrcAlpha; + blend_state.alpha.operation = WGPUBlendOperation_Add; + + // Enable blending for particle shaders + if (strstr(shader_code, "particle") != nullptr) { + color_target.blend = &blend_state; + } else { + color_target.blend = nullptr; + } WGPUFragmentState fragment_state = {}; fragment_state.module = shader_module; |
