From fb23c8d47f6dcef429423256d8dddcc0f7184fc4 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Sun, 4 Jun 2023 13:02:14 +0200 Subject: 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 --- scatterplot.h | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'scatterplot.h') diff --git a/scatterplot.h b/scatterplot.h index 8286b7d..5be1647 100644 --- a/scatterplot.h +++ b/scatterplot.h @@ -5,12 +5,14 @@ #include #include +#include #include #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 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 xyChanged, xyInteractivelyChanged; nod::signal colorDataChanged, opacityDataChanged; nod::signal &)> selectionChanged, selectionInteractivelyChanged; @@ -48,6 +52,7 @@ public: void setSelection(const std::vector &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 m_colorScale; @@ -96,9 +104,14 @@ private: } m_interactionState; bool m_dragEnabled; - Point2D m_dragOriginPos, m_dragCurrentPos; + std::unique_ptr 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 m_points; - bool m_shouldUpdateGeometry, m_shouldUpdateMaterials; + vec2 m_dragOriginPos, m_dragCurrentPos; + bool m_redraw, m_shouldUpdateGeometry, m_shouldUpdateMaterials; std::unique_ptr m_quadtree; void updateQuadTree(); -- cgit v1.2.3