From 2036b60992bcd28d585d237fd0f57243f7675e5f Mon Sep 17 00:00:00 2001 From: skal Date: Fri, 6 Feb 2026 17:27:57 +0100 Subject: feat(particles): Implement transparent circular particles with alpha blending (Task #53) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Visual Improvements - Particles now render as smooth fading circles instead of squares - Added UV coordinates to vertex shader output - Fragment shader applies circular falloff (smoothstep 1.0 to 0.5) - Lifetime-based fade: alpha multiplied by particle.pos.w (1.0 → 0.0) ## Pipeline Changes - Enabled alpha blending for particle shaders (auto-detected via strstr) - Blend mode: SrcAlpha + OneMinusSrcAlpha (standard alpha blending) - Alpha channel: One + OneMinusSrcAlpha for proper compositing ## Demo Integration - Added 5 ParticleSprayEffect instances at key moments (6b, 12b, 17b, 24b, 56b) - Increased particle presence throughout demo - Particles now more visually impactful with transparency ## Files Modified - assets/final/shaders/particle_render.wgsl: Circular fade logic - src/gpu/gpu.cc: Auto-enable blending for particle shaders - assets/demo.seq: Added ParticleSprayEffect at multiple sequences ## Testing - All 23 tests pass (100%) - Verified with demo64k visual inspection --- src/generated/assets_data.cc | 190 ++++++++++++++++++++++++++----------------- src/generated/timeline.cc | 33 ++++---- src/gpu/gpu.cc | 18 +++- 3 files changed, 152 insertions(+), 89 deletions(-) (limited to 'src') 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(device, queue, format), 0.000000f, 4.000000f, 0); seq->add_effect(std::make_shared(device, queue, format), 0.2f, 2.0f, 0); seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 1); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 8.000000f, 2); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 8.000000f, 3); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 4); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 2); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 8.000000f, 3); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 8.000000f, 4); + seq->add_effect(std::make_shared(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(); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 0); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 0); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 0); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 1); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 1); main_seq.add_sequence(seq, 3.000000f, 1); } { auto seq = std::make_shared(); seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 0); seq->add_effect(std::make_shared(device, queue, format), 0.2f, 2.0f, 1); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 10.000000f, 2); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 3); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 5.000000f, 4); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 5.000000f, 5); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 2); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 10.000000f, 3); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 4); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 5.000000f, 5); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 5.000000f, 6); main_seq.add_sequence(seq, 12.000000f, 1); } { auto seq = std::make_shared(); seq->add_effect(std::make_shared(device, queue, format), .2f, 1.500000f, -1); seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 0); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 1); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 1); + seq->add_effect(std::make_shared(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(); seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 0); seq->add_effect(std::make_shared(device, queue, format), 0.2f, 2.0f, 1); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 1); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 2); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 3); - seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 3.000000f, 4); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 2); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 2); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 2.000000f, 3); + seq->add_effect(std::make_shared(device, queue, format), 0.000000f, 4.000000f, 4); + seq->add_effect(std::make_shared(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; -- cgit v1.2.3