| 1 | // Copyright (C) 2020 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 | #ifndef QT3DCORE_QBOUNDINGVOLUME_H |
| 5 | #define QT3DCORE_QBOUNDINGVOLUME_H |
| 6 | |
| 7 | #include <QtGui/qvector3d.h> |
| 8 | #include <Qt3DCore/qcomponent.h> |
| 9 | #include <Qt3DCore/qgeometryview.h> |
| 10 | #include <Qt3DCore/qt3dcore_global.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | namespace Qt3DCore { |
| 15 | |
| 16 | class QBoundingVolumePrivate; |
| 17 | |
| 18 | class Q_3DCORESHARED_EXPORT QBoundingVolume : public Qt3DCore::QComponent |
| 19 | { |
| 20 | Q_OBJECT |
| 21 | Q_PROPERTY(QGeometryView* view READ view WRITE setView NOTIFY viewChanged) |
| 22 | Q_PROPERTY(QVector3D implicitMinPoint READ implicitMinPoint NOTIFY implicitMinPointChanged) |
| 23 | Q_PROPERTY(QVector3D implicitMaxPoint READ implicitMaxPoint NOTIFY implicitMaxPointChanged) |
| 24 | Q_PROPERTY(bool implicitPointsValid READ areImplicitPointsValid NOTIFY implicitPointsValidChanged) |
| 25 | Q_PROPERTY(QVector3D minPoint READ minPoint WRITE setMinPoint NOTIFY minPointChanged) |
| 26 | Q_PROPERTY(QVector3D maxPoint READ maxPoint WRITE setMaxPoint NOTIFY maxPointChanged) |
| 27 | public: |
| 28 | explicit QBoundingVolume(Qt3DCore::QNode *parent = nullptr); |
| 29 | ~QBoundingVolume(); |
| 30 | |
| 31 | QGeometryView* view() const; |
| 32 | QVector3D implicitMinPoint() const; |
| 33 | QVector3D implicitMaxPoint() const; |
| 34 | bool areImplicitPointsValid() const; |
| 35 | QVector3D minPoint() const; |
| 36 | QVector3D maxPoint() const; |
| 37 | |
| 38 | public Q_SLOTS: |
| 39 | void setView(QGeometryView *view); |
| 40 | void setMinPoint(const QVector3D &minPoint); |
| 41 | void setMaxPoint(const QVector3D &maxPoint); |
| 42 | |
| 43 | bool updateImplicitBounds(); |
| 44 | |
| 45 | Q_SIGNALS: |
| 46 | void viewChanged(QGeometryView *view); |
| 47 | void implicitMinPointChanged(const QVector3D &implicitMinPoint); |
| 48 | void implicitMaxPointChanged(const QVector3D &implicitMaxPoint); |
| 49 | void implicitPointsValidChanged(bool implicitPointsValid); |
| 50 | void minPointChanged(QVector3D minPoint); |
| 51 | void maxPointChanged(QVector3D maxPoint); |
| 52 | |
| 53 | protected: |
| 54 | QBoundingVolume(QBoundingVolumePrivate &dd, Qt3DCore::QNode *parent = nullptr); |
| 55 | |
| 56 | private: |
| 57 | Q_DECLARE_PRIVATE(QBoundingVolume) |
| 58 | }; |
| 59 | |
| 60 | } // namespace Qt3DCore |
| 61 | |
| 62 | QT_END_NAMESPACE |
| 63 | |
| 64 | #endif // QT3DCORE_QBOUNDINGVOLUME_H |
| 65 | |