aboutsummaryrefslogtreecommitdiff
path: root/barchart.h
diff options
context:
space:
mode:
authorSamuel Fadel <samuel@nihil.ws>2023-06-06 16:58:40 +0200
committerSamuel Fadel <samuel@nihil.ws>2023-06-06 16:58:40 +0200
commit4ef37f16257b42512ec610cc5def338707308747 (patch)
treea00986754f6792a4b991a4927a9dc98f7b1919f7 /barchart.h
parent4f05d891f05a038bad7b911ce52d27e01b34f7cb (diff)
BarChart, Wayland.
* Makefile: Added some Wayland stuff to cflags/libs in pkg-config * barchart: Rendering works, no interactivity * main.cpp: Reposition some components for a more compact view * manifest.scm: glfw-wayland: Added GLFW variant with Wayland * scatterplot.cpp and voronoisplat.cpp: Cleanup
Diffstat (limited to 'barchart.h')
-rw-r--r--barchart.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/barchart.h b/barchart.h
index 9e2b421..947fe2b 100644
--- a/barchart.h
+++ b/barchart.h
@@ -5,10 +5,11 @@
#include <vector>
#include <armadillo>
+#include <glad/gl.h>
#include <nod.hpp>
-#include "colorscale.h"
#include "scale.h"
+#include "shader.h"
class BarChart
{
@@ -17,23 +18,25 @@ public:
size_t width() const { return m_width; }
size_t height() const { return m_height; }
+ GLuint texture() const { return m_outTex; }
nod::signal<void(const arma::vec &)> valuesChanged;
- nod::signal<void(std::shared_ptr<const ColorScale>)> colorScaleChanged;
nod::signal<void(const std::vector<bool> &)> selectionChanged;
nod::signal<void(const std::vector<bool> &)> selectionInteractivelyChanged;
nod::signal<void(int, float)> itemBrushed;
nod::signal<void(int)> itemInteractivelyBrushed;
+ void setSize(size_t, size_t);
void setValues(const arma::vec &values);
void updateValues(const arma::vec &values);
- void setColorScale(std::shared_ptr<const ColorScale> scale);
+ void setColormap(GLuint texture);
void setSelection(const std::vector<bool> &selection);
void brushItem(int item);
void update();
+ void draw();
-protected:
+ // protected:
// QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
// void hoverEnterEvent(QHoverEvent *event);
@@ -45,6 +48,8 @@ protected:
// void mouseReleaseEvent(QMouseEvent *event);
private:
+ void updateBars();
+
// QSGNode *newSceneGraph() const;
// QSGNode *newBarNode() const;
// QSGNode *newSelectionBarNode() const;
@@ -53,6 +58,7 @@ private:
// void updateBarNodeGeom(QSGNode *barNode, float x, float width, float height) const;
// void updateBarNodeColor(QSGNode *barNode, const QColor &color) const;
// void updateBars(QSGNode *node) const;
+ bool m_redraw;
bool m_shouldUpdateBars;
// void updatePreSelection(QSGNode *node) const;
@@ -71,11 +77,13 @@ private:
int itemAt(float x, bool includeSelectorWidth = false) const;
+ size_t m_width, m_height;
+ GLuint m_FBO, m_VAO, m_VBO, m_colormapTex, m_outTex;
+ std::unique_ptr<Shader> m_shader;
+
arma::vec m_values;
- std::shared_ptr<const ColorScale> m_colorScale;
std::vector<int> m_originalIndices, m_currentIndices;
LinearScale<float> m_scale;
- size_t m_width, m_height;
};
#endif // BARCHART_H