diff options
author | Samuel Fadel <samuel@nihil.ws> | 2023-06-04 13:02:14 +0200 |
---|---|---|
committer | Samuel Fadel <samuel@nihil.ws> | 2023-06-04 13:02:14 +0200 |
commit | fb23c8d47f6dcef429423256d8dddcc0f7184fc4 (patch) | |
tree | 34e0032f28df5807e4abd90d6b1b4baad24d2991 /scatterplot.h | |
parent | 0f34fd437efb936ef29ac91186321aa7251fbfb1 (diff) |
Further advances in nuklear port.
Rendering now looks similar to Qt version, needs a few tweaks:
* Proper multisampling
* Background
Missing features:
* Barcharts
* Interactivity (e.g. brushing/linking in all objects)
* History view of interactions
Diffstat (limited to 'scatterplot.h')
-rw-r--r-- | scatterplot.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/scatterplot.h b/scatterplot.h index 8286b7d..5be1647 100644 --- a/scatterplot.h +++ b/scatterplot.h @@ -5,12 +5,14 @@ #include <vector> #include <armadillo> +#include <glad/gl.h> #include <nod.hpp> #include "colorscale.h" #include "quadtree.h" #include "geometry.h" #include "scale.h" +#include "shader.h" class Scatterplot { @@ -18,15 +20,15 @@ public: static const int PADDING = 20; Scatterplot(); + ~Scatterplot(); arma::mat XY() const; - void setColorScale(std::shared_ptr<const ColorScale> colorScale); + void setColormap(GLuint texture); void setAutoScale(bool autoScale); - float x() const { return m_x; } - float y() const { return m_y; } - float width() const { return m_width; } - float height() const { return m_height; } + size_t width() const { return m_width; } + size_t height() const { return m_height; } + void setSize(size_t, size_t); float glyphSize() const { return m_glyphSize; } void setGlyphSize(float glyphSize); @@ -34,6 +36,8 @@ public: void setDragEnabled(bool enabled) { m_dragEnabled = enabled; } bool isDragEnabled() const { return m_dragEnabled; } + GLuint texture() const { return m_outTex; } + nod::signal<void(const arma::mat &)> xyChanged, xyInteractivelyChanged; nod::signal<void(const arma::vec &)> colorDataChanged, opacityDataChanged; nod::signal<void(const std::vector<bool> &)> selectionChanged, selectionInteractivelyChanged; @@ -48,6 +52,7 @@ public: void setSelection(const std::vector<bool> &selection); void brushItem(int item); void update(); + void draw(); protected: // QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *); @@ -64,6 +69,9 @@ private: // QSGNode *newGlyphTree(); void applyManipulation(); + void updateGeometry(); + void updateMaterials(); + void updateTransform(); // void updateGlyphs(QSGNode *node); // void updateBrush(QSGNode *node); @@ -73,7 +81,7 @@ private: arma::vec m_opacityData; // Visuals - float m_x, m_y, m_width, m_height; + size_t m_width, m_height; float m_glyphSize; std::shared_ptr<const ColorScale> m_colorScale; @@ -96,9 +104,14 @@ private: } m_interactionState; bool m_dragEnabled; - Point2D m_dragOriginPos, m_dragCurrentPos; + std::unique_ptr<Shader> m_shader, m_shaderOutline; + GLuint m_VAO, m_pointsVBO, m_valuesVBO; + GLuint m_FBO, m_colormapTex, m_outTex; + GLfloat m_transform[4][4]; + std::vector<vec2> m_points; - bool m_shouldUpdateGeometry, m_shouldUpdateMaterials; + vec2 m_dragOriginPos, m_dragCurrentPos; + bool m_redraw, m_shouldUpdateGeometry, m_shouldUpdateMaterials; std::unique_ptr<QuadTree> m_quadtree; void updateQuadTree(); |