blob: 3af13ebe89dfd64fab607aa36dbb5fbb7819120e (
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
|
// This file is part of the 64k demo project.
// It implements a flashing cube effect with Perlin noise texture.
// The cube is large and we're inside it, flashing in sync with the beat.
#pragma once
#include "3d/camera.h"
#include "3d/renderer.h"
#include "3d/scene.h"
#include "gpu/effect.h"
#include "gpu/texture_manager.h"
class FlashCubeEffect : public Effect {
public:
FlashCubeEffect(WGPUDevice device, WGPUQueue queue, WGPUTextureFormat format);
void init(MainSequence* demo) override;
void resize(int width, int height) override;
void render(WGPURenderPassEncoder pass, float time, float beat,
float intensity, float aspect_ratio) override;
private:
Renderer3D renderer_;
TextureManager texture_manager_;
Scene scene_;
Camera camera_;
int width_ = 1280;
int height_ = 720;
float last_beat_ = 0.0f;
float flash_intensity_ = 0.0f;
};
|