1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #include "framecleanupjob_p.h" |
5 | #include <private/nodemanagers_p.h> |
6 | #include <private/entity_p.h> |
7 | #include <private/shaderdata_p.h> |
8 | #include <private/managers_p.h> |
9 | #include <private/sphere_p.h> |
10 | #include <Qt3DRender/private/job_common_p.h> |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | namespace Qt3DRender { |
15 | namespace Render { |
16 | |
17 | FrameCleanupJob::FrameCleanupJob() |
18 | : m_managers(nullptr) |
19 | , m_root(nullptr) |
20 | { |
21 | SET_JOB_RUN_STAT_TYPE(this, JobTypes::FrameCleanup, 0) |
22 | } |
23 | |
24 | FrameCleanupJob::~FrameCleanupJob() |
25 | { |
26 | } |
27 | |
28 | void FrameCleanupJob::setRoot(Entity *root) |
29 | { |
30 | m_root = root; |
31 | } |
32 | |
33 | void FrameCleanupJob::run() |
34 | { |
35 | // Debug bounding volume debug |
36 | updateBoundingVolumesDebug(node: m_root); |
37 | } |
38 | |
39 | void FrameCleanupJob::updateBoundingVolumesDebug(Entity *node) |
40 | { |
41 | Q_UNUSED(node); |
42 | #if 0 |
43 | node->traverse([](Entity *node) { |
44 | BoundingVolumeDebug *debugBV = node->renderComponent<BoundingVolumeDebug>(); |
45 | if (debugBV) { |
46 | Qt3DRender::Render::Sphere s; |
47 | if (!debugBV->isRecursive()) { |
48 | s = *node->worldBoundingVolume(); |
49 | } else { |
50 | s = *node->worldBoundingVolumeWithChildren(); |
51 | } |
52 | debugBV->setRadius(s.radius()); |
53 | debugBV->setCenter(s.center()); |
54 | } |
55 | }); |
56 | |
57 | #endif |
58 | } |
59 | |
60 | void FrameCleanupJob::setManagers(NodeManagers *managers) |
61 | { |
62 | m_managers = managers; |
63 | } |
64 | |
65 | } // namespace Render |
66 | } // namespace Qt3DRender |
67 | |
68 | QT_END_NAMESPACE |
69 | |