1// Copyright (C) 2016 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 "updateworldboundingvolumejob_p.h"
5#include <Qt3DRender/private/job_common_p.h>
6#include <Qt3DRender/private/managers_p.h>
7#include <Qt3DRender/private/entity_p.h>
8#include <Qt3DRender/private/sphere_p.h>
9
10QT_BEGIN_NAMESPACE
11
12namespace Qt3DRender {
13namespace Render {
14
15UpdateWorldBoundingVolumeJob::UpdateWorldBoundingVolumeJob()
16 : Qt3DCore::QAspectJob()
17 , m_manager(nullptr)
18{
19 SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateWorldBoundingVolume, 0)
20}
21
22void UpdateWorldBoundingVolumeJob::run()
23{
24 const std::vector<HEntity> &handles = m_manager->activeHandles();
25
26 for (const HEntity &handle : handles) {
27 Entity *node = m_manager->data(handle);
28 if (!node->isEnabled())
29 continue;
30 *(node->worldBoundingVolume()) = node->localBoundingVolume()->transformed(mat: *(node->worldTransform()));
31 *(node->worldBoundingVolumeWithChildren()) = *(node->worldBoundingVolume()); // expanded in UpdateBoundingVolumeJob
32 }
33}
34
35} // namespace Render
36} // namespace Qt3DRender
37
38QT_END_NAMESPACE
39

source code of qt3d/src/render/jobs/updateworldboundingvolumejob.cpp