summaryrefslogtreecommitdiff
path: root/src/effects/vignette_effect.h
blob: f891d147f890ef14d92f5a9f49e6f91d23f31a4a (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
// This file is part of the 64k demo project.
// It declares the VignetteEffect.

#pragma once

#include "gpu/effect.h"
#include "gpu/uniform_helper.h"

// Parameters for VignetteEffect
struct VignetteParams {
  float radius = 0.5f;   // Radius of the clear center
  float softness = 0.5f; // Softness of the vignette edge
};

class VignetteEffect : public PostProcessEffect {
 public:
  VignetteEffect(const GpuContext& ctx);
  VignetteEffect(const GpuContext& ctx, const VignetteParams& params);
  void render(WGPURenderPassEncoder pass,
              const CommonPostProcessUniforms& uniforms) override;
  void update_bind_group(WGPUTextureView input_view) override;

 private:
  VignetteParams params_;
  UniformBuffer<VignetteParams> params_buffer_;
};