blob: 548cf91b4b7ea57d6cd6e261185f6ceb85d50d35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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_;
};
|