diff options
Diffstat (limited to 'src/gpu/demo_effects.h')
| -rw-r--r-- | src/gpu/demo_effects.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gpu/demo_effects.h b/src/gpu/demo_effects.h index 6c8729d..ad95cfe 100644 --- a/src/gpu/demo_effects.h +++ b/src/gpu/demo_effects.h @@ -127,6 +127,39 @@ class DistortEffect : public PostProcessEffect { void update_bind_group(WGPUTextureView input_view) override; }; +// Parameters for VignetteEffect +struct VignetteParams { + float radius = 0.5f; // Radius of the clear center + float softness = 0.5f; // Softness of the vignette edge +}; + +// Uniform data for VignetteEffect +struct VignetteUniforms { + float time; // offset 0 + float beat; // offset 4 + float intensity; // offset 8 + float aspect_ratio; // offset 12 + float width; // offset 16 + float height; // offset 20 + float radius; // offset 24 + float softness; // offset 28 +}; +static_assert(sizeof(VignetteUniforms) == 32, + "VignetteUniforms must be 32 bytes for WGSL alignment"); + +class VignetteEffect : public PostProcessEffect { + public: + VignetteEffect(const GpuContext& ctx); + VignetteEffect(const GpuContext& ctx, const VignetteParams& params); + void render(WGPURenderPassEncoder pass, float time, float beat, + float intensity, float aspect_ratio) override; + void update_bind_group(WGPUTextureView input_view) override; + + private: + VignetteParams params_; + UniformBuffer<VignetteUniforms> uniforms_; +}; + // Parameters for ChromaAberrationEffect (set at construction time) struct ChromaAberrationParams { float offset_scale = 0.02f; // Default: 2% screen offset |
