diff options
Diffstat (limited to 'src/datavisualization/engine')
26 files changed, 215 insertions, 243 deletions
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp index e185d322..b84bb2f7 100644 --- a/src/datavisualization/engine/abstract3dcontroller.cpp +++ b/src/datavisualization/engine/abstract3dcontroller.cpp @@ -528,7 +528,7 @@ void Abstract3DController::setSecondarySubViewport(const QRect &secondarySubView m_scene->setSecondarySubViewport(secondarySubViewport); } -void Abstract3DController::updateDevicePixelRatio(qreal ratio) +void Abstract3DController::updateDevicePixelRatio(float ratio) { m_scene->setDevicePixelRatio(ratio); } @@ -974,7 +974,7 @@ void Abstract3DController::handleAxisLabelsChangedBySender(QObject *sender) emitNeedRender(); } -void Abstract3DController::handleAxisRangeChanged(qreal min, qreal max) +void Abstract3DController::handleAxisRangeChanged(float min, float max) { Q_UNUSED(min) Q_UNUSED(max) @@ -1190,12 +1190,7 @@ Q3DAbstractAxis *Abstract3DController::createDefaultAxis(Q3DAbstractAxis::AxisOr Q3DValueAxis *Abstract3DController::createDefaultValueAxis() { // Default value axis has single segment, empty label format, and auto scaling - // TODO: Grid should be also hidden, but that is not currently controlled by axis Q3DValueAxis *defaultAxis = new Q3DValueAxis; - defaultAxis->setSegmentCount(1); - defaultAxis->setSubSegmentCount(1); - defaultAxis->setAutoAdjustRange(true); - defaultAxis->setLabelFormat(QString()); defaultAxis->d_ptr->setDefaultAxis(true); return defaultAxis; @@ -1204,9 +1199,7 @@ Q3DValueAxis *Abstract3DController::createDefaultValueAxis() Q3DCategoryAxis *Abstract3DController::createDefaultCategoryAxis() { // Default category axis has no labels - // TODO: Grid should be also hidden, but that is not currently controlled by axis. Q3DCategoryAxis *defaultAxis = new Q3DCategoryAxis; - defaultAxis->setAutoAdjustRange(true); defaultAxis->d_ptr->setDefaultAxis(true); return defaultAxis; } diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h index 30c13e7d..52a6728c 100644 --- a/src/datavisualization/engine/abstract3dcontroller_p.h +++ b/src/datavisualization/engine/abstract3dcontroller_p.h @@ -248,7 +248,7 @@ public: virtual void setActiveInputHandler(QAbstract3DInputHandler *inputHandler); virtual QAbstract3DInputHandler *activeInputHandler(); - virtual void updateDevicePixelRatio(qreal ratio); + virtual void updateDevicePixelRatio(float ratio); virtual int zoomLevel(); virtual void setZoomLevel(int zoomLevel); @@ -330,7 +330,7 @@ public: public slots: void handleAxisTitleChanged(const QString &title); void handleAxisLabelsChanged(); - void handleAxisRangeChanged(qreal min, qreal max); + void handleAxisRangeChanged(float min, float max); void handleAxisSegmentCountChanged(int count); void handleAxisSubSegmentCountChanged(int count); void handleAxisAutoAdjustRangeChanged(bool autoAdjust); diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp index f9295865..ed62dbe4 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -110,7 +110,7 @@ void Abstract3DRenderer::render(const GLuint defaultFboHandle) // Measure speed (as milliseconds per frame) m_numFrames++; if (m_lastFrameTime.elapsed() >= 1000) { // print only if last measurement was more than 1s ago - qDebug() << qreal(m_lastFrameTime.elapsed()) / qreal(m_numFrames) << "ms/frame (=" << qreal(m_numFrames) << "fps)"; + qDebug() << float(m_lastFrameTime.elapsed()) / float(m_numFrames) << "ms/frame (=" << float(m_numFrames) << "fps)"; m_numFrames = 0; m_lastFrameTime.restart(); } @@ -135,7 +135,7 @@ void Abstract3DRenderer::render(const GLuint defaultFboHandle) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } -QString Abstract3DRenderer::generateValueLabel(const QString &format, qreal value) +QString Abstract3DRenderer::generateValueLabel(const QString &format, float value) { QString valueLabelFormat = format; Utils::ParamType valueParamType = Utils::findFormatParamType(valueLabelFormat); @@ -324,7 +324,7 @@ void Abstract3DRenderer::updateAxisLabels(Q3DAbstractAxis::AxisOrientation orien axisCacheForOrientation(orientation).setLabels(labels); } -void Abstract3DRenderer::updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, qreal min, qreal max) +void Abstract3DRenderer::updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, float min, float max) { AxisRenderCache &cache = axisCacheForOrientation(orientation); cache.setMin(min); diff --git a/src/datavisualization/engine/abstract3drenderer_p.h b/src/datavisualization/engine/abstract3drenderer_p.h index 37ac69f3..300d75ca 100644 --- a/src/datavisualization/engine/abstract3drenderer_p.h +++ b/src/datavisualization/engine/abstract3drenderer_p.h @@ -102,7 +102,7 @@ protected: GLint m_numFrames; #endif - QString generateValueLabel(const QString &format, qreal value); + QString generateValueLabel(const QString &format, float value); public: virtual ~Abstract3DRenderer(); @@ -137,7 +137,7 @@ public: virtual void updateAxisType(Q3DAbstractAxis::AxisOrientation orientation, Q3DAbstractAxis::AxisType type); virtual void updateAxisTitle(Q3DAbstractAxis::AxisOrientation orientation, const QString &title); virtual void updateAxisLabels(Q3DAbstractAxis::AxisOrientation orientation, const QStringList &labels); - virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, qreal min, qreal max); + virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, float min, float max); virtual void updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count); virtual void updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count); virtual void updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientation orientation, const QString &format); diff --git a/src/datavisualization/engine/axisrendercache.cpp b/src/datavisualization/engine/axisrendercache.cpp index 55ac0765..f7960b2b 100644 --- a/src/datavisualization/engine/axisrendercache.cpp +++ b/src/datavisualization/engine/axisrendercache.cpp @@ -24,8 +24,8 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE AxisRenderCache::AxisRenderCache() : m_type(Q3DAbstractAxis::AxisTypeNone), - m_min(0.0), - m_max(10.0), + m_min(0.0f), + m_max(10.0f), m_segmentCount(5), m_subSegmentCount(1), m_font(QFont(QStringLiteral("Arial"))), @@ -58,8 +58,8 @@ void AxisRenderCache::setType(Q3DAbstractAxis::AxisType type) // If type is set, it means completely new axis instance, so clear all old data m_labels.clear(); m_title.clear(); - m_min = 0.0; - m_max = 10.0; + m_min = 0.0f; + m_max = 10.0f; m_segmentCount = 5; m_subSegmentCount = 1; m_labelFormat.clear(); @@ -109,13 +109,13 @@ void AxisRenderCache::setLabels(const QStringList &labels) } } -void AxisRenderCache::setMin(qreal min) +void AxisRenderCache::setMin(float min) { m_min = min; updateSegmentStep(); } -void AxisRenderCache::setMax(qreal max) +void AxisRenderCache::setMax(float max) { m_max = max; updateSegmentStep(); diff --git a/src/datavisualization/engine/axisrendercache_p.h b/src/datavisualization/engine/axisrendercache_p.h index 0bb1cf92..cddc7839 100644 --- a/src/datavisualization/engine/axisrendercache_p.h +++ b/src/datavisualization/engine/axisrendercache_p.h @@ -51,10 +51,10 @@ public: inline const QString &title() { return m_title; } void setLabels(const QStringList &labels); inline const QStringList &labels() { return m_labels; } - void setMin(qreal min); - inline qreal min() { return m_min; } - void setMax(qreal max); - inline qreal max() { return m_max; } + void setMin(float min); + inline float min() { return m_min; } + void setMax(float max); + inline float max() { return m_max; } void setSegmentCount(int count); inline int segmentCount() const { return m_segmentCount; } void setSubSegmentCount(int count); @@ -79,8 +79,8 @@ private: Q3DAbstractAxis::AxisType m_type; QString m_title; QStringList m_labels; - qreal m_min; - qreal m_max; + float m_min; + float m_max; int m_segmentCount; int m_subSegmentCount; QString m_labelFormat; diff --git a/src/datavisualization/engine/bars3dcontroller.cpp b/src/datavisualization/engine/bars3dcontroller.cpp index f289de46..cb7ba5cb 100644 --- a/src/datavisualization/engine/bars3dcontroller.cpp +++ b/src/datavisualization/engine/bars3dcontroller.cpp @@ -408,7 +408,7 @@ void Bars3DController::adjustAxisRanges() int rowCount = proxy->rowCount(); if (rowCount) rowCount--; - categoryAxisX->dptr()->setRange(0.0, qreal(rowCount)); + categoryAxisX->dptr()->setRange(0.0f, float(rowCount)); } Q3DCategoryAxis *categoryAxisZ = static_cast<Q3DCategoryAxis *>(m_axisZ); @@ -420,7 +420,7 @@ void Bars3DController::adjustAxisRanges() } if (columnCount) columnCount--; - categoryAxisZ->dptr()->setRange(0.0, qreal(columnCount)); + categoryAxisZ->dptr()->setRange(0.0f, float(columnCount)); } Q3DValueAxis *valueAxis = static_cast<Q3DValueAxis *>(m_axisY); @@ -432,11 +432,11 @@ void Bars3DController::adjustAxisRanges() if (limits.first < 0) { // Call private implementation to avoid unsetting auto adjust flag valueAxis->dptr()->setRange(limits.first, limits.second); - } else if (limits.second == 0.0) { + } else if (limits.second == 0.0f) { // Only zero value values in data set, set range to something. - valueAxis->dptr()->setRange(0.0, 1.0); + valueAxis->dptr()->setRange(0.0f, 1.0f); } else { - valueAxis->dptr()->setRange(0.0, limits.second); + valueAxis->dptr()->setRange(0.0f, limits.second); } } } diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp index c96c33dc..c243c32b 100644 --- a/src/datavisualization/engine/bars3drenderer.cpp +++ b/src/datavisualization/engine/bars3drenderer.cpp @@ -214,7 +214,7 @@ void Bars3DRenderer::updateData() if (dataRow) { int dataColIndex = minCol; for (; j < updateSize ; j++) { - qreal value = dataRow->at(dataColIndex).value(); + float value = dataRow->at(dataColIndex).value(); if (!m_noZeroInRange) { heightValue = GLfloat(value); } else { @@ -223,7 +223,7 @@ void Bars3DRenderer::updateData() heightValue = value - m_axisCacheY.min(); if (heightValue < 0.0f) heightValue = 0.0f; - } else if (m_axisCacheY.max() < 0.0) { + } else if (m_axisCacheY.max() < 0.0f) { heightValue = value - m_axisCacheY.max(); if (heightValue > 0.0f) heightValue = 0.0f; @@ -236,7 +236,7 @@ void Bars3DRenderer::updateData() } } for (; j < m_renderingArrays.at(series).at(i).size(); j++) { - m_renderingArrays[series][i][j].setValue(0.0); + m_renderingArrays[series][i][j].setValue(0.0f); m_renderingArrays[series][i][j].setHeight(0.0f); } dataRowIndex++; @@ -263,7 +263,7 @@ void Bars3DRenderer::updateScene(Q3DScene *scene) if (m_hasNegativeValues) scene->activeCamera()->setMinYRotation(-90.0); else - scene->activeCamera()->setMinYRotation(0.0); + scene->activeCamera()->setMinYRotation(0.0f); if (m_hasHeightAdjustmentChanged) { // Set initial camera position. Also update if height adjustment has changed. @@ -580,7 +580,7 @@ void Bars3DRenderer::drawSlicedScene(const LabelItem &xLabel, // TODO: Make user controllable (QTRD-2546) if (!sliceGridLabels) { // Draw values - if (item->height() != 0.0f || (!m_noZeroInRange && item->value() == 0.0)) { + if (item->height() != 0.0f || (!m_noZeroInRange && item->value() == 0.0f)) { m_drawer->drawLabel(*item, item->sliceLabelItem(), viewMatrix, projectionMatrix, valuePositionComp, sliceValueRotation, item->height(), m_cachedSelectionMode, m_labelShader, m_labelObj, activeCamera, @@ -912,13 +912,13 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) MVPMatrix = projectionViewMatrix * modelMatrix; //#if !defined(QT_OPENGL_ES_2) - // QVector3D barColor = QVector3D((GLdouble)row / 32767.0, - // (GLdouble)bar / 32767.0, - // 0.0); + // QVector3D barColor = QVector3D(GLfloat(row) / 32767.0f, + // GLfloat(bar) / 32767.0f, + // 0.0f); //#else - QVector3D barColor = QVector3D((GLdouble)row / 255.0, - (GLdouble)bar / 255.0, - (GLdouble)series / 255.0); + QVector3D barColor = QVector3D(GLfloat(row) / 255.0f, + GLfloat(bar) / 255.0f, + GLfloat(series) / 255.0f); //#endif m_selectionShader->setUniformValue(m_selectionShader->MVP(), MVPMatrix); @@ -1455,8 +1455,8 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle) modelMatrix.scale(gridLineScaler); itModelMatrix.scale(gridLineScaler); if (m_zFlipped) { - modelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); - itModelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); + modelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); + itModelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); } MVPMatrix = projectionViewMatrix * modelMatrix; @@ -1807,8 +1807,8 @@ void Bars3DRenderer::updateBarSpecs(GLfloat thicknessRatio, const QSizeF &spacin calculateSceneScalingFactors(); } -void Bars3DRenderer::updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, qreal min, - qreal max) +void Bars3DRenderer::updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, float min, + float max) { Abstract3DRenderer::updateAxisRange(orientation, min, max); @@ -1974,7 +1974,7 @@ void Bars3DRenderer::calculateHeightAdjustment() GLfloat newAdjustment = 0.0f; GLfloat maxAbs = qFabs(m_axisCacheY.max()); - if (m_axisCacheY.max() < 0.0) { + if (m_axisCacheY.max() < 0.0f) { m_heightNormalizer = GLfloat(qFabs(m_axisCacheY.min()) - qFabs(m_axisCacheY.max())); maxAbs = qFabs(m_axisCacheY.max()) - qFabs(m_axisCacheY.min()); } else { @@ -1982,7 +1982,7 @@ void Bars3DRenderer::calculateHeightAdjustment() } // Height fractions are used in gradient calculations and are therefore doubled - if (m_axisCacheY.max() < 0.0 || m_axisCacheY.min() > 0.0) { + if (m_axisCacheY.max() < 0.0f || m_axisCacheY.min() > 0.0f) { m_noZeroInRange = true; m_gradientFraction = 2.0f; } else { diff --git a/src/datavisualization/engine/bars3drenderer_p.h b/src/datavisualization/engine/bars3drenderer_p.h index 08db5e06..fa2e1268 100644 --- a/src/datavisualization/engine/bars3drenderer_p.h +++ b/src/datavisualization/engine/bars3drenderer_p.h @@ -133,7 +133,7 @@ public slots: void updateSelectedBar(const QPoint &position, const QBar3DSeries *series); // Overloaded from abstract renderer - virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, qreal min, qreal max); + virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, float min, float max); signals: void barClicked(QPoint position, QBar3DSeries *series); diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp index dc149c4d..5564b6eb 100644 --- a/src/datavisualization/engine/drawer.cpp +++ b/src/datavisualization/engine/drawer.cpp @@ -319,10 +319,10 @@ void Drawer::drawLabel(const AbstractRenderItem &item, const LabelItem &labelIte modelMatrix.rotate(rotQuaternion); if (useDepth && !rotateAlong) { - qreal yComp = qreal(qRadiansToDegrees(qTan(positionComp.y() / cameraDistance))); + float yComp = float(qRadiansToDegrees(qTan(positionComp.y() / cameraDistance))); // Apply negative camera rotations to keep labels facing camera - qreal camRotationX = camera->xRotation(); - qreal camRotationY = camera->yRotation(); + float camRotationX = camera->xRotation(); + float camRotationY = camera->yRotation(); modelMatrix.rotate(-camRotationX, 0.0f, 1.0f, 0.0f); modelMatrix.rotate(-camRotationY - yComp, 1.0f, 0.0f, 0.0f); } diff --git a/src/datavisualization/engine/q3dbars.cpp b/src/datavisualization/engine/q3dbars.cpp index 93901811..9b2b3646 100644 --- a/src/datavisualization/engine/q3dbars.cpp +++ b/src/datavisualization/engine/q3dbars.cpp @@ -253,7 +253,7 @@ void Q3DBars::setHeight(const int height) * Bar thickness ratio between X and Z dimensions. 1.0 means bars are as wide as they are deep, 0.5 * makes them twice as deep as they are wide. It is preset to \c 1.0 by default. */ -void Q3DBars::setBarThickness(qreal thicknessRatio) +void Q3DBars::setBarThickness(float thicknessRatio) { if (thicknessRatio != barThickness()) { d_ptr->m_shared->setBarSpecs(GLfloat(thicknessRatio), barSpacing(), isBarSpacingRelative()); @@ -261,7 +261,7 @@ void Q3DBars::setBarThickness(qreal thicknessRatio) } } -qreal Q3DBars::barThickness() +float Q3DBars::barThickness() { return d_ptr->m_shared->barThickness(); } diff --git a/src/datavisualization/engine/q3dbars.h b/src/datavisualization/engine/q3dbars.h index eb35f02d..15199b7c 100644 --- a/src/datavisualization/engine/q3dbars.h +++ b/src/datavisualization/engine/q3dbars.h @@ -40,7 +40,7 @@ class QT_DATAVISUALIZATION_EXPORT Q3DBars : public Q3DWindow Q_PROPERTY(QtDataVisualization::QDataVis::SelectionFlags selectionMode READ selectionMode WRITE setSelectionMode NOTIFY selectionModeChanged) Q_PROPERTY(QtDataVisualization::QDataVis::LabelStyle labelStyle READ labelStyle WRITE setLabelStyle NOTIFY labelStyleChanged) Q_PROPERTY(QtDataVisualization::QDataVis::ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality NOTIFY shadowQualityChanged) - Q_PROPERTY(qreal barThickness READ barThickness WRITE setBarThickness NOTIFY barThicknessChanged) + Q_PROPERTY(float barThickness READ barThickness WRITE setBarThickness NOTIFY barThicknessChanged) Q_PROPERTY(QSizeF barSpacing READ barSpacing WRITE setBarSpacing NOTIFY barSpacingChanged) Q_PROPERTY(bool barSpacingRelative READ isBarSpacingRelative WRITE setBarSpacingRelative NOTIFY barSpacingRelativeChanged) Q_PROPERTY(QString meshFileName READ meshFileName WRITE setMeshFileName NOTIFY meshFileNameChanged) @@ -71,8 +71,8 @@ public: void setTheme(Q3DTheme *theme); Q3DTheme *theme() const; - void setBarThickness(qreal thicknessRatio); - qreal barThickness(); + void setBarThickness(float thicknessRatio); + float barThickness(); void setBarSpacing(QSizeF spacing); QSizeF barSpacing(); @@ -137,7 +137,7 @@ signals: void selectionModeChanged(QDataVis::SelectionFlags mode); void labelStyleChanged(QDataVis::LabelStyle style); void shadowQualityChanged(QDataVis::ShadowQuality quality); - void barThicknessChanged(qreal thicknessRatio); + void barThicknessChanged(float thicknessRatio); void barSpacingChanged(QSizeF spacing); void barSpacingRelativeChanged(bool relative); void meshFileNameChanged(QString filename); diff --git a/src/datavisualization/engine/q3dcamera.cpp b/src/datavisualization/engine/q3dcamera.cpp index d2bbe275..d70645e0 100644 --- a/src/datavisualization/engine/q3dcamera.cpp +++ b/src/datavisualization/engine/q3dcamera.cpp @@ -98,16 +98,16 @@ void Q3DCamera::copyValuesFrom(const Q3DCamera &source) * This property contains the X-rotation angle of the camera around the target point in degrees starting from * the current base position set by the setBaseOrientation() methods. */ -qreal Q3DCamera::xRotation() const { +float Q3DCamera::xRotation() const { return d_ptr->m_xRotation; } -void Q3DCamera::setXRotation(qreal rotation) +void Q3DCamera::setXRotation(float rotation) { if (d_ptr->m_wrapXRotation) rotation = Utils::wrapValue(rotation, d_ptr->m_minXRotation, d_ptr->m_maxXRotation); else - rotation = qBound(qreal(d_ptr->m_minXRotation), qreal(rotation), qreal(d_ptr->m_maxXRotation)); + rotation = qBound(float(d_ptr->m_minXRotation), float(rotation), float(d_ptr->m_maxXRotation)); if (d_ptr->m_xRotation != rotation) { d_ptr->setXRotation(rotation); @@ -126,16 +126,16 @@ void Q3DCamera::setXRotation(qreal rotation) * This property contains the Y-rotation angle of the camera around the target point in degrees starting from * the current base position set by the setBaseOrientation() methods. */ -qreal Q3DCamera::yRotation() const { +float Q3DCamera::yRotation() const { return d_ptr->m_yRotation; } -void Q3DCamera::setYRotation(qreal rotation) +void Q3DCamera::setYRotation(float rotation) { if (d_ptr->m_wrapYRotation) rotation = Utils::wrapValue(rotation, d_ptr->m_minYRotation, d_ptr->m_maxYRotation); else - rotation = qBound(qreal(d_ptr->m_minYRotation), qreal(rotation), qreal(d_ptr->m_maxYRotation)); + rotation = qBound(float(d_ptr->m_minYRotation), float(rotation), float(d_ptr->m_maxYRotation)); if (d_ptr->m_yRotation != rotation) { d_ptr->setYRotation(rotation); @@ -152,12 +152,12 @@ void Q3DCamera::setYRotation(qreal rotation) * \property Q3DCamera::minXRotation * * This property contains the current minimum X-rotation for the camera. - * The full circle range is [-180,180] and the minimum value is limited to -180. + * The full circle range is [-180, 180] and the minimum value is limited to -180. * Also the value can't be higher than the maximum, and is adjusted if necessary. * * \sa wrapXRotation, maxXRotation */ -qreal Q3DCamera::minXRotation() const +float Q3DCamera::minXRotation() const { return d_ptr->m_minXRotation; } @@ -165,9 +165,9 @@ qreal Q3DCamera::minXRotation() const /*! * \internal */ -void Q3DCamera::setMinXRotation(qreal minRotation) +void Q3DCamera::setMinXRotation(float minRotation) { - minRotation = qBound(qreal(-180.0), minRotation, qreal(180.0)); + minRotation = qBound(-180.0f, minRotation, 180.0f); if (minRotation > d_ptr->m_maxXRotation) minRotation = d_ptr->m_maxXRotation; @@ -189,7 +189,7 @@ void Q3DCamera::setMinXRotation(qreal minRotation) * * \sa wrapYRotation, maxYRotation */ -qreal Q3DCamera::minYRotation() const +float Q3DCamera::minYRotation() const { return d_ptr->m_minYRotation; } @@ -197,9 +197,9 @@ qreal Q3DCamera::minYRotation() const /*! * \internal */ -void Q3DCamera::setMinYRotation(qreal minRotation) +void Q3DCamera::setMinYRotation(float minRotation) { - minRotation = qBound(qreal(-90.0), minRotation, qreal(90.0)); + minRotation = qBound(-90.0f, minRotation, 90.0f); if (minRotation > d_ptr->m_maxYRotation) minRotation = d_ptr->m_maxYRotation; @@ -221,7 +221,7 @@ void Q3DCamera::setMinYRotation(qreal minRotation) * * \sa wrapXRotation, minXRotation */ -qreal Q3DCamera::maxXRotation() const +float Q3DCamera::maxXRotation() const { return d_ptr->m_maxXRotation; } @@ -229,9 +229,9 @@ qreal Q3DCamera::maxXRotation() const /*! * \internal */ -void Q3DCamera::setMaxXRotation(qreal maxRotation) +void Q3DCamera::setMaxXRotation(float maxRotation) { - maxRotation = qBound(qreal(-180.0), maxRotation, qreal(180.0)); + maxRotation = qBound(-180.0f, maxRotation, 180.0f); if (maxRotation < d_ptr->m_minXRotation) maxRotation = d_ptr->m_minXRotation; @@ -254,7 +254,7 @@ void Q3DCamera::setMaxXRotation(qreal maxRotation) * * \sa wrapYRotation, minYRotation */ -qreal Q3DCamera::maxYRotation() const +float Q3DCamera::maxYRotation() const { return d_ptr->m_maxYRotation; } @@ -262,9 +262,9 @@ qreal Q3DCamera::maxYRotation() const /*! * \internal */ -void Q3DCamera::setMaxYRotation(qreal maxRotation) +void Q3DCamera::setMaxYRotation(float maxRotation) { - maxRotation = qBound(qreal(-90.0), maxRotation, qreal(90.0)); + maxRotation = qBound(-90.0f, maxRotation, 90.0f); if (maxRotation < d_ptr->m_minYRotation) maxRotation = d_ptr->m_minYRotation; @@ -354,123 +354,123 @@ void Q3DCamera::setCameraPreset(QDataVis::CameraPreset preset) { switch (preset) { case QDataVis::CameraPresetFrontLow: { - setXRotation(0.0); - setYRotation(0.0); + setXRotation(0.0f); + setYRotation(0.0f); break; } case QDataVis::CameraPresetFront: { - setXRotation(0.0); - setYRotation(22.5); + setXRotation(0.0f); + setYRotation(22.5f); break; } case QDataVis::CameraPresetFrontHigh: { - setXRotation(0.0); - setYRotation(45.0); + setXRotation(0.0f); + setYRotation(45.0f); break; } case QDataVis::CameraPresetLeftLow: { - setXRotation(90.0); - setYRotation(0.0); + setXRotation(90.0f); + setYRotation(0.0f); break; } case QDataVis::CameraPresetLeft: { - setXRotation(90.0); - setYRotation(22.5); + setXRotation(90.0f); + setYRotation(22.5f); break; } case QDataVis::CameraPresetLeftHigh: { - setXRotation(90.0); - setYRotation(45.0); + setXRotation(90.0f); + setYRotation(45.0f); break; } case QDataVis::CameraPresetRightLow: { - setXRotation(-90.0); - setYRotation(0.0); + setXRotation(-90.0f); + setYRotation(0.0f); break; } case QDataVis::CameraPresetRight: { - setXRotation(-90.0); - setYRotation(22.5); + setXRotation(-90.0f); + setYRotation(22.5f); break; } case QDataVis::CameraPresetRightHigh: { - setXRotation(-90.0); - setYRotation(45.0); + setXRotation(-90.0f); + setYRotation(45.0f); break; } case QDataVis::CameraPresetBehindLow: { - setXRotation(180.0); - setYRotation(0.0); + setXRotation(180.0f); + setYRotation(0.0f); break; } case QDataVis::CameraPresetBehind: { - setXRotation(180.0); - setYRotation(22.5); + setXRotation(180.0f); + setYRotation(22.5f); break; } case QDataVis::CameraPresetBehindHigh: { - setXRotation(180.0); - setYRotation(45.0); + setXRotation(180.0f); + setYRotation(45.0f); break; } case QDataVis::CameraPresetIsometricLeft: { - setXRotation(45.0); - setYRotation(22.5); + setXRotation(45.0f); + setYRotation(22.5f); break; } case QDataVis::CameraPresetIsometricLeftHigh: { - setXRotation(45.0); - setYRotation(45.0); + setXRotation(45.0f); + setYRotation(45.0f); break; } case QDataVis::CameraPresetIsometricRight: { - setXRotation(-45.0); - setYRotation(22.5); + setXRotation(-45.0f); + setYRotation(22.5f); break; } case QDataVis::CameraPresetIsometricRightHigh: { - setXRotation(-45.0); - setYRotation(45.0); + setXRotation(-45.0f); + setYRotation(45.0f); break; } case QDataVis::CameraPresetDirectlyAbove: { - setXRotation(0.0); - setYRotation(90.0); + setXRotation(0.0f); + setYRotation(90.0f); break; } case QDataVis::CameraPresetDirectlyAboveCW45: { - setXRotation(-45.0); - setYRotation(90.0); + setXRotation(-45.0f); + setYRotation(90.0f); break; } case QDataVis::CameraPresetDirectlyAboveCCW45: { - setXRotation(45.0); - setYRotation(90.0); + setXRotation(45.0f); + setYRotation(90.0f); break; } case QDataVis::CameraPresetFrontBelow: { - setXRotation(0.0); - setYRotation(-45.0); + setXRotation(0.0f); + setYRotation(-45.0f); break; } case QDataVis::CameraPresetLeftBelow: { - setXRotation(90.0); - setYRotation(-45.0); + setXRotation(90.0f); + setYRotation(-45.0f); break; } case QDataVis::CameraPresetRightBelow: { - setXRotation(-90.0); - setYRotation(-45.0); + setXRotation(-90.0f); + setYRotation(-45.0f); break; } case QDataVis::CameraPresetBehindBelow: { - setXRotation(180.0); - setYRotation(-45.0); + setXRotation(180.0f); + setYRotation(-45.0f); break; } case QDataVis::CameraPresetDirectlyBelow: { - setXRotation(0.0); - setYRotation(-90.0); + setXRotation(0.0f); + setYRotation(-90.0f); break; } default: @@ -514,8 +514,8 @@ void Q3DCamera::setZoomLevel(int zoomLevel) * \return Calculated position relative to this camera's position. */ QVector3D Q3DCamera::calculatePositionRelativeToCamera(const QVector3D &relativePosition, - qreal fixedRotation, - qreal distanceModifier) const + float fixedRotation, + float distanceModifier) const { // Move the position with camera GLfloat radiusFactor = cameraDistance * (1.5f + distanceModifier); @@ -581,9 +581,9 @@ void Q3DCamera::setWrapYRotation(bool isEnabled) * Utility function that sets the camera rotations and distance.\a horizontal and \a vertical define the camera rotations to be used. * Optional \a zoom parameter can be given to set the zoom of the camera in range of 10-500%. */ -void Q3DCamera::setCameraPosition(qreal horizontal, qreal vertical, qreal zoom) +void Q3DCamera::setCameraPosition(float horizontal, float vertical, float zoom) { - setZoomLevel(qBound(qreal(10.0), zoom, qreal(500.0))); + setZoomLevel(qBound(10.0f, zoom, 500.0f)); setXRotation(horizontal); setYRotation(vertical); } @@ -591,12 +591,12 @@ void Q3DCamera::setCameraPosition(qreal horizontal, qreal vertical, qreal zoom) Q3DCameraPrivate::Q3DCameraPrivate(Q3DCamera *q) : q_ptr(q), m_isViewMatrixUpdateActive(true), - m_xRotation(0.0), - m_yRotation(0.0), - m_minXRotation(-180.0), - m_minYRotation(0.0), - m_maxXRotation(180.0), - m_maxYRotation(90.0), + m_xRotation(0.0f), + m_yRotation(0.0f), + m_minXRotation(-180.0f), + m_minYRotation(0.0f), + m_maxXRotation(180.0f), + m_maxYRotation(90.0f), m_wrapXRotation(true), m_wrapYRotation(false), m_zoomLevel(100), @@ -619,7 +619,7 @@ void Q3DCameraPrivate::sync(Q3DCamera &other) } } -void Q3DCameraPrivate::setXRotation(const qreal rotation) +void Q3DCameraPrivate::setXRotation(const float rotation) { if (m_xRotation != rotation) { m_xRotation = rotation; @@ -627,7 +627,7 @@ void Q3DCameraPrivate::setXRotation(const qreal rotation) } } -void Q3DCameraPrivate::setYRotation(const qreal rotation) +void Q3DCameraPrivate::setYRotation(const float rotation) { if (m_yRotation != rotation) { m_yRotation = rotation; @@ -635,7 +635,7 @@ void Q3DCameraPrivate::setYRotation(const qreal rotation) } } -void Q3DCameraPrivate::setMinXRotation(const qreal rotation) +void Q3DCameraPrivate::setMinXRotation(const float rotation) { if (m_minXRotation != rotation) { m_minXRotation = rotation; @@ -643,7 +643,7 @@ void Q3DCameraPrivate::setMinXRotation(const qreal rotation) } } -void Q3DCameraPrivate::setMinYRotation(const qreal rotation) +void Q3DCameraPrivate::setMinYRotation(const float rotation) { if (m_minYRotation != rotation) { m_minYRotation = rotation; @@ -651,7 +651,7 @@ void Q3DCameraPrivate::setMinYRotation(const qreal rotation) } } -void Q3DCameraPrivate::setMaxXRotation(const qreal rotation) +void Q3DCameraPrivate::setMaxXRotation(const float rotation) { if (m_maxXRotation != rotation) { m_maxXRotation = rotation; @@ -659,7 +659,7 @@ void Q3DCameraPrivate::setMaxXRotation(const qreal rotation) } } -void Q3DCameraPrivate::setMaxYRotation(const qreal rotation) +void Q3DCameraPrivate::setMaxYRotation(const float rotation) { if (m_maxYRotation != rotation) { m_maxYRotation = rotation; @@ -669,7 +669,7 @@ void Q3DCameraPrivate::setMaxYRotation(const qreal rotation) // Recalculates the view matrix based on the currently set base orientation, rotation and zoom level values. // zoomAdjustment is adjustment to ensure that the 3D visualization stays inside the view area in the 100% zoom. -void Q3DCameraPrivate::updateViewMatrix(qreal zoomAdjustment) +void Q3DCameraPrivate::updateViewMatrix(float zoomAdjustment) { if (!m_isViewMatrixUpdateActive) return; diff --git a/src/datavisualization/engine/q3dcamera.h b/src/datavisualization/engine/q3dcamera.h index 8e93ebb2..db322518 100644 --- a/src/datavisualization/engine/q3dcamera.h +++ b/src/datavisualization/engine/q3dcamera.h @@ -32,12 +32,12 @@ class Q3DCameraPrivate; class QT_DATAVISUALIZATION_EXPORT Q3DCamera : public Q3DObject { Q_OBJECT - Q_PROPERTY(qreal xRotation READ xRotation WRITE setXRotation NOTIFY xRotationChanged) - Q_PROPERTY(qreal yRotation READ yRotation WRITE setYRotation NOTIFY yRotationChanged) - Q_PROPERTY(qreal minXRotation READ minXRotation NOTIFY minXRotationChanged) - Q_PROPERTY(qreal minYRotation READ minYRotation NOTIFY minYRotationChanged) - Q_PROPERTY(qreal maxXRotation READ maxXRotation NOTIFY maxXRotationChanged) - Q_PROPERTY(qreal maxYRotation READ maxYRotation NOTIFY maxYRotationChanged) + Q_PROPERTY(float xRotation READ xRotation WRITE setXRotation NOTIFY xRotationChanged) + Q_PROPERTY(float yRotation READ yRotation WRITE setYRotation NOTIFY yRotationChanged) + Q_PROPERTY(float minXRotation READ minXRotation NOTIFY minXRotationChanged) + Q_PROPERTY(float minYRotation READ minYRotation NOTIFY minYRotationChanged) + Q_PROPERTY(float maxXRotation READ maxXRotation NOTIFY maxXRotationChanged) + Q_PROPERTY(float maxYRotation READ maxYRotation NOTIFY maxYRotationChanged) Q_PROPERTY(int zoomLevel READ zoomLevel WRITE setZoomLevel NOTIFY zoomLevelChanged) Q_PROPERTY(QMatrix4x4 viewMatrix READ viewMatrix WRITE setViewMatrix NOTIFY viewMatrixChanged) Q_PROPERTY(QtDataVisualization::QDataVis::CameraPreset cameraPreset READ cameraPreset WRITE setCameraPreset NOTIFY cameraPresetChanged) @@ -50,16 +50,16 @@ public: Q3DCamera(QObject *parent = 0); virtual ~Q3DCamera(); - qreal xRotation() const; - void setXRotation(qreal rotation); - qreal yRotation() const; - void setYRotation(qreal rotation); + float xRotation() const; + void setXRotation(float rotation); + float yRotation() const; + void setYRotation(float rotation); - qreal minXRotation() const; - qreal maxXRotation() const; + float minXRotation() const; + float maxXRotation() const; - qreal minYRotation() const; - qreal maxYRotation() const; + float minYRotation() const; + float maxYRotation() const; bool wrapXRotation() const; void setWrapXRotation(bool isEnabled); @@ -86,17 +86,17 @@ public: const QVector3D &defaultUp); QVector3D calculatePositionRelativeToCamera(const QVector3D &relativePosition, - qreal fixedRotation, - qreal distanceModifier) const; - void setCameraPosition(qreal horizontal, qreal vertical, qreal distance = 100.0); + float fixedRotation, + float distanceModifier) const; + void setCameraPosition(float horizontal, float vertical, float distance = 100.0f); signals: - void xRotationChanged(qreal rotation); - void yRotationChanged(qreal rotation); - void minXRotationChanged(qreal rotation); - void minYRotationChanged(qreal rotation); - void maxXRotationChanged(qreal rotation); - void maxYRotationChanged(qreal rotation); + void xRotationChanged(float rotation); + void yRotationChanged(float rotation); + void minXRotationChanged(float rotation); + void minYRotationChanged(float rotation); + void maxXRotationChanged(float rotation); + void maxYRotationChanged(float rotation); void zoomLevelChanged(int zoomLevel); void viewMatrixChanged(QMatrix4x4 viewMatrix); void cameraPresetChanged(QDataVis::CameraPreset preset); @@ -105,10 +105,10 @@ signals: void wrapYRotationChanged(bool isEnabled); protected: - void setMinXRotation(qreal rotation); - void setMinYRotation(qreal rotation); - void setMaxXRotation(qreal rotation); - void setMaxYRotation(qreal rotation); + void setMinXRotation(float rotation); + void setMinYRotation(float rotation); + void setMaxXRotation(float rotation); + void setMaxYRotation(float rotation); private: QScopedPointer<Q3DCameraPrivate> d_ptr; diff --git a/src/datavisualization/engine/q3dcamera_p.h b/src/datavisualization/engine/q3dcamera_p.h index e0528dcc..63f47cf0 100644 --- a/src/datavisualization/engine/q3dcamera_p.h +++ b/src/datavisualization/engine/q3dcamera_p.h @@ -44,14 +44,14 @@ public: void sync(Q3DCamera &other); - void setXRotation(qreal rotation); - void setYRotation(qreal rotation); - void setMinXRotation(qreal rotation); - void setMinYRotation(qreal rotation); - void setMaxXRotation(qreal rotation); - void setMaxYRotation(qreal rotation); - - void updateViewMatrix(qreal zoomAdjustment); + void setXRotation(float rotation); + void setYRotation(float rotation); + void setMinXRotation(float rotation); + void setMinYRotation(float rotation); + void setMaxXRotation(float rotation); + void setMaxYRotation(float rotation); + + void updateViewMatrix(float zoomAdjustment); public: Q3DCamera *q_ptr; diff --git a/src/datavisualization/engine/q3dscene.cpp b/src/datavisualization/engine/q3dscene.cpp index 46b374cf..de6a3c97 100644 --- a/src/datavisualization/engine/q3dscene.cpp +++ b/src/datavisualization/engine/q3dscene.cpp @@ -332,12 +332,12 @@ void Q3DScene::setActiveLight(Q3DLight *light) * This property contains the current device pixel ratio that is used when mapping input * coordinates to pixel coordinates. */ -qreal Q3DScene::devicePixelRatio() const +float Q3DScene::devicePixelRatio() const { return d_ptr->m_devicePixelRatio; } -void Q3DScene::setDevicePixelRatio(qreal pixelRatio) +void Q3DScene::setDevicePixelRatio(float pixelRatio) { if (d_ptr->m_devicePixelRatio != pixelRatio) { d_ptr->m_devicePixelRatio = pixelRatio; @@ -352,7 +352,7 @@ void Q3DScene::setDevicePixelRatio(qreal pixelRatio) * Optional \a distanceModifier modifies the distance of the light from the data visualization. */ void Q3DScene::setLightPositionRelativeToCamera(const QVector3D &relativePosition, - qreal fixedRotation, qreal distanceModifier) + float fixedRotation, float distanceModifier) { d_ptr->m_light->setPosition( d_ptr->m_camera->calculatePositionRelativeToCamera(relativePosition, diff --git a/src/datavisualization/engine/q3dscene.h b/src/datavisualization/engine/q3dscene.h index 52de85bb..14854361 100644 --- a/src/datavisualization/engine/q3dscene.h +++ b/src/datavisualization/engine/q3dscene.h @@ -41,7 +41,7 @@ class QT_DATAVISUALIZATION_EXPORT Q3DScene : public QObject Q_PROPERTY(bool slicingActive READ isSlicingActive WRITE setSlicingActive NOTIFY slicingActiveChanged) Q_PROPERTY(Q3DCamera* activeCamera READ activeCamera WRITE setActiveCamera NOTIFY activeCameraChanged) Q_PROPERTY(Q3DLight* activeLight READ activeLight WRITE setActiveLight NOTIFY activeLightChanged) - Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged) + Q_PROPERTY(float devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged) public: Q3DScene(QObject *parent = 0); @@ -75,12 +75,12 @@ public: Q3DLight *activeLight() const; void setActiveLight(Q3DLight *light); - qreal devicePixelRatio() const; - void setDevicePixelRatio(qreal pixelRatio); + float devicePixelRatio() const; + void setDevicePixelRatio(float pixelRatio); Q_INVOKABLE void setLightPositionRelativeToCamera(const QVector3D &relativePosition, - qreal fixedRotation = 0.0, - qreal distanceModifier = 0.0); + float fixedRotation = 0.0f, + float distanceModifier = 0.0f); private: void emitNeedRender(); @@ -92,7 +92,7 @@ signals: void slicingActiveChanged(bool isSlicingActive); void activeCameraChanged(const Q3DCamera *camera); void activeLightChanged(const Q3DLight *light); - void devicePixelRatioChanged(qreal pixelRatio); + void devicePixelRatioChanged(float pixelRatio); void needRender(); void selectionQueryPositionChanged(const QPoint position); diff --git a/src/datavisualization/engine/q3dscene_p.h b/src/datavisualization/engine/q3dscene_p.h index 4be4d745..d083b592 100644 --- a/src/datavisualization/engine/q3dscene_p.h +++ b/src/datavisualization/engine/q3dscene_p.h @@ -78,7 +78,7 @@ public: QRect m_primarySubViewport; QRect m_secondarySubViewport; bool m_isSecondarySubviewOnTop; - qreal m_devicePixelRatio; + float m_devicePixelRatio; Q3DCamera *m_camera; Q3DLight *m_light; bool m_isUnderSideCameraEnabled; diff --git a/src/datavisualization/engine/q3dsurface.cpp b/src/datavisualization/engine/q3dsurface.cpp index 664f76e7..a84a5ad6 100644 --- a/src/datavisualization/engine/q3dsurface.cpp +++ b/src/datavisualization/engine/q3dsurface.cpp @@ -498,6 +498,7 @@ QList<Q3DValueAxis *> Q3DSurface::axes() const /*! * Modifies the current surface gradient. Sets gradient color to \a color at \a pos. */ +// TODO: Surface gradient should use base color of series void Q3DSurface::setGradientColorAt(qreal pos, const QColor &color) { d_ptr->m_shared->setGradientColorAt(pos, color); diff --git a/src/datavisualization/engine/q3dwindow_p.h b/src/datavisualization/engine/q3dwindow_p.h index 6bef7e10..85ff103a 100644 --- a/src/datavisualization/engine/q3dwindow_p.h +++ b/src/datavisualization/engine/q3dwindow_p.h @@ -51,7 +51,7 @@ public: bool m_updatePending; QOpenGLContext *m_context; Abstract3DController *m_visualController; - qreal m_devicePixelRatio; + float m_devicePixelRatio; }; QT_DATAVISUALIZATION_END_NAMESPACE diff --git a/src/datavisualization/engine/scatter3drenderer.cpp b/src/datavisualization/engine/scatter3drenderer.cpp index 56614746..73864643 100644 --- a/src/datavisualization/engine/scatter3drenderer.cpp +++ b/src/datavisualization/engine/scatter3drenderer.cpp @@ -171,7 +171,6 @@ void Scatter3DRenderer::updateData() for (int i = 0; i < dataSize; i++) { QVector3D dotPos = dataArray.at(i).position(); - // TODO: qreal -> float conversion for axis min/max may cause issues like in surface if ((dotPos.x() >= minX && dotPos.x() <= maxX ) && (dotPos.y() >= minY && dotPos.y() <= maxY) && (dotPos.z() >= minZ && dotPos.z() <= maxZ)) { @@ -183,7 +182,7 @@ void Scatter3DRenderer::updateData() } } } - m_dotSizeScale = (GLfloat)qBound(0.01, (2.0 / qSqrt((qreal)totalDataSize)), 0.1); + m_dotSizeScale = GLfloat(qBound(0.01f, 2.0f / float(qSqrt(qreal(totalDataSize))), 0.1f)); updateSelectedItem(m_selectedItemIndex, m_selectedSeries); } @@ -993,8 +992,8 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) itModelMatrix.scale(gridLineScaler); if (m_zFlipped) { - modelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); - itModelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); + modelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); + itModelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); } MVPMatrix = projectionViewMatrix * modelMatrix; @@ -1054,8 +1053,8 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle) itModelMatrix.scale(gridLineScaler); if (m_zFlipped) { - modelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); - itModelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); + modelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); + itModelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); } MVPMatrix = projectionViewMatrix * modelMatrix; @@ -1552,7 +1551,7 @@ void Scatter3DRenderer::updateTextures() } void Scatter3DRenderer::updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, - qreal min, qreal max) + float min, float max) { Abstract3DRenderer::updateAxisRange(orientation, min, max); } diff --git a/src/datavisualization/engine/scatter3drenderer_p.h b/src/datavisualization/engine/scatter3drenderer_p.h index 6f8f9cbd..31ed08a9 100644 --- a/src/datavisualization/engine/scatter3drenderer_p.h +++ b/src/datavisualization/engine/scatter3drenderer_p.h @@ -140,7 +140,7 @@ public slots: void updateBackgroundEnabled(bool enable); // Overloaded from abstract renderer - virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, qreal min, qreal max); + virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, float min, float max); void updateSelectedItem(int index, const QScatter3DSeries *series); diff --git a/src/datavisualization/engine/selectionpointer.cpp b/src/datavisualization/engine/selectionpointer.cpp index 7065ea8b..3dc699a6 100644 --- a/src/datavisualization/engine/selectionpointer.cpp +++ b/src/datavisualization/engine/selectionpointer.cpp @@ -162,8 +162,8 @@ void SelectionPointer::render(GLuint defaultFboHandle) modelMatrixLabel.translate(m_position + labelAlign); // Position the label towards the camera - qreal camRotationsX = camera->xRotation(); - qreal camRotationsY = camera->yRotation(); + float camRotationsX = camera->xRotation(); + float camRotationsY = camera->yRotation(); if (!m_cachedIsSlicingActivated) { modelMatrixLabel.rotate(-camRotationsX, 0.0f, 1.0f, 0.0f); modelMatrixLabel.rotate(-camRotationsY, 1.0f, 0.0f, 0.0f); diff --git a/src/datavisualization/engine/surface3dcontroller.cpp b/src/datavisualization/engine/surface3dcontroller.cpp index b1271c50..54614576 100644 --- a/src/datavisualization/engine/surface3dcontroller.cpp +++ b/src/datavisualization/engine/surface3dcontroller.cpp @@ -289,21 +289,11 @@ void Surface3DController::setSelectedPoint(const QPoint &position, QSurface3DSer // If the selected point is outside data window, or there is no selected point, disable slicing // TODO: (QTRD-2351) This logic doesn't match the renderer logic for non straight surfaces, // but that logic needs to change anyway, so this is good for now. - float axisMinX = float(m_axisX->min()); - float axisMaxX = float(m_axisX->max()); - float axisMinZ = float(m_axisZ->min()); - float axisMaxZ = float(m_axisZ->max()); - - // Comparisons between float and double are not accurate, so fudge our comparison values - // a little to get all rows and columns into view that need to be visible. - // TODO: Probably unnecessary after QTRD-2622 done - const float fudgeFactor = 0.00001f; - float fudgedAxisXRange = (axisMaxX - axisMinX) * fudgeFactor; - float fudgedAxisZRange = (axisMaxZ - axisMinZ) * fudgeFactor; - axisMinX -= fudgedAxisXRange; - axisMinZ -= fudgedAxisZRange; - axisMaxX += fudgedAxisXRange; - axisMaxZ += fudgedAxisZRange; + float axisMinX = m_axisX->min(); + float axisMaxX = m_axisX->max(); + float axisMinZ = m_axisZ->min(); + float axisMaxZ = m_axisZ->max(); + QSurfaceDataItem item = proxy->array()->at(pos.x())->at(pos.y()); if (item.x() < axisMinX || item.x() > axisMaxX || item.z() < axisMinZ || item.z() > axisMaxZ) { diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index b90b3527..2298aef4 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -282,19 +282,19 @@ void Surface3DRenderer::updateSliceDataModel(const QPoint &point) m_sliceDataArray.reserve(2); QSurfaceDataRow *sliceRow; - qreal adjust = (0.025 * m_heightNormalizer) / 2.0; - qreal stepDown = 2.0 * adjust; + float adjust = (0.025f * m_heightNormalizer) / 2.0f; + float stepDown = 2.0f * adjust; if (m_cachedSelectionMode.testFlag(QDataVis::SelectionRow)) { QSurfaceDataRow *src = m_dataArray.at(row); sliceRow = new QSurfaceDataRow(src->size()); for (int i = 0; i < sliceRow->size(); i++) - (*sliceRow)[i].setPosition(QVector3D(src->at(i).x(), src->at(i).y() + adjust, -1.0)); + (*sliceRow)[i].setPosition(QVector3D(src->at(i).x(), src->at(i).y() + adjust, -1.0f)); } else { sliceRow = new QSurfaceDataRow(m_sampleSpace.height()); for (int i = 0; i < m_sampleSpace.height(); i++) { (*sliceRow)[i].setPosition(QVector3D(m_dataArray.at(i)->at(column).z(), m_dataArray.at(i)->at(column).y() + adjust, - -1.0)); + -1.0f)); } } @@ -303,7 +303,7 @@ void Surface3DRenderer::updateSliceDataModel(const QPoint &point) // Make a duplicate, so that we get a little bit depth QSurfaceDataRow *duplicateRow = new QSurfaceDataRow(*sliceRow); for (int i = 0; i < sliceRow->size(); i++) - (*sliceRow)[i].setPosition(QVector3D(sliceRow->at(i).x(), sliceRow->at(i).y() - stepDown, 1.0)); + (*sliceRow)[i].setPosition(QVector3D(sliceRow->at(i).x(), sliceRow->at(i).y() - stepDown, 1.0f)); m_sliceDataArray << duplicateRow; @@ -332,21 +332,10 @@ QRect Surface3DRenderer::calculateSampleRect(const QSurfaceDataArray &array) int i; bool found; - float axisMinX = float(m_axisCacheX.min()); - float axisMaxX = float(m_axisCacheX.max()); - float axisMinZ = float(m_axisCacheZ.min()); - float axisMaxZ = float(m_axisCacheZ.max()); - - // Comparisons between float and double are not accurate, so fudge our comparison values - // a little to get all rows and columns into view that need to be visible. - // TODO: Probably unnecessary after QTRD-2622 done - const float fudgeFactor = 0.00001f; - float fudgedAxisXRange = (axisMaxX - axisMinX) * fudgeFactor; - float fudgedAxisZRange = (axisMaxZ - axisMinZ) * fudgeFactor; - axisMinX -= fudgedAxisXRange; - axisMinZ -= fudgedAxisZRange; - axisMaxX += fudgedAxisXRange; - axisMaxZ += fudgedAxisZRange; + float axisMinX = m_axisCacheX.min(); + float axisMaxX = m_axisCacheX.max(); + float axisMinZ = m_axisCacheZ.min(); + float axisMaxZ = m_axisCacheZ.max(); // m_minVisibleColumnValue for (i = 0, found = false; i < columnCount; i++) { @@ -1032,7 +1021,7 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) // If we're viewing from below, background object must be flipped if (m_yFlipped) { - modelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); + modelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); modelMatrix.rotate(270.0f - backgroundRotation, 0.0f, 1.0f, 0.0f); } else { modelMatrix.rotate(backgroundRotation, 0.0f, 1.0f, 0.0f); @@ -1284,8 +1273,8 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) itModelMatrix.scale(gridLineScaleY); if (m_zFlipped) { - modelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); - itModelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); + modelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); + itModelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); } MVPMatrix = projectionViewMatrix * modelMatrix; @@ -1336,8 +1325,8 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) itModelMatrix.scale(gridLineScaleX); if (m_zFlipped) { - modelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); - itModelMatrix.rotate(180.0f, 1.0, 0.0, 0.0); + modelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); + itModelMatrix.rotate(180.0f, 1.0f, 0.0f, 0.0f); } MVPMatrix = projectionViewMatrix * modelMatrix; @@ -1829,7 +1818,7 @@ void Surface3DRenderer::surfacePointSelected(const QPoint &point) int row = point.x(); int column = point.y(); - qreal value = qreal(m_dataArray.at(row)->at(column).y()); + float value = m_dataArray.at(row)->at(column).y(); if (!m_selectionPointer) m_selectionPointer = new SelectionPointer(m_drawer); @@ -1870,7 +1859,7 @@ QPoint Surface3DRenderer::selectionIdToSurfacePoint(uint id) return QPoint(row, column); } -QString Surface3DRenderer::createSelectionLabel(qreal value, int column, int row) +QString Surface3DRenderer::createSelectionLabel(float value, int column, int row) { // TODO: Get from correct series once multiple series supported QString labelText = m_visibleSeriesList[0].itemLabelFormat(); diff --git a/src/datavisualization/engine/surface3drenderer_p.h b/src/datavisualization/engine/surface3drenderer_p.h index 2d5c8da9..ab656194 100644 --- a/src/datavisualization/engine/surface3drenderer_p.h +++ b/src/datavisualization/engine/surface3drenderer_p.h @@ -178,7 +178,7 @@ private: void fillIdCorner(uchar *p, uchar r, uchar g, uchar b, uchar a, int stride); void surfacePointSelected(const QPoint &point); QPoint selectionIdToSurfacePoint(uint id); - QString createSelectionLabel(qreal value, int column, int row); + QString createSelectionLabel(float value, int column, int row); #if !defined(QT_OPENGL_ES_2) void updateDepthBuffer(); #endif |