From a6d562c546a8540617ec9107c84585f8d45733ea Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Wed, 9 Dec 2015 12:07:31 +0100 Subject: Entity: add reference to QComputeJob component Change-Id: I1a99115b78478ec143a83a2f768a7249d9038ac0 Reviewed-by: Paul Lemire --- src/render/backend/entity.cpp | 21 +++++++++++++++++++++ src/render/backend/entity_p.h | 10 ++++++++++ 2 files changed, 31 insertions(+) (limited to 'src/render/backend') 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 #include #include +#include #include #include @@ -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(component) != Q_NULLPTR) { m_boundingVolumeDebugComponent = component->id(); + } else if (qobject_cast(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 Entity::componentsHandle() const return lightHandles; } +template<> +HComputeJob Entity::componentHandle() const +{ + return m_nodeManagers->computeJobManager()->lookupHandle(m_computeComponent); +} + // Render components template<> @@ -464,6 +476,12 @@ BoundingVolumeDebug *Entity::renderComponent() const return m_nodeManagers->boundingVolumeDebugManager()->lookupResource(m_boundingVolumeDebugComponent); } +template<> +ComputeJob *Entity::renderComponent() const +{ + return m_nodeManagers->computeJobManager()->lookupResource(m_computeComponent); +} + // Uuid template<> @@ -490,6 +508,9 @@ QNodeId Entity::componentUuid() const { return m_objectPickerCompo template<> QNodeId Entity::componentUuid() const { return m_boundingVolumeDebugComponent; } +template<> +QNodeId Entity::componentUuid() const { return m_computeComponent; } + template<> QList Entity::componentsUuid() const { return m_lightComponents; } 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 QList Entity::componentsHandle() const; +template<> +Q_AUTOTEST_EXPORT HComputeJob Entity::componentHandle() const; + // Render components template<> Material *Entity::renderComponent() const; @@ -235,6 +239,9 @@ Q_AUTOTEST_EXPORT BoundingVolumeDebug *Entity::renderComponent QList Entity::renderComponents() const; +template<> +Q_AUTOTEST_EXPORT ComputeJob *Entity::renderComponent() const; + // UUid template<> Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid() const; @@ -260,6 +267,9 @@ Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid() const; template<> Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid() const; +template<> +Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid() const; + template<> Q_AUTOTEST_EXPORT QList Entity::componentsUuid() const; -- cgit v1.2.3