diff options
author | Mike Krus <mike.krus@kdab.com> | 2015-12-10 15:58:05 +0000 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2016-01-25 14:13:13 +0000 |
commit | 28ec1ca1883e0fe9b8b0e0de4049564ae652bd90 (patch) | |
tree | 3722809fc54b75d08b08fb68bd5d9d56fbe24342 /src/render/raycasting/qraycastingservice.cpp | |
parent | 4ad00b344bc79e34f2ba2f8355e65c7948791389 (diff) |
Refactor picking to use one thread per entity
Added triangle visitor by refactor the triangle volume extractor
Added ability to do a ray intersection with a single volume without using a thread
Added entity collector
Use one thread for each entity
Ignore entities that don’t have a pick object
Removed list of triangle volumes stored on each entity
Use triangle visitor to test each triangle by creating a single volume on the stack
Added triangle and 3 vertex index to the pick event
Change-Id: Id3fd53549bf3ea07805426ef868df174f30e176b
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/raycasting/qraycastingservice.cpp')
-rw-r--r-- | src/render/raycasting/qraycastingservice.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/render/raycasting/qraycastingservice.cpp b/src/render/raycasting/qraycastingservice.cpp index 0b183f087..f584e5f74 100644 --- a/src/render/raycasting/qraycastingservice.cpp +++ b/src/render/raycasting/qraycastingservice.cpp @@ -141,6 +141,19 @@ QCollisionQueryResult QRayCastingServicePrivate::collides(const Qt3DCore::QRay3D return result; } +QCollisionQueryResult::Hit QRayCastingServicePrivate::collides(const Qt3DCore::QRay3D &ray, const Qt3DRender::QBoundingVolume *volume) +{ + QCollisionQueryResult::Hit result; + Hit hit = volumeRayIntersection(volume, ray); + if (hit.intersects) + { + result.m_distance = hit.distance; + result.m_entityId = hit.id; + result.m_intersection = hit.intersection; + } + return result; +} + QRayCastingServicePrivate::QRayCastingServicePrivate(const QString &description) : QAbstractCollisionQueryServicePrivate(description) , m_handlesCount(0) @@ -170,6 +183,13 @@ QQueryHandle QRayCastingService::query(const Qt3DCore::QRay3D &ray, return handle; } +QCollisionQueryResult::Hit QRayCastingService::query(const Qt3DCore::QRay3D &ray, const QBoundingVolume *volume) +{ + Q_D(QRayCastingService); + + return d->collides(ray, volume); +} + QCollisionQueryResult QRayCastingService::fetchResult(const QQueryHandle &handle) { Q_D(QRayCastingService); |