diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-02-17 15:15:50 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-02-19 13:46:13 +0000 |
commit | 7328700ee5622fbb635205592c97280a8f84817a (patch) | |
tree | 79b234ecc68175b5a3289f906ccb4d6258ec8321 /src/render/frontend/qlevelofdetail.h | |
parent | f22b372e812ee808ba2dd88bf345ef6f4fb635d1 (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/render/frontend/qlevelofdetail.h')
-rw-r--r-- | src/render/frontend/qlevelofdetail.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/render/frontend/qlevelofdetail.h b/src/render/frontend/qlevelofdetail.h index 39cc8448b..f3325aea0 100644 --- a/src/render/frontend/qlevelofdetail.h +++ b/src/render/frontend/qlevelofdetail.h @@ -59,7 +59,7 @@ class QT3DRENDERSHARED_EXPORT QLevelOfDetail : public Qt3DCore::QComponent Q_PROPERTY(Qt3DRender::QCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(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) public: @@ -75,21 +75,21 @@ public: QCamera *camera() const; int currentIndex() const; ThresholdType thresholdType() const; - QVector<float> thresholds() const; + QVector<qreal> thresholds() const; QBoundingSphere *volumeOverride() const; public Q_SLOTS: void setCamera(QCamera *camera); void setCurrentIndex(int currentIndex); void setThresholdType(ThresholdType thresholdType); - void setThresholds(QVector<float> thresholds); + void setThresholds(QVector<qreal> thresholds); void setVolumeOverride(QBoundingSphere *volumeOverride); Q_SIGNALS: void cameraChanged(QCamera *camera); void currentIndexChanged(int currentIndex); void thresholdTypeChanged(ThresholdType thresholdType); - void thresholdsChanged(QVector<float> thresholds); + void thresholdsChanged(QVector<qreal> thresholds); void volumeOverrideChanged(QBoundingSphere *volumeOverride); protected: |