diff options
Diffstat (limited to 'src/effects/distort_effect.h')
| -rw-r--r-- | src/effects/distort_effect.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/effects/distort_effect.h b/src/effects/distort_effect.h new file mode 100644 index 0000000..548cf91 --- /dev/null +++ b/src/effects/distort_effect.h @@ -0,0 +1,28 @@ +// This file is part of the 64k demo project. +// It declares the DistortEffect. + +#pragma once + +#include "gpu/effect.h" +#include "gpu/uniform_helper.h" + +// Parameters for DistortEffect +struct DistortParams { + float strength = 0.01f; // Default distortion strength + float speed = 1.0f; // Default distortion speed +}; +static_assert(sizeof(DistortParams) == 8, + "DistortParams must be 8 bytes for WGSL alignment"); + +class DistortEffect : public PostProcessEffect { + public: + DistortEffect(const GpuContext& ctx); + DistortEffect(const GpuContext& ctx, const DistortParams& params); + void render(WGPURenderPassEncoder pass, + const CommonPostProcessUniforms& uniforms) override; + void update_bind_group(WGPUTextureView input_view) override; + + private: + DistortParams params_; + UniformBuffer<DistortParams> params_buffer_; +}; |
