From b6756277908e1d8e15dd3e35da72c42569494152 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Fri, 18 Sep 2015 18:04:22 +0100 Subject: Final batch of file moves for now Change-Id: I0c9e83e3142e6b083feb2cbcabcc4279de64b95b Reviewed-by: Paul Lemire --- src/render/backend/jobs/framecleanupjob.cpp | 76 ---- src/render/backend/jobs/framecleanupjob_p.h | 73 ---- src/render/backend/jobs/framepreparationjob.cpp | 95 ----- src/render/backend/jobs/framepreparationjob_p.h | 74 ---- src/render/backend/jobs/loadbufferjob.cpp | 72 ---- src/render/backend/jobs/loadbufferjob_p.h | 74 ---- src/render/backend/jobs/loadgeometryjob.cpp | 68 ---- src/render/backend/jobs/loadgeometryjob_p.h | 74 ---- src/render/backend/jobs/loadscenejob.cpp | 76 ---- src/render/backend/jobs/loadscenejob_p.h | 76 ---- src/render/backend/jobs/loadtexturedatajob.cpp | 132 ------ src/render/backend/jobs/loadtexturedatajob_p.h | 75 ---- src/render/backend/jobs/render-jobs.pri | 25 -- src/render/backend/jobs/renderviewjob.cpp | 82 ---- src/render/backend/jobs/renderviewjob_p.h | 95 ----- src/render/backend/jobs/renderviewjobutils.cpp | 441 --------------------- src/render/backend/jobs/renderviewjobutils_p.h | 149 ------- .../backend/jobs/updateboundingvolumejob.cpp | 116 ------ .../backend/jobs/updateboundingvolumejob_p.h | 70 ---- .../backend/jobs/updateworldtransformjob.cpp | 98 ----- .../backend/jobs/updateworldtransformjob_p.h | 70 ---- 21 files changed, 2111 deletions(-) delete mode 100644 src/render/backend/jobs/framecleanupjob.cpp delete mode 100644 src/render/backend/jobs/framecleanupjob_p.h delete mode 100644 src/render/backend/jobs/framepreparationjob.cpp delete mode 100644 src/render/backend/jobs/framepreparationjob_p.h delete mode 100644 src/render/backend/jobs/loadbufferjob.cpp delete mode 100644 src/render/backend/jobs/loadbufferjob_p.h delete mode 100644 src/render/backend/jobs/loadgeometryjob.cpp delete mode 100644 src/render/backend/jobs/loadgeometryjob_p.h delete mode 100644 src/render/backend/jobs/loadscenejob.cpp delete mode 100644 src/render/backend/jobs/loadscenejob_p.h delete mode 100644 src/render/backend/jobs/loadtexturedatajob.cpp delete mode 100644 src/render/backend/jobs/loadtexturedatajob_p.h delete mode 100644 src/render/backend/jobs/render-jobs.pri delete mode 100644 src/render/backend/jobs/renderviewjob.cpp delete mode 100644 src/render/backend/jobs/renderviewjob_p.h delete mode 100644 src/render/backend/jobs/renderviewjobutils.cpp delete mode 100644 src/render/backend/jobs/renderviewjobutils_p.h delete mode 100644 src/render/backend/jobs/updateboundingvolumejob.cpp delete mode 100644 src/render/backend/jobs/updateboundingvolumejob_p.h delete mode 100644 src/render/backend/jobs/updateworldtransformjob.cpp delete mode 100644 src/render/backend/jobs/updateworldtransformjob_p.h (limited to 'src/render/backend/jobs') diff --git a/src/render/backend/jobs/framecleanupjob.cpp b/src/render/backend/jobs/framecleanupjob.cpp deleted file mode 100644 index 7d6df11b4..000000000 --- a/src/render/backend/jobs/framecleanupjob.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "framecleanupjob_p.h" -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -FrameCleanupJob::FrameCleanupJob(Renderer *renderer) - : m_renderer(renderer) -{ -} - -FrameCleanupJob::~FrameCleanupJob() -{ -} - -void FrameCleanupJob::run() -{ - // set each ShaderData to not need an update - Q_FOREACH (const Qt3D::QNodeId &id, ShaderData::updatedShaderDataList()) { - ShaderData *shaderData = m_renderer->shaderDataManager()->lookupResource(id); - if (shaderData != Q_NULLPTR) - shaderData->clearUpdate(); - } - ShaderData::clearShaderDataList(); - - // Cleanup texture handles - TextureDataManager *textureDataManager = m_renderer->textureDataManager(); - textureDataManager->cleanup(); -} - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/framecleanupjob_p.h b/src/render/backend/jobs/framecleanupjob_p.h deleted file mode 100644 index c0afc13d5..000000000 --- a/src/render/backend/jobs/framecleanupjob_p.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_FRAMECLEANUPJOB_H -#define QT3DRENDER_RENDER_FRAMECLEANUPJOB_H - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -namespace Render { - -class Renderer; -class Entity; - -class FrameCleanupJob : public Qt3D::QAspectJob -{ -public: - explicit FrameCleanupJob(Renderer *renderer); - ~FrameCleanupJob(); - -protected: - void run() Q_DECL_FINAL; - -private: - Renderer *m_renderer; -}; - -typedef QSharedPointer FrameCleanupJobPtr; - -} // namespace Render - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_FRAMECLEANUPJOB_H diff --git a/src/render/backend/jobs/framepreparationjob.cpp b/src/render/backend/jobs/framepreparationjob.cpp deleted file mode 100644 index 8b98fb54d..000000000 --- a/src/render/backend/jobs/framepreparationjob.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "framepreparationjob_p.h" -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -FramePreparationJob::FramePreparationJob(Entity *root) - : m_root(root) -{ -} - -FramePreparationJob::~FramePreparationJob() -{ - -} - -void FramePreparationJob::run() -{ - parseNodeTree(m_root); -} - -void FramePreparationJob::parseNodeTree(Entity *node) -{ - // Initialize worldBoundingVolume if Mesh associated - Qt3DRender::Render::GeometryRenderer *mesh = Q_NULLPTR; - if ((node->localBoundingVolume()->isNull()) - && (mesh = node->renderComponent()) != Q_NULLPTR) { - // if (!mesh->meshDataHandle().isNull()) { - // Qt3DRender::QMeshData *meshData = mesh->meshData(); - // if (meshData != Q_NULLPTR) { - // const QAxisAlignedBoundingBox box = meshData->boundingBox(); - // node->localBoundingVolume()->setCenter(box.center()); - // const QVector3D &radii = box.radii(); - // node->localBoundingVolume()->setRadius(qMax(radii.x(), qMax(radii.y(), radii.z()))); - // } - // } - // TO DO: Make that work with the GeometryRenderer - } - - // Update transform properties in ShaderData - QList shadersData = node->renderComponents(); - Q_FOREACH (ShaderData *r, shadersData) { - r->updateTransformedProperties(*node->worldTransform()); - } - - // Traverse children - Q_FOREACH (Entity *child, node->children()) - parseNodeTree(child); -} - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/framepreparationjob_p.h b/src/render/backend/jobs/framepreparationjob_p.h deleted file mode 100644 index cc5c7feef..000000000 --- a/src/render/backend/jobs/framepreparationjob_p.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_FRAMEPREPARATIONJOB_H -#define QT3DRENDER_RENDER_FRAMEPREPARATIONJOB_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -namespace Render { - -class Renderer; -class Entity; - -class FramePreparationJob : public Qt3D::QAspectJob -{ -public: - FramePreparationJob(Entity *root); - ~FramePreparationJob(); - -protected: - void run() Q_DECL_FINAL; - -private: - void parseNodeTree(Entity *node); - - Entity *m_root; -}; - -typedef QSharedPointer FramePreparationJobPtr; - -} // namespace Render - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_FRAMEPREPARATIONJOB_H diff --git a/src/render/backend/jobs/loadbufferjob.cpp b/src/render/backend/jobs/loadbufferjob.cpp deleted file mode 100644 index 4feb07358..000000000 --- a/src/render/backend/jobs/loadbufferjob.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Paul Lemire -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "loadbufferjob_p.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -namespace Render { - - -LoadBufferJob::LoadBufferJob(const HBuffer &handle) - : QAspectJob() - , m_handle(handle) - , m_renderer(Q_NULLPTR) -{ -} - -LoadBufferJob::~LoadBufferJob() -{ -} - -void LoadBufferJob::run() -{ - // Let's leave it for the moment until this has been properly tested - qDebug() << Q_FUNC_INFO; - Buffer *buffer = m_renderer->bufferManager()->data(m_handle); - buffer->executeFunctor(); -} - -} // namespace Render - -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/loadbufferjob_p.h b/src/render/backend/jobs/loadbufferjob_p.h deleted file mode 100644 index 7ad43a8a0..000000000 --- a/src/render/backend/jobs/loadbufferjob_p.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Paul Lemire -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_LOADBUFFERJOB_H -#define QT3DRENDER_RENDER_LOADBUFFERJOB_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -namespace Render { - -class Renderer; - -class LoadBufferJob : public Qt3D::QAspectJob -{ -public: - explicit LoadBufferJob(const HBuffer &handle); - ~LoadBufferJob(); - - void setRenderer(Renderer *renderer) { m_renderer = renderer; } - -protected: - void run() Q_DECL_OVERRIDE; - HBuffer m_handle; - Renderer *m_renderer; -}; - -typedef QSharedPointer LoadBufferJobPtr; - -} // namespace Render - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_LOADBUFFERJOB_H diff --git a/src/render/backend/jobs/loadgeometryjob.cpp b/src/render/backend/jobs/loadgeometryjob.cpp deleted file mode 100644 index 695e32dc1..000000000 --- a/src/render/backend/jobs/loadgeometryjob.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Paul Lemire -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "loadgeometryjob_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -namespace Render { - -LoadGeometryJob::LoadGeometryJob(const HGeometryRenderer &handle) - : QAspectJob() - , m_handle(handle) -{ -} - -LoadGeometryJob::~LoadGeometryJob() -{ -} - -void LoadGeometryJob::run() -{ - GeometryRenderer *geometryRenderer = m_renderer->geometryRendererManager()->data(m_handle); - if (geometryRenderer != Q_NULLPTR) - geometryRenderer->executeFunctor(); -} - -} // namespace Render - -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/loadgeometryjob_p.h b/src/render/backend/jobs/loadgeometryjob_p.h deleted file mode 100644 index 493b1b694..000000000 --- a/src/render/backend/jobs/loadgeometryjob_p.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Paul Lemire -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_LOADGEOMETRYJOB_H -#define QT3DRENDER_RENDER_LOADGEOMETRYJOB_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -namespace Render { - -class Renderer; - -class LoadGeometryJob : public Qt3D::QAspectJob -{ -public: - explicit LoadGeometryJob(const HGeometryRenderer &handle); - ~LoadGeometryJob(); - - void setRenderer(Renderer *renderer) { m_renderer = renderer; } - -protected: - void run() Q_DECL_OVERRIDE; - HGeometryRenderer m_handle; - Renderer *m_renderer; -}; - -typedef QSharedPointer LoadGeometryJobPtr; - -} // namespace Render - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_LOADGEOMETRYJOB_H diff --git a/src/render/backend/jobs/loadscenejob.cpp b/src/render/backend/jobs/loadscenejob.cpp deleted file mode 100644 index 6ceda73da..000000000 --- a/src/render/backend/jobs/loadscenejob.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "loadscenejob_p.h" -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -LoadSceneJob::LoadSceneJob(const QUrl &source, const Qt3D::QNodeId &m_sceneComponent) - : QAspectJob() - , m_renderer(Q_NULLPTR) - , m_source(source) - , m_sceneComponent(m_sceneComponent) -{ -} - -void LoadSceneJob::run() -{ - Qt3D::QEntity *sceneTree = m_renderer->sceneManager()->sceneTreeFromSource(m_source); - if (sceneTree == Q_NULLPTR) { - Q_FOREACH (AbstractSceneParser *parser, m_renderer->sceneParsers()) { - if (parser->isExtensionSupported(m_source)) { - parser->setSource(m_source); - sceneTree = parser->scene(); - m_renderer->sceneManager()->addLoadedSceneTree(m_source, sceneTree); - } - } - } - // set clone of sceneTree in sceneComponent - Scene *scene = m_renderer->sceneManager()->lookupResource(m_sceneComponent); - scene->setSceneSubtree(sceneTree); -} - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/loadscenejob_p.h b/src/render/backend/jobs/loadscenejob_p.h deleted file mode 100644 index d4831d7ed..000000000 --- a/src/render/backend/jobs/loadscenejob_p.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_LOADSCENEJOB_H -#define QT3DRENDER_RENDER_LOADSCENEJOB_H - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -namespace Render { - -class Renderer; - -class LoadSceneJob : public Qt3D::QAspectJob -{ -public: - explicit LoadSceneJob(const QUrl &source, const Qt3D::QNodeId &sceneComponent); - void setRenderer(Renderer *renderer) { m_renderer = renderer; } - -protected: - void run() Q_DECL_OVERRIDE; - -private: - Renderer *m_renderer; - QUrl m_source; - Qt3D::QNodeId m_sceneComponent; -}; - -typedef QSharedPointer LoadSceneJobPtr; - -} // namespace Render - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // LOADSCENEJOB_H diff --git a/src/render/backend/jobs/loadtexturedatajob.cpp b/src/render/backend/jobs/loadtexturedatajob.cpp deleted file mode 100644 index 2dadcd69e..000000000 --- a/src/render/backend/jobs/loadtexturedatajob.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "loadtexturedatajob_p.h" -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -LoadTextureDataJob::LoadTextureDataJob(const Qt3D::QNodeId &textureId) - : m_textureId(textureId) -{ -} - -LoadTextureDataJob::~LoadTextureDataJob() -{ -} - -void LoadTextureDataJob::run() -{ - qCDebug(Jobs) << "Entering" << Q_FUNC_INFO << QThread::currentThread(); - - Texture *txt = m_renderer->textureManager()->lookupResource(m_textureId); - - if (txt != Q_NULLPTR) { - // Load update each TextureImage - Q_FOREACH (HTextureImage texImgHandle, txt->textureImages()) { - TextureImage *texImg = m_renderer->textureImageManager()->data(texImgHandle); - if (texImg != Q_NULLPTR && texImg->isDirty() && !texImg->dataFunctor().isNull()) { - QTextureDataFunctorPtr functor = texImg->dataFunctor(); - HTextureData textureDataHandle; - TexImageData *data = Q_NULLPTR; - - // scoped for locker - { - QMutexLocker locker(m_renderer->textureDataManager()->mutex()); - // We don't want to take the chance of having two jobs uploading the same functor - // because of sync issues - textureDataHandle = m_renderer->textureDataManager()->textureDataFromFunctor(functor); - - // Texture data handle isn't null == there's already a matching TextureData - if (!textureDataHandle.isNull()) { - data = m_renderer->textureDataManager()->data(textureDataHandle); - } else { - TexImageDataPtr dataPtr = functor->operator ()(); - if (dataPtr.isNull()) { - qCDebug(Jobs) << Q_FUNC_INFO << "Texture has no raw data"; - } else { - // Save the TexImageDataPtr with it's functor as a key - textureDataHandle = m_renderer->textureDataManager()->acquire(); - data = m_renderer->textureDataManager()->data(textureDataHandle); - *data = *(dataPtr.data()); - m_renderer->textureDataManager()->addTextureDataForFunctor(textureDataHandle, functor); - } - } - - // Update HTextureImage Functor to release TextureData when needed - m_renderer->textureDataManager()->assignFunctorToTextureImage(functor, texImgHandle); - } - - // Set texture size of texture if the first layer / level / face has a valid size - // otherwise assume the size was set on the texture itself - if (texImg->layer() == 0 && texImg->mipmapLevel() == 0 && - texImg->face() == QAbstractTextureProvider::CubeMapPositiveX) { - - if (data == Q_NULLPTR) { - qWarning() << "Texture data is null, texture data failed to load"; - } else { - // Set the size of the texture based on the layer 0 / level 0 - // if the functor provides something valid. Otherwise we assume the texture - // already has the correct size - if (data->width() != -1 && data->height() != -1 && data->depth() != -1) { - txt->setSize(data->width(), data->height(), data->depth()); - } - // Set the format of the texture if the texture format is set to Automatic - if (txt->format() == QAbstractTextureProvider::Automatic) { - txt->setFormat(static_cast(data->format())); - } - } - } - // Set the textureDataHandle on the texture image - texImg->setTextureDataHandle(textureDataHandle); - } - } - // Tell the renderer to reload the TextureImage for the Texture - // next frame - txt->requestTextureDataUpdate(); - } -} - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/loadtexturedatajob_p.h b/src/render/backend/jobs/loadtexturedatajob_p.h deleted file mode 100644 index 15b32c79b..000000000 --- a/src/render/backend/jobs/loadtexturedatajob_p.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_LOADTEXTUREDATAJOB_H -#define QT3DRENDER_RENDER_LOADTEXTUREDATAJOB_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -namespace Render { - -class Renderer; - -class LoadTextureDataJob : public Qt3D::QAspectJob -{ -public: - LoadTextureDataJob(const Qt3D::QNodeId &textureId); - ~LoadTextureDataJob(); - inline void setRenderer(Renderer *renderer) { m_renderer = renderer; } - -protected: - void run() Q_DECL_FINAL; - -private: - Qt3D::QNodeId m_textureId; - Renderer *m_renderer; -}; - -typedef QSharedPointer LoadTextureDataJobPtr; - -} // namespace Render - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_LOADTEXTUREDATAJOB_H diff --git a/src/render/backend/jobs/render-jobs.pri b/src/render/backend/jobs/render-jobs.pri deleted file mode 100644 index 2c9b93a4e..000000000 --- a/src/render/backend/jobs/render-jobs.pri +++ /dev/null @@ -1,25 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/updateworldtransformjob_p.h \ - $$PWD/updateboundingvolumejob_p.h \ - $$PWD/renderviewjob_p.h \ - $$PWD/renderviewjobutils_p.h \ - $$PWD/loadscenejob_p.h \ - $$PWD/framecleanupjob_p.h \ - $$PWD/framepreparationjob_p.h \ - $$PWD/loadtexturedatajob_p.h \ - $$PWD/loadbufferjob_p.h \ - $$PWD/loadgeometryjob_p.h - -SOURCES += \ - $$PWD/updateworldtransformjob.cpp \ - $$PWD/updateboundingvolumejob.cpp \ - $$PWD/renderviewjob.cpp \ - $$PWD/renderviewjobutils.cpp \ - $$PWD/loadscenejob.cpp \ - $$PWD/framecleanupjob.cpp \ - $$PWD/framepreparationjob.cpp \ - $$PWD/loadtexturedatajob.cpp \ - $$PWD/loadbufferjob.cpp \ - $$PWD/loadgeometryjob.cpp diff --git a/src/render/backend/jobs/renderviewjob.cpp b/src/render/backend/jobs/renderviewjob.cpp deleted file mode 100644 index 962bcaaa7..000000000 --- a/src/render/backend/jobs/renderviewjob.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "renderviewjob_p.h" - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -void RenderViewJob::run() -{ - qCDebug(Jobs) << Q_FUNC_INFO << m_index; - - // Create a RenderView object - // The RenderView are created from a QFrameAllocator stored in the current Thread local storage - - Qt3D::QFrameAllocator *currentFrameAllocator = m_renderer->currentFrameAllocator(); - RenderView *renderView = currentFrameAllocator->allocate(); - - // RenderView should allocate heap resources using only the currentFrameAllocator - renderView->setAllocator(currentFrameAllocator); - renderView->setRenderer(m_renderer); - renderView->setSurfaceSize(m_surfaceSize); - - // Populate the renderview's configuration from the framegraph - setRenderViewConfigFromFrameGraphLeafNode(renderView, m_fgLeaf); - - // Build RenderCommand should perform the culling as we have no way to determine - // if a child has a mesh in the view frustum while its parent isn't contained in it. - if (!renderView->noDraw()) - renderView->buildRenderCommands(m_renderer->renderSceneRoot()); - - // Sorts RenderCommand - renderView->sort(); - - // Enqueue our fully populated RenderView with the RenderThread - m_renderer->enqueueRenderView(renderView, m_index); -} - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/renderviewjob_p.h b/src/render/backend/jobs/renderviewjob_p.h deleted file mode 100644 index 281928500..000000000 --- a/src/render/backend/jobs/renderviewjob_p.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_RENDERVIEWJOB_H -#define QT3DRENDER_RENDER_RENDERVIEWJOB_H - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -namespace Render { - -class Renderer; -class FrameGraphNode; - -class RenderViewJob : public Qt3D::QAspectJob -{ -public: - RenderViewJob() - : m_renderer(0) - , m_fgLeaf(0) - , m_index(0) - {} - - inline void setRenderer(Renderer *renderer) { m_renderer = renderer; } - inline void setSurfaceSize(const QSize &size) { m_surfaceSize = size; } - - inline void setFrameGraphLeafNode(FrameGraphNode *fgLeaf) - { - m_fgLeaf = fgLeaf; - } - - // Sets the position in the queue of RenderViews that the - // RenderView generated by this job should be inserted. This is - // used to ensure that for example a RenderView for creating - // a shadow map texture is submitted before the RenderView that - // contains commands making use of the shadow map - inline void setSubmitOrderIndex(int index) { m_index = index; } - -protected: - void run() Q_DECL_OVERRIDE; - -private: - Renderer *m_renderer; - QSize m_surfaceSize; - FrameGraphNode *m_fgLeaf; - int m_index; -}; - -typedef QSharedPointer RenderViewJobPtr; - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_RENDERVIEWJOB_H diff --git a/src/render/backend/jobs/renderviewjobutils.cpp b/src/render/backend/jobs/renderviewjobutils.cpp deleted file mode 100644 index 9cf472549..000000000 --- a/src/render/backend/jobs/renderviewjobutils.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "renderviewjobutils_p.h" -#include "renderlogging_p.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -using namespace Qt3D; - -namespace Qt3DRender { -namespace Render { - -/*! - \internal - Walks up the framegraph tree from \a fgLeaf and builds up as much state - as possible and populates \a rv. For cases where we can't get the specific state - (e.g. because it depends upon more than just the framegraph) we store the data from - the framegraph that will be needed to later when the rest of the data becomes available -*/ -void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphNode *fgLeaf) -{ - // The specific RenderPass to be used is also dependent upon the Effect and TechniqueFilter - // which is referenced by the Material which is referenced by the RenderMesh. So we can - // only store the filter info in the RenderView structure and use it to do the resolving - // when we build the RenderCommand list. - const Renderer *renderer = rv->renderer(); - const FrameGraphNode *node = fgLeaf; - - while (node) { - FrameGraphNode::FrameGraphNodeType type = node->nodeType(); - if (node->isEnabled()) - switch (type) { - case FrameGraphNode::CameraSelector: - // Can be set only once and we take camera nearest to the leaf node - if (!rv->renderCamera()) { - const CameraSelector *cameraSelector = static_cast(node); - Entity *camNode = renderer->renderNodesManager()->lookupResource(cameraSelector->cameraUuid()); - if (camNode) { - CameraLens *lens = camNode->renderComponent(); - if (lens && lens->isEnabled()) { - rv->setRenderCamera(lens); - rv->setViewMatrix(*camNode->worldTransform()); - rv->setEyePosition(camNode->worldBoundingVolume()->center()); - } - } - break; - } - - case FrameGraphNode::LayerFilter: // Can be set multiple times in the tree - rv->appendLayerFilter(static_cast(node)->layers()); - break; - - case FrameGraphNode::RenderPassFilter: - // Can be set once - // TODO: Amalgamate all render pass filters from leaf to root - if (!rv->renderPassFilter()) - rv->setRenderPassFilter(static_cast(node)); - break; - - case FrameGraphNode::RenderTarget: { - // Can be set once and we take render target nearest to the leaf node - const RenderTargetSelector *targetSelector = static_cast(node); - QNodeId renderTargetUid = targetSelector->renderTargetUuid(); - HTarget renderTargetHandle = renderer->renderTargetManager()->lookupHandle(renderTargetUid); - if (rv->renderTargetHandle().isNull()) { - rv->setRenderTargetHandle(renderTargetHandle); - - RenderTarget *renderTarget = renderer->renderTargetManager()->data(renderTargetHandle); - if (renderTarget) { - // Add renderTarget Handle and build renderCommand AttachmentPack - - // Copy draw buffers list - rv->setDrawBuffers(targetSelector->drawBuffers()); - - // Copy attachments - Q_FOREACH (const QNodeId &attachmentId, renderTarget->renderAttachments()) { - RenderAttachment *attachment = renderer->attachmentManager()->lookupResource(attachmentId); - if (attachment) - rv->addRenderAttachment(attachment->attachment()); - } - - } - } - break; - } - - case FrameGraphNode::ClearBuffer: - rv->setClearBuffer(static_cast(node)->type()); - break; - - case FrameGraphNode::TechniqueFilter: - // Can be set once - // TODO Amalgamate all technique filters from leaf to root - if (rv->techniqueFilter()) - rv->setTechniqueFilter(static_cast(node)); - break; - - case FrameGraphNode::Viewport: { - // If the Viewport has already been set in a lower node - // Make it so that the new viewport is actually - // a subregion relative to that of the parent viewport - const ViewportNode *vpNode = static_cast(node); - rv->setViewport(computeViewport(rv->viewport(), vpNode)); - - // We take the clear color from the viewport node nearest the leaf - if (!rv->clearColor().isValid()) - rv->setClearColor(vpNode->clearColor()); - break; - } - - case FrameGraphNode::SortMethod: { - const Render::SortMethod *sortMethod = static_cast(node); - rv->addSortCriteria(sortMethod->criteria()); - break; - } - - case FrameGraphNode::SubtreeSelector: - // Has no meaning here. SubtreeSelector was used - // in a prior step to build the list of RenderViewJobs - break; - - case FrameGraphNode::StateSet: { - const Render::StateSetNode *rStateSet = static_cast(node); - // Create global RenderStateSet for renderView if no stateSet was set before - RenderStateSet *stateSet = rv->stateSet(); - if (stateSet == Q_NULLPTR) { - stateSet = rv->allocator()->allocate(); - rv->setStateSet(stateSet); - } - - // Add renderstates to stateset - const QList &states = rStateSet->renderStates(); - Q_FOREACH (RenderState *renderState, states) - stateSet->addState(renderState); - - break; - } - - case FrameGraphNode::NoDraw: { - rv->setNoDraw(true); - break; - } - - default: - // Should never get here - qCWarning(Backend) << "Unhandled FrameGraphNode type"; - } - - node = node->parent(); - } -} - -/*! - \internal - Searches the \a renderer for the best matching Technique from - \a effect specified by the \a renderView. -*/ -Technique *findTechniqueForEffect(Renderer *renderer, - RenderView *renderView, - Effect *effect) -{ - if (!effect) - return Q_NULLPTR; - - // Iterate through the techniques in the effect - Q_FOREACH (const QNodeId &techniqueId, effect->techniques()) { - Technique *technique = renderer->techniqueManager()->lookupResource(techniqueId); - - if (!technique) - continue; - - // We need to be sure the renderer is still running <=> still has a GraphicsContext - if (renderer->isRunning() && *renderer->contextInfo() == *technique->openGLFilter()) { - - // If no techniqueFilter is present, we return the technique as it satisfies OpenGL version - const TechniqueFilter *techniqueFilter = renderView->techniqueFilter(); - bool foundMatch = (techniqueFilter == Q_NULLPTR || techniqueFilter->filters().isEmpty()); - if (foundMatch) - return technique; - - // There is a technique filter so we need to check for a technique with suitable criteria. - // Check for early bail out if the technique doesn't have sufficient number of criteria and - // can therefore never satisfy the filter - if (technique->annotations().size() < techniqueFilter->filters().size()) - continue; - - // Iterate through the filter criteria and for each one search for a criteria on the - // technique that satisfies it - Q_FOREACH (const QNodeId &filterAnnotationId, techniqueFilter->filters()) { - foundMatch = false; - Annotation *filterAnnotation = renderer->criterionManager()->lookupResource(filterAnnotationId); - - Q_FOREACH (const QNodeId &techniqueAnnotationId, technique->annotations()) { - Annotation *techniqueAnnotation = renderer->criterionManager()->lookupResource(techniqueAnnotationId); - if ((foundMatch = (*techniqueAnnotation == *filterAnnotation))) - break; - } - - if (!foundMatch) { - // No match for TechniqueFilter criterion in any of the technique's criteria. - // So no way this can match. Don't bother checking the rest of the criteria. - break; - } - } - - if (foundMatch) - return technique; // All criteria matched - we have a winner! - } - } - - // We failed to find a suitable technique to use :( - return Q_NULLPTR; -} - - -RenderRenderPassList findRenderPassesForTechnique(Renderer *renderer, - RenderView *renderView, - Technique *technique) -{ - Q_ASSERT(renderer); - Q_ASSERT(technique); - - RenderRenderPassList passes; - Q_FOREACH (const QNodeId &passId, technique->renderPasses()) { - RenderPass *renderPass = renderer->renderPassManager()->lookupResource(passId); - - if (renderPass) { - const RenderPassFilter *passFilter = renderView->renderPassFilter(); - bool foundMatch = (!passFilter || passFilter->filters().size() == 0); - - // A pass filter is present so we need to check for matching criteria - if (!foundMatch && renderPass->annotations().size() >= passFilter->filters().size()) { - - // Iterate through the filter criteria and look for render passes with criteria that satisfy them - Q_FOREACH (const QNodeId &filterAnnotationId, passFilter->filters()) { - foundMatch = false; - Annotation *filterAnnotation = renderer->criterionManager()->lookupResource(filterAnnotationId); - - Q_FOREACH (const QNodeId &passAnnotationId, renderPass->annotations()) { - Annotation *passAnnotation = renderer->criterionManager()->lookupResource(passAnnotationId); - if ((foundMatch = (*passAnnotation == *filterAnnotation))) - break; - } - - if (!foundMatch) { - // No match for criterion in any of the render pass' criteria - break; - } - } - } - - if (foundMatch) { - // Found a renderpass that satisfies our needs. Add it in order - passes << renderPass; - } - } - } - - return passes; -} - - -ParameterInfoList::iterator findParamInfo(ParameterInfoList *params, const QString &name) -{ - ParameterInfoList::iterator it = std::lower_bound(params->begin(), params->end(), name); - if (it != params->end() && it->name != name) - return params->end(); - return it; -} - -void addParametersForIds(ParameterInfoList *params, ParameterManager *manager, - const QList ¶meterIds) -{ - Q_FOREACH (const QNodeId ¶mId, parameterIds) { - Parameter *param = manager->lookupResource(paramId); - if (param != Q_NULLPTR) { - ParameterInfoList::iterator it = std::lower_bound(params->begin(), params->end(), param->name()); - if (it == params->end() || it->name != param->name()) - params->insert(it, ParameterInfo(param->name(), param->value())); - } - } -} - -void parametersFromMaterialEffectTechnique(ParameterInfoList *infoList, - ParameterManager *manager, - Material *material, - Effect *effect, - Technique *technique) -{ - // The parameters are taken in the following priority order: - // - // 1) Material - // 2) Technique - // 3) Effect - // - // That way a user can override defaults in Effect's and Techniques on a - // object manner and a Technique can override global defaults from the Effect. - parametersFromParametersProvider(infoList, manager, material); - parametersFromParametersProvider(infoList, manager, technique); - parametersFromParametersProvider(infoList, manager, effect); -} - -RenderStateSet *buildRenderStateSet(const QList &states, QFrameAllocator *allocator) -{ - RenderStateSet *stateSet = allocator->allocate(); - - Q_FOREACH (RenderState *renderState, states) { - stateSet->addState(renderState); - } - - return stateSet; -} - -namespace { - -const QString blockArray = QStringLiteral("[%1]"); -const int qNodeIdTypeId = qMetaTypeId(); - -} - -UniformBlockValueBuilder::UniformBlockValueBuilder() - : shaderDataManager(Q_NULLPTR) -{ -} - -UniformBlockValueBuilder::~UniformBlockValueBuilder() -{ -} - -void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const QString &blockName, const QString &qmlPropertyName, const QVariant &value) -{ - // In the end, values are either scalar or a scalar array - // Composed elements (structs, structs array) are simplified into simple scalars - if (value.userType() == QMetaType::QVariantList) { // Array - QVariantList list = value.value(); - if (list.at(0).userType() == qNodeIdTypeId) { // Array of struct qmlPropertyName[i].structMember - for (int i = 0; i < list.size(); ++i) { - if (list.at(i).userType() == qNodeIdTypeId) { - ShaderData *subShaderData = shaderDataManager->lookupResource(list.at(i).value()); - if (subShaderData) - buildActiveUniformNameValueMapStructHelper(subShaderData, - blockName + QStringLiteral(".") + qmlPropertyName + blockArray.arg(i), - QStringLiteral("")); - } - } - } else { // Array of scalar/vec qmlPropertyName[0] - QString varName = blockName + QStringLiteral(".") + qmlPropertyName + QStringLiteral("[0]"); - if (uniforms.contains(varName)) { - qCDebug(Shaders) << "UBO array member " << varName << " set for update"; - activeUniformNamesToValue.insert(varName, value); - } - } - } else if (value.userType() == qNodeIdTypeId) { // Struct qmlPropertyName.structMember - ShaderData *rSubShaderData = shaderDataManager->lookupResource(value.value()); - if (rSubShaderData) - buildActiveUniformNameValueMapStructHelper(rSubShaderData, - blockName, - qmlPropertyName); - } else { // Scalar / Vec - QString varName = blockName + QStringLiteral(".") + qmlPropertyName; - if (uniforms.contains(varName)) { - qCDebug(Shaders) << "UBO scalar member " << varName << " set for update"; - activeUniformNamesToValue.insert(varName, value); - } - } -} - -void UniformBlockValueBuilder::buildActiveUniformNameValueMapStructHelper(ShaderData *rShaderData, const QString &blockName, const QString &qmlPropertyName) -{ - const QHash &properties = updatedPropertiesOnly ? rShaderData->updatedProperties() : rShaderData->properties(); - QHash::const_iterator it = properties.begin(); - const QHash::const_iterator end = properties.end(); - - while (it != end) { - QString prefix = qmlPropertyName.isEmpty() ? QStringLiteral("") : QStringLiteral("."); - buildActiveUniformNameValueMapHelper(blockName + prefix + qmlPropertyName, - it.key(), - it.value()); - ++it; - } -} - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/renderviewjobutils_p.h b/src/render/backend/jobs/renderviewjobutils_p.h deleted file mode 100644 index 3e362b39c..000000000 --- a/src/render/backend/jobs/renderviewjobutils_p.h +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDERVIEWJOBUTILS_P_H -#define QT3DRENDER_RENDERVIEWJOBUTILS_P_H - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3D { -class QFrameAllocator; -} - -namespace Qt3DRender { -namespace Render { - -class FrameGraphNode; -class ParameterManager; -class Effect; -class Entity; -class Material; -class RenderPass; -class RenderStateSet; -class Technique; -class RenderView; -class Renderer; -class ShaderDataManager; -struct ShaderUniform; -class ShaderData; -class RenderState; - -Q_AUTOTEST_EXPORT void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, - const FrameGraphNode *fgLeaf); - -Q_AUTOTEST_EXPORT Technique *findTechniqueForEffect(Renderer *renderer, - RenderView *renderView, - Effect *effect); - -typedef QVarLengthArray RenderRenderPassList; -Q_AUTOTEST_EXPORT RenderRenderPassList findRenderPassesForTechnique(Renderer *renderer, - RenderView *renderView, - Technique *technique); - -struct ParameterInfo -{ - ParameterInfo(const QString &name = QString(), const QVariant &value = QVariant()) - : name(name) - , value(value) - {} - - QString name; - QVariant value; - - bool operator<(const QString &otherName) const - { - return name < otherName; - } -}; - -typedef QVarLengthArray ParameterInfoList; - -Q_AUTOTEST_EXPORT void parametersFromMaterialEffectTechnique(ParameterInfoList *infoList, - ParameterManager *manager, - Material *material, - Effect *effect, - Technique *technique); - -Q_AUTOTEST_EXPORT void addParametersForIds(ParameterInfoList *params, ParameterManager *manager, - const QList ¶meterIds); - -template -void parametersFromParametersProvider(ParameterInfoList *infoList, - ParameterManager *manager, - T *pass) -{ - if (pass) - addParametersForIds(infoList, manager, pass->parameters()); -} - -Q_AUTOTEST_EXPORT ParameterInfoList::iterator findParamInfo(ParameterInfoList *infoList, - const QString &name); - -Q_AUTOTEST_EXPORT RenderStateSet *buildRenderStateSet(const QList &states, - Qt3D::QFrameAllocator *allocator); - - -struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder -{ - UniformBlockValueBuilder(); - ~UniformBlockValueBuilder(); - - void buildActiveUniformNameValueMapHelper(const QString &blockName, - const QString &qmlPropertyName, - const QVariant &value); - void buildActiveUniformNameValueMapStructHelper(ShaderData *rShaderData, - const QString &blockName, - const QString &qmlPropertyName = QString()); - - bool updatedPropertiesOnly; - QHash uniforms; - QHash activeUniformNamesToValue; - ShaderDataManager *shaderDataManager; -}; - -} // namespace Render -} // namespace Qt3DRender - -Q_DECLARE_TYPEINFO(Qt3DRender::Render::ParameterInfo, Q_MOVABLE_TYPE); - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDERVIEWJOBUTILS_P_H diff --git a/src/render/backend/jobs/updateboundingvolumejob.cpp b/src/render/backend/jobs/updateboundingvolumejob.cpp deleted file mode 100644 index 3c8f47262..000000000 --- a/src/render/backend/jobs/updateboundingvolumejob.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "updateboundingvolumejob_p.h" - -#include -#include -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -namespace { - -void expandWorldBoundingVolume(Qt3DRender::Render::Entity *node) -{ - Qt3DRender::Render::Entity *currentNode = node; - QStack childIndexStack; - forever { - - // Find left most leaf node of currentNode - while (!currentNode && !currentNode->children().isEmpty()) { - childIndexStack.push(1); - currentNode = currentNode->children().first(); - } - - if (!currentNode || !currentNode->parent()) - return; - - // Initialize parent bounding volume to be equal to that of the first child - Qt3DRender::Render::Entity *parentNode = currentNode->parent(); - Qt3DRender::Sphere *parentBoundingVolume = parentNode->worldBoundingVolume(); - *(parentBoundingVolume) = *(currentNode->worldBoundingVolume()); - - // Expand the parent bounding volume by each of remaining the siblings - QVector siblings = parentNode->children(); - const int siblingCount = siblings.count(); - for (int i = 1; i < siblingCount; ++i) { - Qt3DRender::Sphere *siblingBoundingVolume = siblings.at(i)->worldBoundingVolume(); - parentBoundingVolume->expandToContain(*siblingBoundingVolume); - } - - // Move to parent's next sibling - childIndexStack.pop(); - currentNode = Q_NULLPTR; - if (!childIndexStack.empty() && parentNode->parent()) { - const int nextSiblingIndex = childIndexStack.top()++; - QVector parentSiblings = parentNode->parent()->children(); - if (nextSiblingIndex < parentSiblings.size()) - currentNode = parentSiblings.at(nextSiblingIndex); - } - } -} - -} - -UpdateBoundingVolumeJob::UpdateBoundingVolumeJob(Entity *node) - : m_node(node) -{ -} - -void UpdateBoundingVolumeJob::run() -{ - // Expand the bounding volumes of each node that has children by the - // bounding volumes of the children - - // TODO: Implement this using a parallel_for - qCDebug(Jobs) << "Entering" << Q_FUNC_INFO << QThread::currentThread(); - expandWorldBoundingVolume(m_node); - qCDebug(Jobs) << "Exiting" << Q_FUNC_INFO << QThread::currentThread(); -} - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/updateboundingvolumejob_p.h b/src/render/backend/jobs/updateboundingvolumejob_p.h deleted file mode 100644 index a26a1906b..000000000 --- a/src/render/backend/jobs/updateboundingvolumejob_p.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_UPDATEBOUNDINGVOLUMEJOB_H -#define QT3DRENDER_RENDER_UPDATEBOUNDINGVOLUMEJOB_H - -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -class Entity; - -class UpdateBoundingVolumeJob : public Qt3D::QAspectJob -{ -public: - explicit UpdateBoundingVolumeJob(Entity *m_node); - -protected: - void run() Q_DECL_OVERRIDE; - -private: - Entity *m_node; -}; - -typedef QSharedPointer UpdateBoundingVolumeJobPtr; - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_UPDATEBOUNDINGVOLUMEJOB_H diff --git a/src/render/backend/jobs/updateworldtransformjob.cpp b/src/render/backend/jobs/updateworldtransformjob.cpp deleted file mode 100644 index 20c58511c..000000000 --- a/src/render/backend/jobs/updateworldtransformjob.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "updateworldtransformjob_p.h" - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -namespace { - -void updateWorldTransformAndBounds(Qt3DRender::Render::Entity *node, const QMatrix4x4 &parentTransform) -{ - QMatrix4x4 worldTransform(parentTransform); - Transform *nodeTransform = node->renderComponent(); - if (nodeTransform != Q_NULLPTR && nodeTransform->isEnabled()) - worldTransform = worldTransform * nodeTransform->transformMatrix(); - - *(node->worldTransform()) = worldTransform; - *(node->worldBoundingVolume()) = node->localBoundingVolume()->transformed(worldTransform); - - Q_FOREACH (Qt3DRender::Render::Entity *child, node->children()) - updateWorldTransformAndBounds(child, worldTransform); -} - -} - -UpdateWorldTransformJob::UpdateWorldTransformJob(Entity *node) - : Qt3D::QAspectJob() - , m_node(node) -{ -} - -void UpdateWorldTransformJob::run() -{ - // Iterate over each level of hierarchy in our scene - // and update each node's world transform from its - // local transform and its parent's world transform - - // TODO: Parallelise this on each level using a parallel_for - // implementation. - - qCDebug(Jobs) << "Entering" << Q_FUNC_INFO << QThread::currentThread(); - - QMatrix4x4 parentTransform; - Entity *parent = m_node->parent(); - if (parent != Q_NULLPTR) - parentTransform = *(parent->worldTransform()); - updateWorldTransformAndBounds(m_node, parentTransform); - - qCDebug(Jobs) << "Exiting" << Q_FUNC_INFO << QThread::currentThread(); -} - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/backend/jobs/updateworldtransformjob_p.h b/src/render/backend/jobs/updateworldtransformjob_p.h deleted file mode 100644 index 81559cf42..000000000 --- a/src/render/backend/jobs/updateworldtransformjob_p.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_UPDATEWORLDTRANSFORMJOB_H -#define QT3DRENDER_RENDER_UPDATEWORLDTRANSFORMJOB_H - -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { -namespace Render { - -class Entity; - -class UpdateWorldTransformJob : public Qt3D::QAspectJob -{ -public: - explicit UpdateWorldTransformJob(Entity *node); - -protected: - void run() Q_DECL_OVERRIDE; - -private: - Entity *m_node; -}; - -typedef QSharedPointer UpdateWorldTransformJobPtr; - -} // namespace Render -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_UPDATEWORLDTRANSFORMJOB_H -- cgit v1.2.3