summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-12-09 12:07:31 +0100
committerPaul Lemire <paul.lemire@kdab.com>2016-01-13 16:09:21 +0000
commita6d562c546a8540617ec9107c84585f8d45733ea (patch)
tree6cc0dc1f94025c8ea8d5611b5b9d1093ce7f1ecb
parent9aaff002d194389ae55660be6f459495df07562d (diff)
Entity: add reference to QComputeJob component
Change-Id: I1a99115b78478ec143a83a2f768a7249d9038ac0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/render/backend/entity.cpp21
-rw-r--r--src/render/backend/entity_p.h10
2 files changed, 31 insertions, 0 deletions
diff --git a/src/render/backend/entity.cpp b/src/render/backend/entity.cpp
index 745e54735..e1fc32160 100644
--- a/src/render/backend/entity.cpp
+++ b/src/render/backend/entity.cpp
@@ -47,6 +47,7 @@
#include <Qt3DRender/qgeometryrenderer.h>
#include <Qt3DRender/qobjectpicker.h>
#include <Qt3DRender/qboundingvolumedebug.h>
+#include <Qt3DRender/qcomputejob.h>
#include <Qt3DRender/private/geometryrenderermanager_p.h>
#include <Qt3DCore/qcameralens.h>
@@ -103,6 +104,7 @@ void Entity::cleanup()
m_geometryRendererComponent = Qt3DCore::QNodeId();
m_objectPickerComponent = QNodeId();
m_boundingVolumeDebugComponent = QNodeId();
+ m_computeComponent = QNodeId();
m_layerComponents.clear();
m_shaderDataComponents.clear();
m_lightComponents.clear();
@@ -281,6 +283,8 @@ void Entity::addComponent(Qt3DCore::QComponent *component)
m_objectPickerComponent = component->id();
} else if (qobject_cast<QBoundingVolumeDebug *>(component) != Q_NULLPTR) {
m_boundingVolumeDebugComponent = component->id();
+ } else if (qobject_cast<QComputeJob *>(component) != Q_NULLPTR) {
+ m_computeComponent = component->id();
}
}
@@ -305,6 +309,8 @@ void Entity::removeComponent(const Qt3DCore::QNodeId &nodeId)
m_boundingVolumeDebugComponent = QNodeId();
} else if (m_lightComponents.contains(nodeId)) {
m_lightComponents.removeAll(nodeId);
+ } else if (m_computeComponent == nodeId) {
+ m_computeComponent = QNodeId();
}
}
@@ -396,6 +402,12 @@ QList<HLight> Entity::componentsHandle<Light>() const
return lightHandles;
}
+template<>
+HComputeJob Entity::componentHandle<ComputeJob>() const
+{
+ return m_nodeManagers->computeJobManager()->lookupHandle(m_computeComponent);
+}
+
// Render components
template<>
@@ -464,6 +476,12 @@ BoundingVolumeDebug *Entity::renderComponent<BoundingVolumeDebug>() const
return m_nodeManagers->boundingVolumeDebugManager()->lookupResource(m_boundingVolumeDebugComponent);
}
+template<>
+ComputeJob *Entity::renderComponent<ComputeJob>() const
+{
+ return m_nodeManagers->computeJobManager()->lookupResource(m_computeComponent);
+}
+
// Uuid
template<>
@@ -491,6 +509,9 @@ template<>
QNodeId Entity::componentUuid<BoundingVolumeDebug>() const { return m_boundingVolumeDebugComponent; }
template<>
+QNodeId Entity::componentUuid<ComputeJob>() const { return m_computeComponent; }
+
+template<>
QList<Qt3DCore::QNodeId> Entity::componentsUuid<Light>() const { return m_lightComponents; }
RenderEntityFunctor::RenderEntityFunctor(NodeManagers *manager)
diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h
index 2cd0ee743..24ed72ae5 100644
--- a/src/render/backend/entity_p.h
+++ b/src/render/backend/entity_p.h
@@ -173,6 +173,7 @@ private:
Qt3DCore::QNodeId m_geometryRendererComponent;
Qt3DCore::QNodeId m_objectPickerComponent;
Qt3DCore::QNodeId m_boundingVolumeDebugComponent;
+ Qt3DCore::QNodeId m_computeComponent;
QString m_objectName;
bool m_enabled;
@@ -207,6 +208,9 @@ Q_AUTOTEST_EXPORT HBoundingVolumeDebug Entity::componentHandle<BoundingVolumeDeb
template<>
QList<HLight> Entity::componentsHandle<Light>() const;
+template<>
+Q_AUTOTEST_EXPORT HComputeJob Entity::componentHandle<ComputeJob>() const;
+
// Render components
template<>
Material *Entity::renderComponent<Material>() const;
@@ -235,6 +239,9 @@ Q_AUTOTEST_EXPORT BoundingVolumeDebug *Entity::renderComponent<BoundingVolumeDeb
template<>
QList<Light *> Entity::renderComponents<Light>() const;
+template<>
+Q_AUTOTEST_EXPORT ComputeJob *Entity::renderComponent<ComputeJob>() const;
+
// UUid
template<>
Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<Transform>() const;
@@ -261,6 +268,9 @@ template<>
Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<BoundingVolumeDebug>() const;
template<>
+Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<ComputeJob>() const;
+
+template<>
Q_AUTOTEST_EXPORT QList<Qt3DCore::QNodeId> Entity::componentsUuid<Light>() const;
class RenderEntityFunctor : public Qt3DCore::QBackendNodeFunctor