summaryrefslogtreecommitdiff
path: root/tools/shadertoy/template.h
blob: 2e4af5fc461058e905f3e6138aa8af5e998db370 (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
40
41
// This file is part of the 64k demo project.
// ShaderToy effect boilerplate - REPLACE THIS LINE WITH DESCRIPTION
// TODO: Update description, rename class, adjust parameters

#ifndef SHADERTOY_EFFECT_H_
#define SHADERTOY_EFFECT_H_

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

// TODO: Rename class to match your effect (e.g., TunnelEffect, PlasmaEffect)
class ShaderToyEffect : public Effect {
 public:
  // TODO: Add constructor parameters for tunable values
  ShaderToyEffect(const GpuContext& ctx);
  ~ShaderToyEffect() override;

  void init(MainSequence* demo) override;
  void render(WGPURenderPassEncoder pass, float time, float beat,
              float intensity, float aspect_ratio) override;

 private:
  // TODO: Add effect-specific parameters here
  // Must match WGSL struct exactly - use padding for 16-byte alignment
  struct ShaderToyParams {
    float param1;
    float param2;
    float _pad[2];  // Padding to 16 bytes
  };
  static_assert(sizeof(ShaderToyParams) == 16,
                "ShaderToyParams must be 16 bytes for WGSL alignment");

  MainSequence* demo_ = nullptr;
  WGPURenderPipeline pipeline_ = nullptr;
  WGPUBindGroup bind_group_ = nullptr;
  WGPUSampler sampler_ = nullptr;
  UniformBuffer<ShaderToyParams> params_;
};

#endif /* SHADERTOY_EFFECT_H_ */