summaryrefslogtreecommitdiffstats
path: root/src/render/jobs/raycastingjob.cpp
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2018-02-22 21:36:13 -0500
committerAndy Nichols <andy.nichols@qt.io>2018-03-07 12:17:10 +0000
commit1de8948ff8db516e683203bcc896f931adb18cae (patch)
tree847b2122cca647d0e15d85ae1b07b8d2c949e9ec /src/render/jobs/raycastingjob.cpp
parent42a27f1a9ce319393a8e10a5f91b336e69fe2eb6 (diff)
Add more job tests for raycasting
- test screen space ray casting - fixed handling of filters - fixed handling of ray length - few tests for filter handling Change-Id: Ifc24d8f9e73556669338b3936a41dfa2c674e306 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/render/jobs/raycastingjob.cpp')
-rw-r--r--src/render/jobs/raycastingjob.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/render/jobs/raycastingjob.cpp b/src/render/jobs/raycastingjob.cpp
index 0fbaed219..dc332201d 100644
--- a/src/render/jobs/raycastingjob.cpp
+++ b/src/render/jobs/raycastingjob.cpp
@@ -46,6 +46,7 @@
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/pickboundingvolumeutils_p.h>
#include <Qt3DRender/private/qray3d_p.h>
+#include <Qt3DRender/private/sphere_p.h>
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/private/rendersettings_p.h>
#include <Qt3DRender/private/trianglesvisitor_p.h>
@@ -150,6 +151,8 @@ bool RayCastingJob::runHelper()
PickingUtils::ViewportCameraAreaGatherer vcaGatherer;
const QVector<PickingUtils::ViewportCameraAreaDetails> vcaDetails = vcaGatherer.gather(m_frameGraphRoot);
+ const float sceneRayLength = m_node->worldBoundingVolumeWithChildren()->radius() * 3.f;
+
for (const EntityCasterGatherer::EntityCasterList::value_type &pair: entities) {
QVector<QRay3D> rays;
@@ -157,15 +160,12 @@ bool RayCastingJob::runHelper()
case QAbstractRayCasterPrivate::WorldSpaceRayCaster:
rays << QRay3D(Vector3D(pair.second->origin()),
Vector3D(pair.second->direction()),
- pair.second->length());
+ pair.second->length() > 0.f ? pair.second->length() : sceneRayLength);
rays.back().transform(*pair.first->worldTransform());
break;
case QAbstractRayCasterPrivate::ScreenScapeRayCaster:
- for (const PickingUtils::ViewportCameraAreaDetails &vca : vcaDetails) {
- // TODO: Fix this properly by not passing null for the eventSource
+ for (const PickingUtils::ViewportCameraAreaDetails &vca : vcaDetails)
rays << rayForViewportAndCamera(vca, nullptr, pair.second->position());
- //rays << rayForViewportAndCamera(vca.area, pair.second->position(), vca.viewport, vca.cameraId);
- }
break;
default:
Q_UNREACHABLE();