summaryrefslogtreecommitdiff
path: root/cpp-timeplot/src/waterfall.h
diff options
context:
space:
mode:
authorgrothedev <grothedev@gmail.com>2025-10-02 01:27:50 -0400
committergrothedev <grothedev@gmail.com>2025-10-02 01:27:50 -0400
commita162c98ce54159e3e7dbe867d908ce3276b7f633 (patch)
treeef49d87f7c5345e8ed08884da99a35af7b3c2b5b /cpp-timeplot/src/waterfall.h
parent685ab63782daeb868a999ec65ef0ceb0883acb3e (diff)
trying c++ impl
Diffstat (limited to 'cpp-timeplot/src/waterfall.h')
-rw-r--r--cpp-timeplot/src/waterfall.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/cpp-timeplot/src/waterfall.h b/cpp-timeplot/src/waterfall.h
new file mode 100644
index 0000000..4c5d813
--- /dev/null
+++ b/cpp-timeplot/src/waterfall.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <webgpu/webgpu.hpp>
+#include <vector>
+#include <string>
+
+struct Vertex {
+ float position[2];
+ float color[3];
+};
+
+class Waterfall {
+public:
+ Waterfall(wgpu::Device device, float x, float y, float width, float height, const std::string& title);
+ ~Waterfall();
+
+ bool initialize();
+ void update(float time);
+ void render(wgpu::RenderPassEncoder& pass,
+ wgpu::RenderPipeline linePipeline,
+ wgpu::RenderPipeline lineListPipeline,
+ int windowWidth, int windowHeight);
+ void toggleGrid();
+
+private:
+ std::vector<Vertex> generateGridLines();
+ std::vector<Vertex> generateBorder();
+
+ wgpu::Device device_;
+ wgpu::Buffer vertexBuffer_;
+
+ float x_, y_, width_, height_;
+ std::string title_;
+ bool showGrid_;
+
+ std::vector<std::vector<Vertex>> lines_;
+ static constexpr int MAX_LINES = 50;
+ static constexpr int POINTS_PER_LINE = 100;
+};