1 | // Copyright (C) 2015 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 | #if 0 |
4 | #include "boundingvolumedebug_p.h" |
5 | #include <Qt3DRender/private/qboundingvolumedebug_p.h> |
6 | #include <Qt3DCore/qpropertyupdatedchange.h> |
7 | |
8 | QT_BEGIN_NAMESPACE |
9 | |
10 | namespace Qt3DRender { |
11 | |
12 | namespace Render { |
13 | |
14 | BoundingVolumeDebug::BoundingVolumeDebug() |
15 | : BackendNode(QBackendNode::ReadWrite) |
16 | , m_recursive(false) |
17 | , m_radius(0.0f) |
18 | { |
19 | } |
20 | |
21 | BoundingVolumeDebug::~BoundingVolumeDebug() |
22 | { |
23 | } |
24 | |
25 | void BoundingVolumeDebug::cleanup() |
26 | { |
27 | m_recursive = false; |
28 | m_radius = 0.0f; |
29 | m_center = QVector3D(); |
30 | } |
31 | |
32 | void BoundingVolumeDebug::updateFromPeer(Qt3DCore::QNode *peer) |
33 | { |
34 | QBoundingVolumeDebug *bvD = static_cast<QBoundingVolumeDebug *>(peer); |
35 | if (bvD) { |
36 | m_recursive = bvD->recursive(); |
37 | } |
38 | } |
39 | |
40 | void BoundingVolumeDebug::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) |
41 | { |
42 | const Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e); |
43 | const QByteArray propertyName = propertyChange->propertyName(); |
44 | |
45 | if (propertyChange->type() == Qt3DCore::PropertyUpdated) { |
46 | if (propertyName == QByteArrayLiteral("recursive" )) { |
47 | m_recursive = propertyChange->value().toBool(); |
48 | } |
49 | markDirty(AbstractRenderer::AllDirty); |
50 | } |
51 | } |
52 | |
53 | void BoundingVolumeDebug::setRadius(float radius) |
54 | { |
55 | if (m_radius != radius) { |
56 | m_radius = radius; |
57 | auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerdId()); |
58 | e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); |
59 | e->setPropertyName("radius" ); |
60 | e->setTargetNode(peerId()); |
61 | e->setValue(QVariant(radius)); |
62 | notifyObservers(e); |
63 | } |
64 | } |
65 | |
66 | void BoundingVolumeDebug::setCenter(const QVector3D ¢er) |
67 | { |
68 | if (m_center != center) { |
69 | m_center = center; |
70 | auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerdId()); |
71 | e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); |
72 | e->setPropertyName("center" ); |
73 | e->setTargetNode(peerId()); |
74 | e->setValue(QVariant::fromValue(center)); |
75 | notifyObservers(e); |
76 | } |
77 | } |
78 | |
79 | } // Render |
80 | |
81 | } // Qt3DRender |
82 | |
83 | QT_END_NAMESPACE |
84 | |
85 | #endif |
86 | |