From 0f34fd437efb936ef29ac91186321aa7251fbfb1 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Tue, 23 May 2023 11:22:33 +0200 Subject: Massive changes in initial port away from Qt. --- voronoisplat.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'voronoisplat.cpp') diff --git a/voronoisplat.cpp b/voronoisplat.cpp index 3e21e67..3bbe7cf 100644 --- a/voronoisplat.cpp +++ b/voronoisplat.cpp @@ -2,14 +2,9 @@ #include -#include -#include -#include -#include - #include "colormap.h" #include "scatterplot.h" -#include "skelft.h" +// #include "skelft.h" static const float DEFAULT_ALPHA = 5.0f; static const float DEFAULT_BETA = 20.0f; @@ -26,9 +21,8 @@ static int nextPow2(int n) return n + 1; } -VoronoiSplat::VoronoiSplat(QQuickItem *parent) - : QQuickFramebufferObject(parent) - , m_sx(0.0f, 1.0f, 0.0f, 1.0f) +VoronoiSplat::VoronoiSplat() + : m_sx(0.0f, 1.0f, 0.0f, 1.0f) , m_sy(0.0f, 1.0f, 0.0f, 1.0f) , m_alpha(DEFAULT_ALPHA) , m_beta(DEFAULT_BETA) @@ -36,8 +30,10 @@ VoronoiSplat::VoronoiSplat(QQuickItem *parent) , m_valuesChanged(false) , m_colorScaleChanged(false) { - setFlag(QQuickItem::ItemHasContents); - setTextureFollowsItemSize(false); +} + +void VoronoiSplat::update() +{ } void VoronoiSplat::setSites(const arma::mat &points) @@ -78,17 +74,17 @@ void VoronoiSplat::setValues(const arma::vec &values) m_values.resize(values.n_elem); LinearScale scale(values.min(), values.max(), 0, 1.0f); std::transform(values.begin(), values.end(), m_values.begin(), scale); - emit valuesChanged(values); + valuesChanged(values); setValuesChanged(true); update(); } -void VoronoiSplat::setColorScale(const ColorScale *scale) +void VoronoiSplat::setColorScale(std::shared_ptr scale) { m_cmap.resize(SAMPLES * 3); scale->sample(SAMPLES, m_cmap.begin()); - emit colorScaleChanged(scale); + colorScaleChanged(scale); setColorScaleChanged(true); update(); @@ -99,26 +95,26 @@ void VoronoiSplat::setScale(const LinearScale &sx, { m_sx = sx; m_sy = sy; - emit scaleChanged(m_sx, m_sy); + scaleChanged(m_sx, m_sy); update(); } void VoronoiSplat::setAlpha(float alpha) { m_alpha = alpha; - emit alphaChanged(m_alpha); + alphaChanged(m_alpha); update(); } void VoronoiSplat::setBeta(float beta) { m_beta = beta; - emit betaChanged(m_beta); + betaChanged(m_beta); update(); } // ---------------------------------------------------------------------------- - +/* class VoronoiSplatRenderer : public QQuickFramebufferObject::Renderer { @@ -553,3 +549,4 @@ void VoronoiSplatRenderer::computeDT() gl.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RED, GL_FLOAT, buf.data()); } +*/ -- cgit v1.2.3