1 | // Copyright (C) 2017 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 "proximityfilter_p.h" |
5 | #include <Qt3DRender/private/qproximityfilter_p.h> |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | namespace Qt3DRender { |
10 | |
11 | namespace Render { |
12 | |
13 | ProximityFilter::ProximityFilter() |
14 | : FrameGraphNode(FrameGraphNode::ProximityFilter) |
15 | , m_distanceThreshold(0.0f) |
16 | { |
17 | } |
18 | |
19 | void ProximityFilter::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) |
20 | { |
21 | const QProximityFilter *node = qobject_cast<const QProximityFilter *>(object: frontEnd); |
22 | if (!node) |
23 | return; |
24 | |
25 | FrameGraphNode::syncFromFrontEnd(frontEnd, firstTime); |
26 | |
27 | const auto entityId = Qt3DCore::qIdForNode(node: node->entity()); |
28 | if (entityId != m_entityId) { |
29 | m_entityId = entityId; |
30 | markDirty(changes: AbstractRenderer::FrameGraphDirty); |
31 | } |
32 | |
33 | if (node->distanceThreshold() != m_distanceThreshold) { |
34 | m_distanceThreshold = node->distanceThreshold(); |
35 | markDirty(changes: AbstractRenderer::FrameGraphDirty); |
36 | } |
37 | } |
38 | |
39 | } // namespace Render |
40 | } // namespace Qt3DRender |
41 | |
42 | QT_END_NAMESPACE |
43 |