summaryrefslogtreecommitdiffstats
path: root/src/quick3d/quick3dextras
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-02-17 15:15:50 +0000
committerSean Harmer <sean.harmer@kdab.com>2017-02-19 13:46:13 +0000
commit7328700ee5622fbb635205592c97280a8f84817a (patch)
tree79b234ecc68175b5a3289f906ccb4d6258ec8321 /src/quick3d/quick3dextras
parentf22b372e812ee808ba2dd88bf345ef6f4fb635d1 (diff)
Revert "Use QVector<float> in level of detail APIs"
This reverts commit 5bceaee38908934078bbdb62b564daa68f7e182b. QML uses doubles throughout and there is no good way or place to reliably switch to floats in the API. We tried extending QtDeclarative to work with QJSValues containing vectors/lists of floats and doubles (rather than qreal) but this introduces rounding errors that are difficult to control robustly. We also looked at removing the Q_PROPERTY in C++ and adding it to a QML extension object. But that would make it not work with animations bound to this property. So, in the end, it seems like qreal is the best of a bad set of alternatives. We should make a renewed effort to kill qreal for Qt 6. Change-Id: I9d61e58e7223eb5a6b848ba33fc760b3654bbddd Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/quick3d/quick3dextras')
-rw-r--r--src/quick3d/quick3dextras/items/quick3dlevelofdetailloader.cpp4
-rw-r--r--src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader.cpp b/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader.cpp
index c4a35328d..f3d3f4323 100644
--- a/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader.cpp
+++ b/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader.cpp
@@ -144,13 +144,13 @@ void Quick3DLevelOfDetailLoader::setThresholdType(Qt3DRender::QLevelOfDetail::Th
d->m_lod->setThresholdType(thresholdType);
}
-QVector<float> Quick3DLevelOfDetailLoader::thresholds() const
+QVector<qreal> Quick3DLevelOfDetailLoader::thresholds() const
{
Q_D(const Quick3DLevelOfDetailLoader);
return d->m_lod->thresholds();
}
-void Quick3DLevelOfDetailLoader::setThresholds(const QVector<float> &thresholds)
+void Quick3DLevelOfDetailLoader::setThresholds(const QVector<qreal> &thresholds)
{
Q_D(Quick3DLevelOfDetailLoader);
d->m_lod->setThresholds(thresholds);
diff --git a/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h b/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h
index 6eb539e56..1ef359fe7 100644
--- a/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h
+++ b/src/quick3d/quick3dextras/items/quick3dlevelofdetailloader_p.h
@@ -71,7 +71,7 @@ class QT3DQUICKEXTRASSHARED_PRIVATE_EXPORT Quick3DLevelOfDetailLoader : public Q
Q_PROPERTY(Qt3DRender::QCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(Qt3DRender::QLevelOfDetail::ThresholdType thresholdType READ thresholdType WRITE setThresholdType NOTIFY thresholdTypeChanged)
- Q_PROPERTY(QVector<float> thresholds READ thresholds WRITE setThresholds NOTIFY thresholdsChanged)
+ Q_PROPERTY(QVector<qreal> thresholds READ thresholds WRITE setThresholds NOTIFY thresholdsChanged)
Q_PROPERTY(Qt3DRender::QBoundingSphere *volumeOverride READ volumeOverride WRITE setVolumeOverride NOTIFY volumeOverrideChanged)
Q_PROPERTY(QObject *entity READ entity NOTIFY entityChanged)
@@ -88,8 +88,8 @@ public:
void setCurrentIndex(int currentIndex);
Qt3DRender::QLevelOfDetail::ThresholdType thresholdType() const;
void setThresholdType(Qt3DRender::QLevelOfDetail::ThresholdType thresholdType);
- QVector<float> thresholds() const;
- void setThresholds(const QVector<float> &thresholds);
+ QVector<qreal> thresholds() const;
+ void setThresholds(const QVector<qreal> &thresholds);
Qt3DRender::QBoundingSphere *volumeOverride() const;
void setVolumeOverride(Qt3DRender::QBoundingSphere *volumeOverride);