From 5bceaee38908934078bbdb62b564daa68f7e182b Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Wed, 15 Feb 2017 10:33:28 +0000 Subject: Use QVector in level of detail APIs For consistency with rest of API and to avoid ambiguity inherent with qreal. Task-number: QTBUG-58888 Task-number: QTBUG-58889 Change-Id: Ib8729a11152165caf05ecea63f9e10c4d90689db Reviewed-by: Mike Krus --- src/render/jobs/updatelevelofdetailjob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/render/jobs/updatelevelofdetailjob.cpp') diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp index 940d26850..6993d2bc8 100644 --- a/src/render/jobs/updatelevelofdetailjob.cpp +++ b/src/render/jobs/updatelevelofdetailjob.cpp @@ -160,7 +160,7 @@ void UpdateLevelOfDetailJob::updateEntityLodByDistance(Entity *entity, LevelOfDe if (!viewMatrixForCamera(lod->camera(), viewMatrix, projectionMatrix)) return; - const QVector thresholds = lod->thresholds(); + const QVector thresholds = lod->thresholds(); QVector3D center = lod->center(); if (lod->radius() > 0.f || entity->worldBoundingVolume() == nullptr) { center = *entity->worldTransform() * center; @@ -196,7 +196,7 @@ void UpdateLevelOfDetailJob::updateEntityLodByScreenArea(Entity *entity, LevelOf const PickingUtils::ViewportCameraAreaTriplet &vca = vcaTriplets.front(); - const QVector thresholds = lod->thresholds(); + const QVector thresholds = lod->thresholds(); Sphere bv(lod->center(), lod->radius()); if (lod->radius() <= 0.f && entity->worldBoundingVolume() != nullptr) { bv = *(entity->worldBoundingVolume()); -- cgit v1.2.3 From 7328700ee5622fbb635205592c97280a8f84817a Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Fri, 17 Feb 2017 15:15:50 +0000 Subject: Revert "Use QVector 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 --- src/render/jobs/updatelevelofdetailjob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/render/jobs/updatelevelofdetailjob.cpp') diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp index 6993d2bc8..940d26850 100644 --- a/src/render/jobs/updatelevelofdetailjob.cpp +++ b/src/render/jobs/updatelevelofdetailjob.cpp @@ -160,7 +160,7 @@ void UpdateLevelOfDetailJob::updateEntityLodByDistance(Entity *entity, LevelOfDe if (!viewMatrixForCamera(lod->camera(), viewMatrix, projectionMatrix)) return; - const QVector thresholds = lod->thresholds(); + const QVector thresholds = lod->thresholds(); QVector3D center = lod->center(); if (lod->radius() > 0.f || entity->worldBoundingVolume() == nullptr) { center = *entity->worldTransform() * center; @@ -196,7 +196,7 @@ void UpdateLevelOfDetailJob::updateEntityLodByScreenArea(Entity *entity, LevelOf const PickingUtils::ViewportCameraAreaTriplet &vca = vcaTriplets.front(); - const QVector thresholds = lod->thresholds(); + const QVector thresholds = lod->thresholds(); Sphere bv(lod->center(), lod->radius()); if (lod->radius() <= 0.f && entity->worldBoundingVolume() != nullptr) { bv = *(entity->worldBoundingVolume()); -- cgit v1.2.3 From ddc878f2fc978a3b740b7ccf9258c824c6ba959a Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Thu, 16 Feb 2017 18:43:53 +0000 Subject: QBoundingSphere cleanup Is now a Q_GADGET value type Added QBoundingSphere creator functions on QLevelOfDetails and Quick3DLevelOfDetailsLoader Note: cannot be a nested type on QLevelOfDetails as moc doesn't support it Task-number: QTBUG-58892 Change-Id: Ic7b6d68c6e1119c1f61a858f49379efc1e9c2104 Reviewed-by: Sean Harmer --- src/render/jobs/updatelevelofdetailjob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/render/jobs/updatelevelofdetailjob.cpp') diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp index 940d26850..36b83263a 100644 --- a/src/render/jobs/updatelevelofdetailjob.cpp +++ b/src/render/jobs/updatelevelofdetailjob.cpp @@ -162,7 +162,7 @@ void UpdateLevelOfDetailJob::updateEntityLodByDistance(Entity *entity, LevelOfDe const QVector thresholds = lod->thresholds(); QVector3D center = lod->center(); - if (lod->radius() > 0.f || entity->worldBoundingVolume() == nullptr) { + if (lod->hasBoundingVolumeOverride() || entity->worldBoundingVolume() == nullptr) { center = *entity->worldTransform() * center; } else { center = entity->worldBoundingVolume()->center(); @@ -198,7 +198,7 @@ void UpdateLevelOfDetailJob::updateEntityLodByScreenArea(Entity *entity, LevelOf const QVector thresholds = lod->thresholds(); Sphere bv(lod->center(), lod->radius()); - if (lod->radius() <= 0.f && entity->worldBoundingVolume() != nullptr) { + if (!lod->hasBoundingVolumeOverride() && entity->worldBoundingVolume() != nullptr) { bv = *(entity->worldBoundingVolume()); } else { bv.transform(*entity->worldTransform()); -- cgit v1.2.3 From e841be3ef9b4ea089265991cb0fe3a5d4ee14224 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Mon, 27 Mar 2017 14:58:40 +0100 Subject: Add Threshold suffix to QLevelOfDetail enum values Change-Id: I70a39b4a2664e2952d9f3cdd1ace1f021b0311dd Reviewed-by: Paul Lemire Reviewed-by: Marc Mutz --- src/render/jobs/updatelevelofdetailjob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/render/jobs/updatelevelofdetailjob.cpp') diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp index 36b83263a..24891f9b8 100644 --- a/src/render/jobs/updatelevelofdetailjob.cpp +++ b/src/render/jobs/updatelevelofdetailjob.cpp @@ -135,10 +135,10 @@ void UpdateLevelOfDetailJob::updateEntityLod(Entity *entity) if (lod->isEnabled() && !lod->thresholds().isEmpty()) { switch (lod->thresholdType()) { - case QLevelOfDetail::DistanceToCamera: + case QLevelOfDetail::DistanceToCameraThreshold: updateEntityLodByDistance(entity, lod); break; - case QLevelOfDetail::ProjectedScreenPixelSize: + case QLevelOfDetail::ProjectedScreenPixelSizeThreshold: updateEntityLodByScreenArea(entity, lod); break; default: -- cgit v1.2.3