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 "cameraselectornode_p.h" |
5 | #include <Qt3DRender/private/qcameraselector_p.h> |
6 | #include <Qt3DRender/private/abstractrenderer_p.h> |
7 | #include <Qt3DCore/private/qchangearbiter_p.h> |
8 | #include <Qt3DCore/qentity.h> |
9 | #include <Qt3DRender/private/renderlogging_p.h> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | using namespace Qt3DCore; |
14 | |
15 | namespace Qt3DRender { |
16 | namespace Render { |
17 | |
18 | CameraSelector::CameraSelector() |
19 | : FrameGraphNode(FrameGraphNode::CameraSelector) |
20 | { |
21 | } |
22 | |
23 | void CameraSelector::syncFromFrontEnd(const QNode *frontEnd, bool firstTime) |
24 | { |
25 | const QCameraSelector *node = qobject_cast<const QCameraSelector *>(object: frontEnd); |
26 | if (!node) |
27 | return; |
28 | |
29 | FrameGraphNode::syncFromFrontEnd(frontEnd, firstTime); |
30 | |
31 | const QNodeId cameraId = qIdForNode(node: node->camera()); |
32 | if (m_cameraUuid != cameraId) { |
33 | m_cameraUuid = cameraId; |
34 | markDirty(changes: AbstractRenderer::FrameGraphDirty); |
35 | } |
36 | } |
37 | |
38 | QNodeId CameraSelector::cameraUuid() const |
39 | { |
40 | return m_cameraUuid; |
41 | } |
42 | |
43 | } // namespace Render |
44 | } // namespace Qt3DRender |
45 | |
46 | QT_END_NAMESPACE |
47 |