summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/qmlsurface/qml/qmlsurface/main.qml44
-rw-r--r--examples/surface/surfacegraph.cpp8
-rw-r--r--src/datavisualization/data/qabstract3dseries.cpp87
-rw-r--r--src/datavisualization/data/qsurface3dseries.cpp100
-rw-r--r--src/datavisualization/data/qsurface3dseries.h14
-rw-r--r--src/datavisualization/data/qsurface3dseries_p.h4
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc9
-rw-r--r--src/datavisualization/engine/q3dscene.h1
-rw-r--r--src/datavisualization/engine/q3dsurface.cpp37
-rw-r--r--src/datavisualization/engine/q3dsurface.h10
-rw-r--r--src/datavisualization/engine/surface3dcontroller.cpp80
-rw-r--r--src/datavisualization/engine/surface3dcontroller_p.h16
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp41
-rw-r--r--src/datavisualization/engine/surface3drenderer_p.h7
-rw-r--r--src/datavisualization/utils/shaderhelper.cpp4
-rw-r--r--src/datavisualizationqml2/declarativesurface.cpp25
-rw-r--r--src/datavisualizationqml2/declarativesurface_p.h12
-rw-r--r--tests/kinectsurface/surfacedata.cpp2
-rw-r--r--tests/multigraphs/data.cpp17
-rw-r--r--tests/qmlcamera/qml/qmlcamera/main.qml6
-rw-r--r--tests/spectrum/spectrumapp/main.cpp6
-rw-r--r--tests/surfacetest/graphmodifier.cpp4
-rw-r--r--tests/surfacetest/main.cpp4
23 files changed, 283 insertions, 255 deletions
diff --git a/examples/qmlsurface/qml/qmlsurface/main.qml b/examples/qmlsurface/qml/qmlsurface/main.qml
index b2ab7768..a90b916e 100644
--- a/examples/qmlsurface/qml/qmlsurface/main.qml
+++ b/examples/qmlsurface/qml/qmlsurface/main.qml
@@ -58,8 +58,6 @@ Item {
}
shadowQuality: AbstractGraph3D.ShadowQualityMedium
selectionMode: AbstractGraph3D.SelectionSlice | AbstractGraph3D.SelectionItemAndRow
- smoothSurfaceEnabled: true
- surfaceGridEnabled: false
scene.activeCamera.cameraPreset: AbstractGraph3D.CameraPresetIsometricLeft
axisY.min: 0.0
axisY.max: 500.0
@@ -75,6 +73,8 @@ Item {
Surface3DSeries {
id: surfaceSeries
+ flatShadingEnabled: false
+ surfaceGridEnabled: false
ItemModelSurfaceDataProxy {
itemModel: surfaceData.model
@@ -82,16 +82,9 @@ Item {
columnRole: "latitude"
valueRole: "height"
}
- }
- // Since flat is not supported on all platforms, and changes back to smooth
- // asynchronously on those platforms, handle button text on changed
- // signal handler rather than when we set the value.
- onSmoothSurfaceEnabledChanged: {
- if (enabled === true) {
- smoothSurfaceToggle.text = "Show Flat"
- } else {
- smoothSurfaceToggle.text = "Show Smooth"
+ onFlatShadingSupportedChanged: {
+ flatShadingToggle.text = "Flat not supported"
}
}
}
@@ -100,6 +93,8 @@ Item {
// TODO: Kept outside until surface supports multiple added series (QTRD-2579)
Surface3DSeries {
id: heightSeries
+ flatShadingEnabled: false
+ surfaceGridEnabled: false
HeightMapSurfaceDataProxy {
heightMapFile: ":/heightmaps/image"
@@ -119,11 +114,13 @@ Item {
text: "Show Surface Grid"
//! [1]
onClicked: {
- if (surfaceplot.surfaceGridEnabled === false) {
- surfaceplot.surfaceGridEnabled = true;
+ if (surfaceSeries.surfaceGridEnabled === false) {
+ surfaceSeries.surfaceGridEnabled = true;
+ heightSeries.surfaceGridEnabled = true;
text = "Hide Surface Grid"
} else {
- surfaceplot.surfaceGridEnabled = false;
+ surfaceSeries.surfaceGridEnabled = false;
+ heightSeries.surfaceGridEnabled = false;
text = "Show Surface Grid"
}
}
@@ -136,7 +133,7 @@ Item {
width: surfaceGridToggle.width
text: "Hide Surface"
onClicked: {
- if (surfaceplot.seriesList[0].visible === true) {
+ if (surfaceSeries.visible === true) {
surfaceSeries.visible = false;
heightSeries.visible = false;
text = "Show Surface"
@@ -149,16 +146,21 @@ Item {
}
NewButton {
- id: smoothSurfaceToggle
+ id: flatShadingToggle
anchors.top: surfaceToggle.bottom
width: surfaceToggle.width
text: "Show Flat"
+ enabled: surfaceSeries.flatShadingSupported
//! [2]
onClicked: {
- if (surfaceplot.smoothSurfaceEnabled === true) {
- surfaceplot.smoothSurfaceEnabled = false;
+ if (surfaceSeries.flatShadingEnabled === true) {
+ surfaceSeries.flatShadingEnabled = false;
+ heightSeries.flatShadingEnabled = false;
+ text = "Show Flat"
} else {
- surfaceplot.smoothSurfaceEnabled = true;
+ surfaceSeries.flatShadingEnabled = true;
+ heightSeries.flatShadingEnabled = true;
+ text = "Show Smooth"
}
}
//! [2]
@@ -166,8 +168,8 @@ Item {
NewButton {
id: backgroundToggle
- anchors.top: smoothSurfaceToggle.bottom
- width: smoothSurfaceToggle.width
+ anchors.top: flatShadingToggle.bottom
+ width: flatShadingToggle.width
text: "Hide Background"
onClicked: {
if (surfaceplot.theme.backgroundEnabled === true) {
diff --git a/examples/surface/surfacegraph.cpp b/examples/surface/surfacegraph.cpp
index 7008a32b..be9e4573 100644
--- a/examples/surface/surfacegraph.cpp
+++ b/examples/surface/surfacegraph.cpp
@@ -91,8 +91,8 @@ void SurfaceGraph::enableSqrtSinModel(bool enable)
{
if (enable) {
//! [3]
- m_graph->setSurfaceGridEnabled(true);
- m_graph->setSmoothSurfaceEnabled(false);
+ m_sqrtSinSeries->setSurfaceGridEnabled(true);
+ m_sqrtSinSeries->setFlatShadingEnabled(true);
m_graph->axisX()->setLabelFormat("%.2f");
m_graph->axisZ()->setLabelFormat("%.2f");
@@ -124,8 +124,8 @@ void SurfaceGraph::enableHeightMapModel(bool enable)
{
if (enable) {
//! [4]
- m_graph->setSurfaceGridEnabled(false);
- m_graph->setSmoothSurfaceEnabled(true);
+ m_heightMapSeries->setSurfaceGridEnabled(false);
+ m_heightMapSeries->setFlatShadingEnabled(false);
m_graph->axisX()->setLabelFormat("%.1f N");
m_graph->axisZ()->setLabelFormat("%.1f E");
diff --git a/src/datavisualization/data/qabstract3dseries.cpp b/src/datavisualization/data/qabstract3dseries.cpp
index d5c4c6b8..93ce7fb0 100644
--- a/src/datavisualization/data/qabstract3dseries.cpp
+++ b/src/datavisualization/data/qabstract3dseries.cpp
@@ -64,6 +64,33 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
+ * \qmlproperty Abstract3DSeries.Mesh Abstract3DSeries::mesh
+ *
+ * Sets the mesh of the items in the series, or the selection pointer in case of
+ * Surface3DSeries. If the \a mesh is \l{QAbstract3DSeries::MeshUserDefined}{Abstract3DSeries.MeshUserDefined},
+ * then the userDefinedMesh property must also be set for items to render properly.
+ * The default value depends on the graph type.
+ */
+
+/*!
+ * \qmlproperty bool Abstract3DSeries::meshSmooth
+ *
+ * If \a enable is \c true, smooth versions of predefined meshes set via mesh property are used.
+ * This property doesn't affect custom meshes used when mesh is
+ * \l{QAbstract3DSeries::MeshUserDefined}{Abstract3DSeries.MeshUserDefined}.
+ * Defaults to \c false.
+ */
+
+/*!
+ * \qmlproperty string Abstract3DSeries::userDefinedMesh
+ *
+ * Sets the \a fileName for user defined custom mesh for objects that is used when mesh
+ * is \l{QAbstract3DSeries::MeshUserDefined}{Abstract3DSeries.MeshUserDefined}.
+ * \note The file specified by \a fileName needs to be in Wavefront obj format and include
+ * vertices, normals and UVs. It also needs to be in triangles.
+ */
+
+/*!
* \enum QAbstract3DSeries::SeriesType
*
* Type of the series.
@@ -79,34 +106,34 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
- \enum QAbstract3DSeries::Mesh
-
- Predefined mesh types. All styles are not usable with all visualization types.
-
- \value MeshUserDefined
- User defined mesh, set via QAbstract3DSeries::userDefinedMesh property.
- \value MeshBar
- Basic rectangular bar.
- \value MeshCube
- Basic cube.
- \value MeshPyramid
- Four-sided pyramid.
- \value MeshCone
- Basic cone.
- \value MeshCylinder
- Basic cylinder.
- \value MeshBevelBar
- Slightly beveled (rounded) rectangular bar.
- \value MeshBevelCube
- Slightly beveled (rounded) cube.
- \value MeshSphere
- Sphere.
- \value MeshMinimal
- The minimal 3D mesh: a triangular pyramid. Usable only with Q3DScatter.
- \value MeshPoint
- 2D point. Usable only with Q3DScatter.
- \b Note: Shadows and color gradients do not affect this style.
-*/
+ * \enum QAbstract3DSeries::Mesh
+ *
+ * Predefined mesh types. All styles are not usable with all visualization types.
+ *
+ * \value MeshUserDefined
+ * User defined mesh, set via QAbstract3DSeries::userDefinedMesh property.
+ * \value MeshBar
+ * Basic rectangular bar.
+ * \value MeshCube
+ * Basic cube.
+ * \value MeshPyramid
+ * Four-sided pyramid.
+ * \value MeshCone
+ * Basic cone.
+ * \value MeshCylinder
+ * Basic cylinder.
+ * \value MeshBevelBar
+ * Slightly beveled (rounded) rectangular bar.
+ * \value MeshBevelCube
+ * Slightly beveled (rounded) cube.
+ * \value MeshSphere
+ * Sphere.
+ * \value MeshMinimal
+ * The minimal 3D mesh: a triangular pyramid. Usable only with Q3DScatter.
+ * \value MeshPoint
+ * 2D point. Usable only with Q3DScatter.
+ * \b Note: Shadows and color gradients do not affect this style.
+ */
/*!
* \internal
@@ -201,9 +228,9 @@ QAbstract3DSeries::Mesh QAbstract3DSeries::mesh() const
/*!
* \property QAbstract3DSeries::meshSmooth
*
- * If \a enable is true, smooth versions of predefined meshes set via mesh property are used.
+ * If \a enable is \c true, smooth versions of predefined meshes set via mesh property are used.
* This property doesn't affect custom meshes used when mesh is MeshUserDefined.
- * Defaults to false.
+ * Defaults to \c false.
*/
void QAbstract3DSeries::setMeshSmooth(bool enable)
{
diff --git a/src/datavisualization/data/qsurface3dseries.cpp b/src/datavisualization/data/qsurface3dseries.cpp
index baae3a78..5a47a6e4 100644
--- a/src/datavisualization/data/qsurface3dseries.cpp
+++ b/src/datavisualization/data/qsurface3dseries.cpp
@@ -104,6 +104,32 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
/*!
+ * \qmlproperty bool Surface3DSeries::flatShadingEnabled
+ *
+ * Sets surface flat shading to \a enabled. It is preset to \c true by default.
+ * When disabled, the normals on the surface are interpolated making edges looking round.
+ * When enabled, the normals are kept same on a triangle making the color of the triangle solid.
+ * This makes the data more readable from the model.
+ * \note Flat shaded surfaces require at least GLSL version 1.2 with GL_EXT_gpu_shader4 extension.
+ * The value of flatShadingSupported property indicates if flat shading is supported at runtime.
+ */
+
+/*!
+ * \qmlproperty bool Surface3DSeries::surfaceGridEnabled
+ *
+ * Sets surface grid to \a enabled. It is preset to \c true by default.
+ */
+
+/*!
+ * \qmlproperty bool Surface3DSeries::flatShadingSupported
+ *
+ * Flat shading for surfaces requires at least GLSL version 1.2 with GL_EXT_gpu_shader4 extension.
+ * If true, flat shading for surfaces is supported by current system.
+ * \note This read-only property is set to its correct value after first render pass.
+ * Before then it is always true.
+ */
+
+/*!
* Constructs QSurface3DSeries with the given \a parent.
*/
QSurface3DSeries::QSurface3DSeries(QObject *parent) :
@@ -188,6 +214,62 @@ QPoint QSurface3DSeries::invalidSelectionPosition() const
}
/*!
+ * \property QSurface3DSeries::flatShadingEnabled
+ *
+ * Sets surface flat shading to \a enabled. It is preset to \c true by default.
+ * When disabled, the normals on the surface are interpolated making edges looking round.
+ * When enabled, the normals are kept same on a triangle making the color of the triangle solid.
+ * This makes the data more readable from the model.
+ * \note Flat shaded surfaces require at least GLSL version 1.2 with GL_EXT_gpu_shader4 extension.
+ * The value of flatShadingSupported property indicates if flat shading is supported at runtime.
+ */
+void QSurface3DSeries::setFlatShadingEnabled(bool enabled)
+{
+ if (dptr()->m_flatShadingEnabled != enabled) {
+ dptr()->setFlatShadingEnabled(enabled);
+ emit flatShadingEnabledChanged(enabled);
+ }
+}
+
+bool QSurface3DSeries::isFlatShadingEnabled() const
+{
+ return dptrc()->m_flatShadingEnabled;
+}
+
+/*!
+ * \property QSurface3DSeries::flatShadingSupported
+ * Flat shading for surfaces requires at least GLSL version 1.2 with GL_EXT_gpu_shader4 extension.
+ * If true, flat shading for surfaces is supported by current system.
+ * \note This read-only property is set to its correct value after first render pass.
+ * Before then it is always true.
+ */
+bool QSurface3DSeries::isFlatShadingSupported() const
+{
+ if (d_ptr->m_controller)
+ return static_cast<Surface3DController *>(d_ptr->m_controller)->isFlatShadingSupported();
+ else
+ return true;
+}
+
+/*!
+ * \property QSurface3DSeries::surfaceGridEnabled
+ *
+ * Sets surface grid to \a enabled. It is preset to \c true by default.
+ */
+void QSurface3DSeries::setSurfaceGridEnabled(bool enabled)
+{
+ if (dptr()->m_surfaceGridEnabled != enabled) {
+ dptr()->setSurfaceGridEnabled(enabled);
+ emit surfaceGridEnabledChanged(enabled);
+ }
+}
+
+bool QSurface3DSeries::isSurfaceGridEnabled() const
+{
+ return dptrc()->m_surfaceGridEnabled;
+}
+
+/*!
* \internal
*/
QSurface3DSeriesPrivate *QSurface3DSeries::dptr()
@@ -207,7 +289,9 @@ const QSurface3DSeriesPrivate *QSurface3DSeries::dptrc() const
QSurface3DSeriesPrivate::QSurface3DSeriesPrivate(QSurface3DSeries *q)
: QAbstract3DSeriesPrivate(q, QAbstract3DSeries::SeriesTypeSurface),
- m_selectedPoint(Surface3DController::invalidSelectionPosition())
+ m_selectedPoint(Surface3DController::invalidSelectionPosition()),
+ m_flatShadingEnabled(true),
+ m_surfaceGridEnabled(true)
{
m_itemLabelFormat = QStringLiteral("(@xLabel, @yLabel, @zLabel)");
m_mesh = QAbstract3DSeries::MeshSphere;
@@ -259,4 +343,18 @@ void QSurface3DSeriesPrivate::setSelectedPoint(const QPoint &position)
}
}
+void QSurface3DSeriesPrivate::setFlatShadingEnabled(bool enabled)
+{
+ m_flatShadingEnabled = enabled;
+ if (m_controller)
+ m_controller->markSeriesVisualsDirty();
+}
+
+void QSurface3DSeriesPrivate::setSurfaceGridEnabled(bool enabled)
+{
+ m_surfaceGridEnabled = enabled;
+ if (m_controller)
+ m_controller->markSeriesVisualsDirty();
+}
+
QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qsurface3dseries.h b/src/datavisualization/data/qsurface3dseries.h
index e449af58..f4b64b96 100644
--- a/src/datavisualization/data/qsurface3dseries.h
+++ b/src/datavisualization/data/qsurface3dseries.h
@@ -31,6 +31,9 @@ class QT_DATAVISUALIZATION_EXPORT QSurface3DSeries : public QAbstract3DSeries
Q_OBJECT
Q_PROPERTY(QSurfaceDataProxy *dataProxy READ dataProxy WRITE setDataProxy NOTIFY dataProxyChanged)
Q_PROPERTY(QPoint selectedPoint READ selectedPoint WRITE setSelectedPoint NOTIFY selectedPointChanged)
+ Q_PROPERTY(bool flatShadingEnabled READ isFlatShadingEnabled WRITE setFlatShadingEnabled NOTIFY flatShadingEnabledChanged)
+ Q_PROPERTY(bool surfaceGridEnabled READ isSurfaceGridEnabled WRITE setSurfaceGridEnabled NOTIFY surfaceGridEnabledChanged)
+ Q_PROPERTY(bool flatShadingSupported READ isFlatShadingSupported NOTIFY flatShadingSupportedChanged)
public:
explicit QSurface3DSeries(QObject *parent = 0);
@@ -44,9 +47,20 @@ public:
QPoint selectedPoint() const;
QPoint invalidSelectionPosition() const;
+ void setFlatShadingEnabled(bool enabled);
+ bool isFlatShadingEnabled() const;
+
+ void setSurfaceGridEnabled(bool enabled);
+ bool isSurfaceGridEnabled() const;
+
+ bool isFlatShadingSupported() const;
+
signals:
void dataProxyChanged(QSurfaceDataProxy *proxy);
void selectedPointChanged(QPoint position);
+ void flatShadingEnabledChanged(bool enable);
+ void surfaceGridEnabledChanged(bool enable);
+ void flatShadingSupportedChanged(bool enable);
protected:
explicit QSurface3DSeries(QSurface3DSeriesPrivate *d, QObject *parent = 0);
diff --git a/src/datavisualization/data/qsurface3dseries_p.h b/src/datavisualization/data/qsurface3dseries_p.h
index a1752b77..a3acb8d5 100644
--- a/src/datavisualization/data/qsurface3dseries_p.h
+++ b/src/datavisualization/data/qsurface3dseries_p.h
@@ -45,11 +45,15 @@ public:
virtual void connectControllerAndProxy(Abstract3DController *newController);
void setSelectedPoint(const QPoint &position);
+ void setFlatShadingEnabled(bool enabled);
+ void setSurfaceGridEnabled(bool enabled);
private:
QSurface3DSeries *qptr();
QPoint m_selectedPoint;
+ bool m_flatShadingEnabled;
+ bool m_surfaceGridEnabled;
private:
friend class QSurface3DSeries;
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
index cbc8a900..a3886008 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
@@ -67,15 +67,6 @@
*/
/*!
- \qmlproperty bool Surface3D::smoothSurfaceEnabled
- The smoothing of surface. If false, the shading of the surface is flat.
- */
-
-/*!
- \qmlproperty bool Surface3D::surfaceGridEnabled
- The surface grid visibility. If false, no surface grid is drawn.
- */
-
/*!
\qmlproperty ColorGradient Surface3D::gradient
The current surface gradient. Setting this property replaces the previous gradient.
diff --git a/src/datavisualization/engine/q3dscene.h b/src/datavisualization/engine/q3dscene.h
index 14854361..8033b595 100644
--- a/src/datavisualization/engine/q3dscene.h
+++ b/src/datavisualization/engine/q3dscene.h
@@ -82,6 +82,7 @@ public:
float fixedRotation = 0.0f,
float distanceModifier = 0.0f);
private:
+ // TODO: Move to private
void emitNeedRender();
signals:
diff --git a/src/datavisualization/engine/q3dsurface.cpp b/src/datavisualization/engine/q3dsurface.cpp
index b678ba16..9a0fcd03 100644
--- a/src/datavisualization/engine/q3dsurface.cpp
+++ b/src/datavisualization/engine/q3dsurface.cpp
@@ -105,10 +105,6 @@ Q3DSurface::Q3DSurface()
&Q3DSurface::themeChanged);
QObject::connect(d_ptr->m_shared, &Abstract3DController::shadowQualityChanged, this,
&Q3DSurface::shadowQualityChanged);
- QObject::connect(d_ptr->m_shared, &Surface3DController::smoothSurfaceEnabledChanged, this,
- &Q3DSurface::smoothSurfaceEnabledChanged);
- QObject::connect(d_ptr->m_shared, &Surface3DController::surfaceGridEnabledChanged, this,
- &Q3DSurface::surfaceGridEnabledChanged);
QObject::connect(d_ptr->m_shared, &Abstract3DController::needRender, this,
&Q3DWindow::renderLater);
}
@@ -244,24 +240,6 @@ QDataVis::ShadowQuality Q3DSurface::shadowQuality() const
}
/*!
- * \property Q3DSurface::smoothSurfaceEnabled
- *
- * Sets surface smoothing to \a enabled. It is preset to \c false by default.
- * When enabled the normals on the surface are interpolated making edges looking round. If turned
- * off the normals are kept same on a triangle making the color of the triangle solid. This makes
- * the data more readable from the model.
- */
-void Q3DSurface::setSmoothSurfaceEnabled(bool enabled)
-{
- d_ptr->m_shared->setSmoothSurface(enabled);
-}
-
-bool Q3DSurface::isSmoothSurfaceEnabled() const
-{
- return d_ptr->m_shared->smoothSurface();
-}
-
-/*!
* \property Q3DSurface::selectionMode
*
* Sets point selection \a mode to one of \c QDataVis::SelectionMode. Surface supports
@@ -279,21 +257,6 @@ QDataVis::SelectionFlags Q3DSurface::selectionMode() const
}
/*!
- * \property Q3DSurface::surfaceGridEnabled
- *
- * Sets surface grid to \a enabled. It is preset to \c true by default.
- */
-void Q3DSurface::setSurfaceGridEnabled(bool enabled)
-{
- d_ptr->m_shared->setSurfaceGrid(enabled);
-}
-
-bool Q3DSurface::isSurfaceGridEnabled() const
-{
- return d_ptr->m_shared->surfaceGrid();
-}
-
-/*!
* \property Q3DSurface::gradient
*
* The current surface gradient. Setting this property replaces the previous gradient with
diff --git a/src/datavisualization/engine/q3dsurface.h b/src/datavisualization/engine/q3dsurface.h
index 2a4a56dd..bbe2d47a 100644
--- a/src/datavisualization/engine/q3dsurface.h
+++ b/src/datavisualization/engine/q3dsurface.h
@@ -38,8 +38,6 @@ class QT_DATAVISUALIZATION_EXPORT Q3DSurface : public Q3DWindow
Q_PROPERTY(QtDataVisualization::QDataVis::SelectionFlags selectionMode READ selectionMode WRITE setSelectionMode NOTIFY selectionModeChanged)
Q_PROPERTY(Q3DTheme* theme READ theme WRITE setTheme NOTIFY themeChanged)
Q_PROPERTY(QtDataVisualization::QDataVis::ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality NOTIFY shadowQualityChanged)
- Q_PROPERTY(bool smoothSurfaceEnabled READ isSmoothSurfaceEnabled WRITE setSmoothSurfaceEnabled NOTIFY smoothSurfaceEnabledChanged)
- Q_PROPERTY(bool surfaceGridEnabled READ isSurfaceGridEnabled WRITE setSurfaceGridEnabled NOTIFY surfaceGridEnabledChanged)
Q_PROPERTY(QLinearGradient gradient READ gradient WRITE setGradient)
Q_PROPERTY(Q3DScene* scene READ scene)
@@ -57,14 +55,8 @@ public:
void setShadowQuality(QDataVis::ShadowQuality quality);
QDataVis::ShadowQuality shadowQuality() const;
- void setSmoothSurfaceEnabled(bool enabled);
- bool isSmoothSurfaceEnabled() const;
-
void setSelectionMode(QDataVis::SelectionFlags mode);
QDataVis::SelectionFlags selectionMode() const;
- void setSurfaceGridEnabled(bool enabled);
- bool isSurfaceGridEnabled() const;
-
void setGradient(const QLinearGradient &gradient);
QLinearGradient gradient() const;
@@ -87,8 +79,6 @@ signals:
void selectionModeChanged(QDataVis::SelectionFlags mode);
void themeChanged(Q3DTheme *theme);
void shadowQualityChanged(QDataVis::ShadowQuality quality);
- void smoothSurfaceEnabledChanged(bool enabled);
- void surfaceGridEnabledChanged(bool visible);
protected:
void mouseDoubleClickEvent(QMouseEvent *event);
diff --git a/src/datavisualization/engine/surface3dcontroller.cpp b/src/datavisualization/engine/surface3dcontroller.cpp
index 5b603a62..b1586a78 100644
--- a/src/datavisualization/engine/surface3dcontroller.cpp
+++ b/src/datavisualization/engine/surface3dcontroller.cpp
@@ -24,6 +24,7 @@
#include "q3dcategoryaxis.h"
#include "qsurfacedataproxy_p.h"
#include "qsurface3dseries_p.h"
+#include "shaderhelper_p.h"
#include <QMatrix4x4>
@@ -34,13 +35,11 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
Surface3DController::Surface3DController(QRect rect)
: Abstract3DController(rect),
m_renderer(0),
- m_isSmoothSurfaceEnabled(false),
- m_isSurfaceEnabled(true),
- m_isSurfaceGridEnabled(true),
m_selectedPoint(invalidSelectionPosition()),
m_selectedSeries(0),
m_rowsChangeStartId(0),
- m_rowsChangeCount(0)
+ m_rowsChangeCount(0),
+ m_flatShadingSupported(true)
{
// Setting a null axis creates a new default axis according to orientation and graph type.
// Note: these cannot be set in the Abstract3DController constructor, as they will call virtual
@@ -68,8 +67,6 @@ void Surface3DController::initializeOpenGL()
synchDataToRenderer();
QObject::connect(m_renderer, &Surface3DRenderer::pointClicked, this,
&Surface3DController::handlePointClicked, Qt::QueuedConnection);
- QObject::connect(m_renderer, &Surface3DRenderer::requestSmoothSurface, this,
- &Surface3DController::handleRequestSmoothSurface, Qt::QueuedConnection);
emitNeedRender();
}
@@ -78,11 +75,6 @@ void Surface3DController::synchDataToRenderer()
if (!isInitialized())
return;
- if (m_changeTracker.surfaceGridChanged) {
- m_renderer->updateSurfaceGridStatus(m_isSurfaceGridEnabled);
- m_changeTracker.surfaceGridChanged = false;
- }
-
Abstract3DController::synchDataToRenderer();
// Notify changes to renderer
@@ -91,14 +83,6 @@ void Surface3DController::synchDataToRenderer()
m_changeTracker.gradientColorChanged = false;
}
- if (m_changeTracker.smoothStatusChanged) {
- bool oldSmoothStatus = m_isSmoothSurfaceEnabled;
- m_isSmoothSurfaceEnabled = m_renderer->updateSmoothStatus(m_isSmoothSurfaceEnabled);
- m_changeTracker.smoothStatusChanged = false;
- if (oldSmoothStatus != m_isSmoothSurfaceEnabled)
- emit smoothSurfaceEnabledChanged(m_isSmoothSurfaceEnabled);
- }
-
if (m_changeTracker.rowsChanged) {
m_renderer->updateRows(m_rowsChangeStartId, m_rowsChangeCount);
m_changeTracker.rowsChanged = false;
@@ -108,7 +92,6 @@ void Surface3DController::synchDataToRenderer()
m_renderer->updateSelectedPoint(m_selectedPoint, m_selectedSeries);
m_changeTracker.selectedPointChanged = false;
}
-
}
void Surface3DController::handleAxisAutoAdjustRangeChangedInOrientation(Q3DAbstractAxis::AxisOrientation orientation, bool autoAdjust)
@@ -142,6 +125,11 @@ QPoint Surface3DController::invalidSelectionPosition()
return invalidSelectionPoint;
}
+bool Surface3DController::isFlatShadingSupported()
+{
+ return m_flatShadingSupported;
+}
+
void Surface3DController::addSeries(QAbstract3DSeries *series)
{
Q_ASSERT(series && series->type() == QAbstract3DSeries::SeriesTypeSurface);
@@ -154,7 +142,7 @@ void Surface3DController::addSeries(QAbstract3DSeries *series)
qWarning("Surface graph only supports a single series.");
}
- QSurface3DSeries *surfaceSeries = static_cast<QSurface3DSeries *>(series);
+ QSurface3DSeries *surfaceSeries = static_cast<QSurface3DSeries *>(series);
if (surfaceSeries->selectedPoint() != invalidSelectionPosition())
setSelectedPoint(surfaceSeries->selectedPoint(), surfaceSeries);
}
@@ -184,37 +172,6 @@ QList<QSurface3DSeries *> Surface3DController::surfaceSeriesList()
return surfaceSeriesList;
}
-void Surface3DController::setSmoothSurface(bool enable)
-{
- if (enable != m_isSmoothSurfaceEnabled) {
- m_isSmoothSurfaceEnabled = enable;
- m_changeTracker.smoothStatusChanged = true;
- emit smoothSurfaceEnabledChanged(enable);
- emitNeedRender();
- }
-}
-
-bool Surface3DController::smoothSurface()
-{
- return m_isSmoothSurfaceEnabled;
-}
-
-void Surface3DController::setSurfaceGrid(bool enable)
-{
- if (enable != m_isSurfaceGridEnabled) {
- m_isSurfaceGridEnabled = enable;
- m_changeTracker.surfaceGridChanged = true;
- emit surfaceGridEnabledChanged(enable);
- emitNeedRender();
- m_isDataDirty = true;
- }
-}
-
-bool Surface3DController::surfaceGrid()
-{
- return m_isSurfaceGridEnabled;
-}
-
void Surface3DController::setGradient(const QLinearGradient &gradient)
{
if (gradient != m_userDefinedGradient) {
@@ -347,6 +304,19 @@ void Surface3DController::handlePointClicked(const QPoint &position, QSurface3DS
// TODO: Also hover needed? (QTRD-2131)
}
+void Surface3DController::handleFlatShadingSupportedChange(bool supported)
+{
+ // Handle renderer flat surface support indicator signal. This happens exactly once per renderer.
+ if (m_flatShadingSupported != supported) {
+ m_flatShadingSupported = supported;
+ // Emit the change for all added surfaces
+ foreach (QAbstract3DSeries *series, m_seriesList) {
+ QSurface3DSeries *surfaceSeries = static_cast<QSurface3DSeries *>(series);
+ emit surfaceSeries->flatShadingSupportedChanged(m_flatShadingSupported);
+ }
+ }
+}
+
void Surface3DController::handleRowsChanged(int startIndex, int count)
{
QSurfaceDataProxy *sender = static_cast<QSurfaceDataProxy *>(QObject::sender());
@@ -363,12 +333,6 @@ void Surface3DController::handleRowsChanged(int startIndex, int count)
}
}
-void Surface3DController::handleRequestSmoothSurface(bool enable)
-{
- setSmoothSurface(enable);
- emitNeedRender();
-}
-
void Surface3DController::adjustValueAxisRange()
{
if (m_seriesList.size()) {
diff --git a/src/datavisualization/engine/surface3dcontroller_p.h b/src/datavisualization/engine/surface3dcontroller_p.h
index ffc3b4f3..ef9c8494 100644
--- a/src/datavisualization/engine/surface3dcontroller_p.h
+++ b/src/datavisualization/engine/surface3dcontroller_p.h
@@ -63,15 +63,13 @@ class QT_DATAVISUALIZATION_EXPORT Surface3DController : public Abstract3DControl
private:
Surface3DChangeBitField m_changeTracker;
Surface3DRenderer *m_renderer;
- bool m_isSmoothSurfaceEnabled;
- bool m_isSurfaceEnabled;
- bool m_isSurfaceGridEnabled;
QLinearGradient m_userDefinedGradient;
QPoint m_selectedPoint;
QSurface3DSeries *m_selectedSeries; // Points to the series for which the point is selected in
// single series selection cases.
int m_rowsChangeStartId;
int m_rowsChangeCount;
+ bool m_flatShadingSupported;
public:
explicit Surface3DController(QRect rect);
@@ -80,12 +78,6 @@ public:
void initializeOpenGL();
virtual void synchDataToRenderer();
- void setSmoothSurface(bool enable);
- bool smoothSurface();
-
- void setSurfaceGrid(bool enable);
- bool surfaceGrid();
-
void setGradient(const QLinearGradient &gradient);
QLinearGradient gradient() const;
@@ -99,6 +91,7 @@ public:
virtual void handleSeriesVisibilityChangedBySender(QObject *sender);
static QPoint invalidSelectionPosition();
+ bool isFlatShadingSupported();
virtual void addSeries(QAbstract3DSeries *series);
virtual void removeSeries(QAbstract3DSeries *series);
@@ -110,11 +103,8 @@ public slots:
// Renderer callback handlers
void handlePointClicked(const QPoint &position, QSurface3DSeries *series);
- void handleRequestSmoothSurface(bool enable);
-signals:
- void smoothSurfaceEnabledChanged(bool enable);
- void surfaceGridEnabledChanged(bool enable);
+ void handleFlatShadingSupportedChange(bool supported);
private:
void adjustValueAxisRange();
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp
index 5b9aa9d8..bb74e084 100644
--- a/src/datavisualization/engine/surface3drenderer.cpp
+++ b/src/datavisualization/engine/surface3drenderer.cpp
@@ -99,7 +99,7 @@ Surface3DRenderer::Surface3DRenderer(Surface3DController *controller)
m_selectionTexture(0),
m_selectionResultTexture(0),
m_shadowQualityToShader(33.3f),
- m_cachedSmoothSurface(true),
+ m_cachedFlatShading(false),
m_flatSupported(true),
m_cachedSurfaceVisible(true),
m_cachedSurfaceGridOn(true),
@@ -120,7 +120,9 @@ Surface3DRenderer::Surface3DRenderer(Surface3DController *controller)
QStringLiteral(":/shaders/fragmentSurfaceFlat"));
if (!tester.testCompile()) {
m_flatSupported = false;
- emit requestSmoothSurface(true);
+ connect(this, &Surface3DRenderer::flatShadingSupportedChanged,
+ controller, &Surface3DController::handleFlatShadingSupportedChange);
+ emit flatShadingSupportedChanged(m_flatSupported);
qWarning() << "Warning: Flat qualifier not supported on your platform's GLSL language."
" Requires at least GLSL version 1.2 with GL_EXT_gpu_shader4 extension.";
}
@@ -244,7 +246,7 @@ void Surface3DRenderer::updateData()
loadSurfaceObj();
// Note: Data setup can change sample space (as min width/height is 1)
- if (m_cachedSmoothSurface) {
+ if (!m_cachedFlatShading) {
m_surfaceObj->setUpSmoothData(m_dataArray, m_sampleSpace, m_heightNormalizer,
m_axisCacheY.min(), dimensionChanged);
} else {
@@ -270,6 +272,19 @@ void Surface3DRenderer::updateData()
updateSelectedPoint(m_selectedPoint, m_selectedSeries);
}
+void Surface3DRenderer::updateSeries(const QList<QAbstract3DSeries *> &seriesList, bool updateVisibility)
+{
+ Abstract3DRenderer::updateSeries(seriesList, updateVisibility);
+
+ // TODO: move to render cache when multiseries support implemented QTRD-2657
+ // TODO: until then just update them always.
+ if (m_visibleSeriesList.size()) {
+ QSurface3DSeries *series = static_cast<QSurface3DSeries *>(m_visibleSeriesList.at(0).series());
+ updateFlatStatus(series->isFlatShadingEnabled());
+ updateSurfaceGridStatus(series->isSurfaceGridEnabled());
+ }
+}
+
void Surface3DRenderer::updateRows(int startIndex, int count)
{
// TODO: Properly support non-straight rows and columns (QTRD-2643)
@@ -300,7 +315,7 @@ void Surface3DRenderer::updateRows(int startIndex, int count)
(*(m_dataArray.at(i)))[j] = array->at(i + m_sampleSpace.y())->at(j + m_sampleSpace.x());
}
- if (m_cachedSmoothSurface) {
+ if (!m_cachedFlatShading) {
m_surfaceObj->updateSmoothRows(m_dataArray, startIndex, endRow, m_heightNormalizer,
m_axisCacheY.min());
} else {
@@ -355,7 +370,7 @@ void Surface3DRenderer::updateSliceDataModel(const QPoint &point)
if (!m_sliceSurfaceObj)
loadSliceSurfaceObj();
- if (m_cachedSmoothSurface) {
+ if (!m_cachedFlatShading) {
m_sliceSurfaceObj->setUpSmoothData(m_sliceDataArray, sliceRect, m_heightNormalizer,
m_axisCacheY.min(), true);
} else {
@@ -1781,24 +1796,24 @@ void Surface3DRenderer::calculateSceneScalingFactors()
#endif
}
-bool Surface3DRenderer::updateSmoothStatus(bool enable)
+bool Surface3DRenderer::updateFlatStatus(bool enable)
{
- if (!enable && !m_flatSupported) {
+ if (enable && !m_flatSupported) {
qWarning() << "Warning: Flat qualifier not supported on your platform's GLSL language."
" Requires at least GLSL version 1.2 with GL_EXT_gpu_shader4 extension.";
- enable = true;
+ enable = false;
}
bool changed = false;
- if (enable != m_cachedSmoothSurface) {
- m_cachedSmoothSurface = enable;
+ if (enable != m_cachedFlatShading) {
+ m_cachedFlatShading = enable;
changed = true;
initSurfaceShaders();
}
// If no surface object created yet, don't try to update the object
if (m_surfaceObj && changed && m_sampleSpace.width() >= 2 && m_sampleSpace.height() >= 2) {
- if (m_cachedSmoothSurface) {
+ if (!m_cachedFlatShading) {
m_surfaceObj->setUpSmoothData(m_dataArray, m_sampleSpace, m_heightNormalizer,
m_axisCacheY.min(), true);
} else {
@@ -1807,7 +1822,7 @@ bool Surface3DRenderer::updateSmoothStatus(bool enable)
}
}
- return m_cachedSmoothSurface;
+ return m_cachedFlatShading;
}
void Surface3DRenderer::updateSelectedPoint(const QPoint &position, const QSurface3DSeries *series)
@@ -2050,7 +2065,7 @@ void Surface3DRenderer::initShaders(const QString &vertexShader, const QString &
if (m_surfaceShader)
delete m_surfaceShader;
#if !defined(QT_OPENGL_ES_2)
- if (m_cachedSmoothSurface) {
+ if (!m_cachedFlatShading) {
if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
m_surfaceShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexShadow"),
QStringLiteral(":/shaders/fragmentSurfaceShadowNoTex"));
diff --git a/src/datavisualization/engine/surface3drenderer_p.h b/src/datavisualization/engine/surface3drenderer_p.h
index ce49cf13..476ef78e 100644
--- a/src/datavisualization/engine/surface3drenderer_p.h
+++ b/src/datavisualization/engine/surface3drenderer_p.h
@@ -109,7 +109,7 @@ private:
GLuint m_selectionTexture;
GLuint m_selectionResultTexture;
GLfloat m_shadowQualityToShader;
- bool m_cachedSmoothSurface;
+ bool m_cachedFlatShading;
bool m_flatSupported;
bool m_cachedSurfaceVisible;
bool m_cachedSurfaceGridOn;
@@ -134,9 +134,10 @@ public:
~Surface3DRenderer();
void updateData();
+ void updateSeries(const QList<QAbstract3DSeries *> &seriesList, bool updateVisibility);
void updateRows(int startIndex, int count);
void updateScene(Q3DScene *scene);
- bool updateSmoothStatus(bool enable);
+ bool updateFlatStatus(bool enable);
void updateSurfaceGridStatus(bool enable);
void updateSurfaceGradient(const QLinearGradient &gradient);
void updateSlicingActive(bool isSlicing);
@@ -150,7 +151,7 @@ protected:
signals:
void pointClicked(QPoint position, QSurface3DSeries *series);
- void requestSmoothSurface(bool enable);
+ void flatShadingSupportedChanged(bool supported);
private:
void setViewPorts();
diff --git a/src/datavisualization/utils/shaderhelper.cpp b/src/datavisualization/utils/shaderhelper.cpp
index 7eb48945..b4d2ee76 100644
--- a/src/datavisualization/utils/shaderhelper.cpp
+++ b/src/datavisualization/utils/shaderhelper.cpp
@@ -98,15 +98,17 @@ void ShaderHelper::initialize()
bool ShaderHelper::testCompile()
{
bool result = true;
+
// Discard warnings, we only need the result
QtMessageHandler handler = qInstallMessageHandler(discardDebugMsgs);
if (m_program)
delete m_program;
- m_program = new QOpenGLShaderProgram(m_caller);
+ m_program = new QOpenGLShaderProgram();
if (!m_program->addShaderFromSourceFile(QOpenGLShader::Vertex, m_vertexShaderFile))
result = false;
if (!m_program->addShaderFromSourceFile(QOpenGLShader::Fragment, m_fragmentShaderFile))
result = false;
+
// Restore actual message handler
qInstallMessageHandler(handler);
return result;
diff --git a/src/datavisualizationqml2/declarativesurface.cpp b/src/datavisualizationqml2/declarativesurface.cpp
index 7d69eee8..8c50ab34 100644
--- a/src/datavisualizationqml2/declarativesurface.cpp
+++ b/src/datavisualizationqml2/declarativesurface.cpp
@@ -39,11 +39,6 @@ DeclarativeSurface::DeclarativeSurface(QQuickItem *parent)
// Create the shared component on the main GUI thread.
m_shared = new Surface3DController(boundingRect().toRect());
setSharedController(m_shared);
-
- QObject::connect(m_shared, &Surface3DController::smoothSurfaceEnabledChanged, this,
- &DeclarativeSurface::smoothSurfaceEnabledChanged);
- QObject::connect(m_shared, &Surface3DController::surfaceGridEnabledChanged, this,
- &DeclarativeSurface::surfaceGridEnabledChanged);
}
DeclarativeSurface::~DeclarativeSurface()
@@ -110,26 +105,6 @@ void DeclarativeSurface::setAxisZ(Q3DValueAxis *axis)
m_shared->setAxisZ(axis);
}
-void DeclarativeSurface::setSmoothSurfaceEnabled(bool enabled)
-{
- m_shared->setSmoothSurface(enabled);
-}
-
-bool DeclarativeSurface::isSmoothSurfaceEnabled() const
-{
- return m_shared->smoothSurface();
-}
-
-void DeclarativeSurface::setSurfaceGridEnabled(bool enabled)
-{
- m_shared->setSurfaceGrid(enabled);
-}
-
-bool DeclarativeSurface::isSurfaceGridEnabled() const
-{
- return m_shared->surfaceGrid();
-}
-
void DeclarativeSurface::setGradient(ColorGradient *gradient)
{
// connect new / disconnect old
diff --git a/src/datavisualizationqml2/declarativesurface_p.h b/src/datavisualizationqml2/declarativesurface_p.h
index fe5fc1d1..600aeb98 100644
--- a/src/datavisualizationqml2/declarativesurface_p.h
+++ b/src/datavisualizationqml2/declarativesurface_p.h
@@ -51,8 +51,6 @@ class DeclarativeSurface : public AbstractDeclarative
Q_PROPERTY(Q3DValueAxis *axisX READ axisX WRITE setAxisX)
Q_PROPERTY(Q3DValueAxis *axisY READ axisY WRITE setAxisY)
Q_PROPERTY(Q3DValueAxis *axisZ READ axisZ WRITE setAxisZ)
- Q_PROPERTY(bool smoothSurfaceEnabled READ isSmoothSurfaceEnabled WRITE setSmoothSurfaceEnabled NOTIFY smoothSurfaceEnabledChanged)
- Q_PROPERTY(bool surfaceGridEnabled READ isSurfaceGridEnabled WRITE setSurfaceGridEnabled NOTIFY surfaceGridEnabledChanged)
Q_PROPERTY(ColorGradient *gradient READ gradient WRITE setGradient)
Q_PROPERTY(QQmlListProperty<QSurface3DSeries> seriesList READ seriesList)
Q_CLASSINFO("DefaultProperty", "seriesList")
@@ -68,12 +66,6 @@ public:
Q3DValueAxis *axisZ() const;
void setAxisZ(Q3DValueAxis *axis);
- void setSmoothSurfaceEnabled(bool enabled);
- bool isSmoothSurfaceEnabled() const;
-
- void setSurfaceGridEnabled(bool enabled);
- bool isSurfaceGridEnabled() const;
-
void setGradient(ColorGradient *gradient);
ColorGradient *gradient() const;
@@ -85,10 +77,6 @@ public:
Q_INVOKABLE void addSeries(QSurface3DSeries *series);
Q_INVOKABLE void removeSeries(QSurface3DSeries *series);
-signals:
- void smoothSurfaceEnabledChanged(bool enabled);
- void surfaceGridEnabledChanged(bool visible);
-
protected:
void handleGradientUpdate();
diff --git a/tests/kinectsurface/surfacedata.cpp b/tests/kinectsurface/surfacedata.cpp
index e48a4b58..7c9d8b01 100644
--- a/tests/kinectsurface/surfacedata.cpp
+++ b/tests/kinectsurface/surfacedata.cpp
@@ -51,7 +51,7 @@ SurfaceData::SurfaceData(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars
m_surface->axisY()->setMax(255);
m_surface->setSurfaceGridEnabled(false);
m_surface->setBackgroundVisible(false);
- m_surface->setSmoothSurfaceEnabled(false);
+ m_surface->setFlatShadingEnabled(true);
m_surface->setActiveDataProxy(new QHeightMapSurfaceDataProxy());
m_surface->setCameraPosition(0.0, 90.0, 105);
diff --git a/tests/multigraphs/data.cpp b/tests/multigraphs/data.cpp
index 27f5f449..fac341d8 100644
--- a/tests/multigraphs/data.cpp
+++ b/tests/multigraphs/data.cpp
@@ -54,30 +54,33 @@ Data::Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars,
m_surface->setSelectionMode(QDataVis::SelectionNone);
m_surface->theme()->setGridEnabled(false);
m_surface->setGradient(gradient);
- m_surface->setSurfaceGridEnabled(false);
m_surface->theme()->setBackgroundEnabled(false);
- m_surface->setSmoothSurfaceEnabled(false);
m_surface->scene()->activeCamera()->setCameraPosition(0.0, 90.0, 150);
- m_surface->addSeries(new QSurface3DSeries(new QHeightMapSurfaceDataProxy()));
+ QSurface3DSeries *series1 = new QSurface3DSeries(new QHeightMapSurfaceDataProxy());
+ series1->setFlatShadingEnabled(true);
+ series1->setSurfaceGridEnabled(false);
+ m_surface->addSeries(series1);
// Initialize scatter
m_scatter->setTheme(new Q3DTheme(Q3DTheme::ThemeStoneMoss));
m_scatter->setSelectionMode(QDataVis::SelectionNone);
m_scatter->theme()->setGridEnabled(false);
- m_scatter->setObjectType(QDataVis::MeshPoint);
m_scatter->setShadowQuality(QDataVis::ShadowQualitySoftLow);
m_scatter->scene()->activeCamera()->setCameraPosition(0.0, 85.0, 150);
- m_scatter->addSeries(new QScatter3DSeries);
+ QScatter3DSeries *series2 = new QScatter3DSeries;
+ series2->setMesh(QAbstract3DSeries::MeshPoint);
+ m_scatter->addSeries(series2);
// Initialize bars
m_bars->setTheme(new Q3DTheme(Q3DTheme::ThemeQt));
m_bars->setSelectionMode(QDataVis::SelectionItemAndRow | QDataVis::SelectionSlice);
m_bars->theme()->setGridEnabled(false);
- m_bars->setBarType(QDataVis::MeshBar, false);
m_bars->setShadowQuality(QDataVis::ShadowQualityLow);
m_bars->setBarSpacing(QSizeF(0.0, 0.0));
m_bars->scene()->activeCamera()->setCameraPosition(0.0, 75.0, 150);
- m_bars->addSeries(new QBar3DSeries);
+ QBar3DSeries *series3 = new QBar3DSeries;
+ series3->setMesh(QAbstract3DSeries::MeshBar);
+ m_bars->addSeries(series3);
// Hide scroll bar
m_statusArea->verticalScrollBar()->setVisible(false);
diff --git a/tests/qmlcamera/qml/qmlcamera/main.qml b/tests/qmlcamera/qml/qmlcamera/main.qml
index 929330c8..3aa0991a 100644
--- a/tests/qmlcamera/qml/qmlcamera/main.qml
+++ b/tests/qmlcamera/qml/qmlcamera/main.qml
@@ -138,11 +138,11 @@ Item {
width: camControlArea.width
text: "Hide Shadows"
onClicked: {
- if (testChart.shadowQuality == Bars3D.ShadowQualityNone) {
- testChart.shadowQuality = Bars3D.ShadowQualityMedium;
+ if (testChart.shadowQuality == AbstractGraph3D.ShadowQualityNone) {
+ testChart.shadowQuality = AbstractGraph3D.ShadowQualityMedium;
text = "Hide Shadows"
} else {
- testChart.shadowQuality = Bars3D.ShadowQualityNone;
+ testChart.shadowQuality = AbstractGraph3D.ShadowQualityNone;
text = "Show Shadows"
}
}
diff --git a/tests/spectrum/spectrumapp/main.cpp b/tests/spectrum/spectrumapp/main.cpp
index 8d954dc9..65c658d8 100644
--- a/tests/spectrum/spectrumapp/main.cpp
+++ b/tests/spectrum/spectrumapp/main.cpp
@@ -94,7 +94,6 @@ MainApp::MainApp(Q3DBars *window)
m_chart->setBarThickness(2.0f);
m_chart->setBarSpacing(QSizeF(0.0, 0.0));
// Set bar type, flat bars
- m_chart->setBarType(QDataVis::MeshBar, false);
// Adjust camera position
m_chart->scene()->activeCamera()->setCameraPosition(10.0f, 7.5f, 75.0f);
#endif
@@ -107,8 +106,9 @@ MainApp::MainApp(Q3DBars *window)
m_restartTimer->setSingleShot(true);
QObject::connect(m_restartTimer, &QTimer::timeout, this, &MainApp::restart);
- QBarDataProxy *proxy = new QBarDataProxy;
- m_chart->addSeries(new QBar3DSeries(proxy));
+ QBar3DSeries *series = new QBar3DSeries();
+ series->setMesh(QAbstract3DSeries::MeshBar);
+ m_chart->addSeries(series);
}
MainApp::~MainApp()
diff --git a/tests/surfacetest/graphmodifier.cpp b/tests/surfacetest/graphmodifier.cpp
index fb9e9ec2..68f83f01 100644
--- a/tests/surfacetest/graphmodifier.cpp
+++ b/tests/surfacetest/graphmodifier.cpp
@@ -71,13 +71,13 @@ GraphModifier::~GraphModifier()
void GraphModifier::toggleSmooth(bool enabled)
{
qDebug() << "GraphModifier::toggleSmooth " << enabled;
- m_graph->setSmoothSurfaceEnabled(enabled);
+ m_theSeries->setFlatShadingEnabled(enabled);
}
void GraphModifier::toggleSurfaceGrid(bool enable)
{
qDebug() << "GraphModifier::toggleSurfaceGrid" << enable;
- m_graph->setSurfaceGridEnabled(enable);
+ m_theSeries->setSurfaceGridEnabled(enable);
}
void GraphModifier::toggleSurface(bool enable)
diff --git a/tests/surfacetest/main.cpp b/tests/surfacetest/main.cpp
index f05de5e9..621557fb 100644
--- a/tests/surfacetest/main.cpp
+++ b/tests/surfacetest/main.cpp
@@ -64,8 +64,8 @@ int main(int argc, char *argv[])
hLayout->addLayout(vLayout);
QCheckBox *smoothCB = new QCheckBox(widget);
- smoothCB->setText(QStringLiteral("Smooth "));
- smoothCB->setChecked(surfaceGraph->isSmoothSurfaceEnabled());
+ smoothCB->setText(QStringLiteral("Flat Surface"));
+ smoothCB->setChecked(true);
QCheckBox *surfaceGridCB = new QCheckBox(widget);
surfaceGridCB->setText(QStringLiteral("Surface Grid"));