summaryrefslogtreecommitdiff
path: root/src/gpu/demo_effects.h
blob: befb1fec5b73553794af7752672dff69d287a260 (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
29
30
31
32
33
34
35
36
37
38
39
// 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_;
};

// Auto-generated function to populate the timeline
void LoadTimeline(MainSequence &main_seq, WGPUDevice device, WGPUQueue queue,
                  WGPUTextureFormat format);