summaryrefslogtreecommitdiffstats
path: root/src/render/jobs
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-04-25 15:27:11 +0200
committerPaul Lemire <paul.lemire@kdab.com>2019-04-26 07:14:12 +0200
commit06f41f15abaacc9f6f7acb8e51d2cfb68705a924 (patch)
tree210403f4bb9872940f8db4ab656238e9f14e1b98 /src/render/jobs
parent9b140ccba930f159443a70a81eb1d2585b6070f9 (diff)
parentfed848f7dcff99cf5adb3b7b45190826b3dcf898 (diff)
Merge remote-tracking branch 5.12 into 5.13
Diffstat (limited to 'src/render/jobs')
-rw-r--r--src/render/jobs/framecleanupjob.cpp3
-rw-r--r--src/render/jobs/job_common_p.h1
-rw-r--r--src/render/jobs/jobs.pri2
-rw-r--r--src/render/jobs/raycastingjob.cpp7
-rw-r--r--src/render/jobs/updateentityhierarchyjob.cpp80
-rw-r--r--src/render/jobs/updateentityhierarchyjob_p.h91
-rw-r--r--src/render/jobs/updateentitylayersjob_p.h2
-rw-r--r--src/render/jobs/updatelevelofdetailjob.cpp5
-rw-r--r--src/render/jobs/updateskinningpalettejob.cpp5
9 files changed, 191 insertions, 5 deletions
diff --git a/src/render/jobs/framecleanupjob.cpp b/src/render/jobs/framecleanupjob.cpp
index 3105f547c..7ebe31531 100644
--- a/src/render/jobs/framecleanupjob.cpp
+++ b/src/render/jobs/framecleanupjob.cpp
@@ -91,11 +91,12 @@ void FrameCleanupJob::updateBoundingVolumesDebug(Entity *node)
debugBV->setRadius(s.radius());
debugBV->setCenter(s.center());
}
-#endif
+
const auto children = node->children();
for (Entity *c : children)
updateBoundingVolumesDebug(c);
+#endif
}
void FrameCleanupJob::setManagers(NodeManagers *managers)
diff --git a/src/render/jobs/job_common_p.h b/src/render/jobs/job_common_p.h
index e776d452d..99bf99195 100644
--- a/src/render/jobs/job_common_p.h
+++ b/src/render/jobs/job_common_p.h
@@ -109,6 +109,7 @@ namespace JobTypes {
UpdateLayerEntity,
SendTextureChangesToFrontend,
SendSetFenceHandlesToFrontend,
+ UpdateEntityHierarchy,
};
} // JobTypes
diff --git a/src/render/jobs/jobs.pri b/src/render/jobs/jobs.pri
index 472531681..0c326c0b5 100644
--- a/src/render/jobs/jobs.pri
+++ b/src/render/jobs/jobs.pri
@@ -31,6 +31,7 @@ HEADERS += \
$$PWD/filterproximitydistancejob_p.h \
$$PWD/abstractpickingjob_p.h \
$$PWD/raycastingjob_p.h \
+ $$PWD/updateentityhierarchyjob_p.h \
$$PWD/updateentitylayersjob_p.h
SOURCES += \
@@ -61,5 +62,6 @@ SOURCES += \
$$PWD/filterproximitydistancejob.cpp \
$$PWD/abstractpickingjob.cpp \
$$PWD/raycastingjob.cpp \
+ $$PWD/updateentityhierarchyjob.cpp \
$$PWD/updateentitylayersjob.cpp
diff --git a/src/render/jobs/raycastingjob.cpp b/src/render/jobs/raycastingjob.cpp
index 70c7ac374..887f203bf 100644
--- a/src/render/jobs/raycastingjob.cpp
+++ b/src/render/jobs/raycastingjob.cpp
@@ -164,8 +164,11 @@ bool RayCastingJob::runHelper()
rays.back().transform(*pair.first->worldTransform());
break;
case QAbstractRayCasterPrivate::ScreenScapeRayCaster:
- for (const PickingUtils::ViewportCameraAreaDetails &vca : vcaDetails)
- rays << rayForViewportAndCamera(vca, nullptr, pair.second->position());
+ for (const PickingUtils::ViewportCameraAreaDetails &vca : vcaDetails) {
+ auto ray = rayForViewportAndCamera(vca, nullptr, pair.second->position());
+ if (ray.isValid())
+ rays << ray;
+ }
break;
default:
Q_UNREACHABLE();
diff --git a/src/render/jobs/updateentityhierarchyjob.cpp b/src/render/jobs/updateentityhierarchyjob.cpp
new file mode 100644
index 000000000..7c18514bb
--- /dev/null
+++ b/src/render/jobs/updateentityhierarchyjob.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "updateentityhierarchyjob_p.h"
+#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
+#include <Qt3DRender/private/entity_p.h>
+#include <Qt3DRender/private/job_common_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+UpdateEntityHierarchyJob::UpdateEntityHierarchyJob()
+ : m_manager(nullptr)
+{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateEntityHierarchy, 0);
+}
+
+void UpdateEntityHierarchyJob::run()
+{
+ Q_ASSERT(m_manager);
+ EntityManager *entityManager = m_manager->renderNodesManager();
+
+ const QVector<HEntity> handles = entityManager->activeHandles();
+
+ // Clear the parents and children
+ for (const HEntity &handle : handles) {
+ Entity *entity = entityManager->data(handle);
+ entity->clearEntityHierarchy();
+ }
+ for (const HEntity &handle : handles) {
+ Entity *entity = entityManager->data(handle);
+ entity->rebuildEntityHierarchy();
+ }
+}
+
+} // Render
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/jobs/updateentityhierarchyjob_p.h b/src/render/jobs/updateentityhierarchyjob_p.h
new file mode 100644
index 000000000..fd2b13631
--- /dev/null
+++ b/src/render/jobs/updateentityhierarchyjob_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QT3DRENDER_RENDER_UPDATEENTITYHIERARCHYJOB_P_H
+#define QT3DRENDER_RENDER_UPDATEENTITYHIERARCHYJOB_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qt3drender_global_p.h>
+#include <Qt3DCore/qaspectjob.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class Entity;
+class NodeManagers;
+
+class Q_3DRENDERSHARED_PRIVATE_EXPORT UpdateEntityHierarchyJob: public Qt3DCore::QAspectJob
+{
+public:
+ UpdateEntityHierarchyJob();
+
+ inline void setManager(NodeManagers *manager) { m_manager = manager; }
+ inline NodeManagers *manager() const { return m_manager; }
+
+ // QAspectJob interface
+ void run() final;
+
+private:
+ NodeManagers *m_manager;
+};
+
+
+using UpdateEntityHierarchyJobPtr = QSharedPointer<UpdateEntityHierarchyJob>;
+
+} // Render
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_UPDATEENTITYHIERARCHYJOB_P_H
diff --git a/src/render/jobs/updateentitylayersjob_p.h b/src/render/jobs/updateentitylayersjob_p.h
index 13cc2fc4c..5d36042c4 100644
--- a/src/render/jobs/updateentitylayersjob_p.h
+++ b/src/render/jobs/updateentitylayersjob_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp
index 141d65c22..e4b651949 100644
--- a/src/render/jobs/updatelevelofdetailjob.cpp
+++ b/src/render/jobs/updatelevelofdetailjob.cpp
@@ -93,6 +93,11 @@ void UpdateLevelOfDetailJob::setFrameGraphRoot(FrameGraphNode *frameGraphRoot)
void UpdateLevelOfDetailJob::run()
{
Q_ASSERT(m_frameGraphRoot && m_root && m_manager);
+
+ // short-circuit if no LoDs exist
+ if (m_manager->levelOfDetailManager()->count() == 0)
+ return;
+
updateEntityLod(m_root);
}
diff --git a/src/render/jobs/updateskinningpalettejob.cpp b/src/render/jobs/updateskinningpalettejob.cpp
index 30ffafa53..1ee9101f9 100644
--- a/src/render/jobs/updateskinningpalettejob.cpp
+++ b/src/render/jobs/updateskinningpalettejob.cpp
@@ -59,6 +59,10 @@ UpdateSkinningPaletteJob::~UpdateSkinningPaletteJob()
void UpdateSkinningPaletteJob::run()
{
+ auto armatureManager = m_nodeManagers->armatureManager();
+ if (armatureManager->count() == 0)
+ return;
+
// TODO: Decompose this job across several jobs, say one per skeleton so
// that it can be done in parallel
@@ -78,7 +82,6 @@ void UpdateSkinningPaletteJob::run()
findDirtyArmatures(m_root, dirtyArmatures);
// Update the skeleton for each dirty armature
- auto armatureManager = m_nodeManagers->armatureManager();
auto skeletonManager = m_nodeManagers->skeletonManager();
for (const auto &armatureHandle : qAsConst(dirtyArmatures)) {
auto armature = armatureManager->data(armatureHandle);