diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-31 15:36:45 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-31 15:36:45 +0100 |
| commit | 72c0cbcb38732b698d33d52459fed67af56ee2ec (patch) | |
| tree | 83cabb089d76c7dda49ac786ad829b6f37d17bbf /src/gpu/demo_effects.h | |
| parent | e96f282d77bd114493c8d9097c7fb7eaaad2338b (diff) | |
feat: Implement Sequence and Effect system for demo choreography
Refactors the rendering pipeline into a modular Sequence/Effect system. 'MainSequence' manages the final frame rendering and a list of 'Sequence' layers. 'Sequence' manages a timeline of 'Effect' objects (start/end/priority). Concrete effects (Heptagon, Particles) are moved to 'demo_effects.cc'. Updates main loop to pass beat and aspect ratio.
Diffstat (limited to 'src/gpu/demo_effects.h')
| -rw-r--r-- | src/gpu/demo_effects.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gpu/demo_effects.h b/src/gpu/demo_effects.h new file mode 100644 index 0000000..81321d9 --- /dev/null +++ b/src/gpu/demo_effects.h @@ -0,0 +1,40 @@ +// This file is part of the 64k demo project. +// It declares the concrete effects used in the demo. + +#pragma once +#include "effect.h" +#include "gpu.h" +#include <memory> + +class HeptagonEffect : public Effect { +public: + HeptagonEffect(WGPUDevice device, WGPUQueue queue, WGPUTextureFormat format); + void render(WGPURenderPassEncoder pass, float time, float beat, + float intensity, float aspect_ratio) override; + +private: + WGPUQueue queue_; + RenderPass pass_; + GpuBuffer uniforms_; +}; + +class ParticlesEffect : public Effect { +public: + ParticlesEffect(WGPUDevice device, WGPUQueue queue, WGPUTextureFormat format); + void compute(WGPUCommandEncoder encoder, float time, float beat, + float intensity, float aspect_ratio) override; + void render(WGPURenderPassEncoder pass, float time, float beat, + float intensity, float aspect_ratio) override; + +private: + WGPUQueue queue_; + ComputePass compute_pass_; + RenderPass render_pass_; + GpuBuffer particles_buffer_; + GpuBuffer uniforms_; +}; + +// Factory +std::shared_ptr<Sequence> create_demo_sequence(WGPUDevice device, + WGPUQueue queue, + WGPUTextureFormat format); |
