summaryrefslogtreecommitdiff
path: root/cpp-timeplot/src/renderer.h
blob: 0656cdcd9ed168efceb3dac0fe509fb3d6fbb082 (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
#pragma once

#include <webgpu/webgpu.h>
#include <vector>
#include <memory>

class Waterfall;

class Renderer {
public:
    Renderer(WGPUDevice device, WGPUSurface surface, int width, int height);
    ~Renderer();

    bool initialize();
    void update();
    void render();
    void resize(int width, int height);
    void toggleGrid();

private:
    void configureSurface();
    void createPipelines();

    WGPUDevice device_;
    WGPUSurface surface_;
    WGPUTextureFormat surfaceFormat_;
    WGPURenderPipeline linePipeline_;
    WGPURenderPipeline lineListPipeline_;

    int width_;
    int height_;
    float time_;

    std::vector<std::unique_ptr<Waterfall>> waterfalls_;
};