summaryrefslogtreecommitdiffstats
path: root/src/render/picking
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2015-12-10 15:58:05 +0000
committerMike Krus <mike.krus@kdab.com>2016-01-25 14:13:13 +0000
commit28ec1ca1883e0fe9b8b0e0de4049564ae652bd90 (patch)
tree3722809fc54b75d08b08fb68bd5d9d56fbe24342 /src/render/picking
parent4ad00b344bc79e34f2ba2f8355e65c7948791389 (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/picking')
-rw-r--r--src/render/picking/qpickevent.cpp35
-rw-r--r--src/render/picking/qpickevent.h11
2 files changed, 44 insertions, 2 deletions
diff --git a/src/render/picking/qpickevent.cpp b/src/render/picking/qpickevent.cpp
index 420bab16f..a8f15dd08 100644
--- a/src/render/picking/qpickevent.cpp
+++ b/src/render/picking/qpickevent.cpp
@@ -55,6 +55,10 @@ public:
QVector3D m_worldIntersection;
QVector3D m_localIntersection;
float m_distance;
+ uint m_triangleIndex;
+ uint m_vertex1Index;
+ uint m_vertex2Index;
+ uint m_vertex3Index;
};
QPickEvent::QPickEvent()
@@ -62,13 +66,18 @@ QPickEvent::QPickEvent()
{
}
-QPickEvent::QPickEvent(const QVector3D &intersection, const QVector3D &localIntersection, float distance)
+QPickEvent::QPickEvent(const QVector3D &intersection, const QVector3D &localIntersection, float distance,
+ uint triangleIndex, uint vertex1Index, uint vertex2Index, uint vertex3Index)
: QObject(*new QPickEventPrivate())
{
Q_D(QPickEvent);
d->m_distance = distance;
d->m_worldIntersection = intersection;
d->m_localIntersection = localIntersection;
+ d->m_triangleIndex = triangleIndex;
+ d->m_vertex1Index = vertex1Index;
+ d->m_vertex2Index = vertex2Index;
+ d->m_vertex3Index = vertex3Index;
}
QPickEvent::~QPickEvent()
@@ -108,6 +117,30 @@ const QVector3D &QPickEvent::localIntersection() const
return d->m_localIntersection;
}
+uint QPickEvent::triangleIndex() const
+{
+ Q_D(const QPickEvent);
+ return d->m_triangleIndex;
+}
+
+uint QPickEvent::vertex1Index() const
+{
+ Q_D(const QPickEvent);
+ return d->m_vertex1Index;
+}
+
+uint QPickEvent::vertex2Index() const
+{
+ Q_D(const QPickEvent);
+ return d->m_vertex2Index;
+}
+
+uint QPickEvent::vertex3Index() const
+{
+ Q_D(const QPickEvent);
+ return d->m_vertex3Index;
+}
+
} // Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/picking/qpickevent.h b/src/render/picking/qpickevent.h
index 4734a912d..4c705ffc6 100644
--- a/src/render/picking/qpickevent.h
+++ b/src/render/picking/qpickevent.h
@@ -57,9 +57,14 @@ class QT3DRENDERSHARED_EXPORT QPickEvent : public QObject
Q_PROPERTY(float distance READ distance CONSTANT)
Q_PROPERTY(QVector3D localIntersection READ localIntersection CONSTANT)
Q_PROPERTY(QVector3D worldIntersection READ worldIntersection CONSTANT)
+ Q_PROPERTY(uint triangleIndex READ triangleIndex CONSTANT)
+ Q_PROPERTY(uint vertex1Index READ vertex1Index CONSTANT)
+ Q_PROPERTY(uint vertex2Index READ vertex2Index CONSTANT)
+ Q_PROPERTY(uint vertex3Index READ vertex3Index CONSTANT)
public:
QPickEvent();
- QPickEvent(const QVector3D& worldIntersection, const QVector3D& localIntersection, float distance);
+ QPickEvent(const QVector3D& worldIntersection, const QVector3D& localIntersection, float distance,
+ uint triangleIndex = 0, uint vertex1Index = 0, uint vertex2Index = 0, uint vertex3Index = 0);
~QPickEvent();
bool isAccepted() const;
@@ -70,6 +75,10 @@ public Q_SLOTS:
float distance() const;
const QVector3D &worldIntersection() const;
const QVector3D &localIntersection() const;
+ uint triangleIndex() const;
+ uint vertex1Index() const;
+ uint vertex2Index() const;
+ uint vertex3Index() const;
Q_SIGNALS:
void acceptedChanged(bool accepted);