| 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 | #ifndef QT3DRENDER_QPICKINGSETTINGS_H |
| 5 | #define QT3DRENDER_QPICKINGSETTINGS_H |
| 6 | |
| 7 | #include <Qt3DCore/qnode.h> |
| 8 | #include <Qt3DRender/qt3drender_global.h> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | namespace Qt3DRender { |
| 13 | |
| 14 | class QPickingSettingsPrivate; |
| 15 | |
| 16 | // TO DO: Qt 6 -> Make this a QObject |
| 17 | |
| 18 | class Q_3DRENDERSHARED_EXPORT QPickingSettings : public Qt3DCore::QNode |
| 19 | { |
| 20 | Q_OBJECT |
| 21 | Q_PROPERTY(PickMethod pickMethod READ pickMethod WRITE setPickMethod NOTIFY pickMethodChanged) |
| 22 | Q_PROPERTY(PickResultMode pickResultMode READ pickResultMode WRITE setPickResultMode NOTIFY pickResultModeChanged) |
| 23 | Q_PROPERTY(FaceOrientationPickingMode faceOrientationPickingMode READ faceOrientationPickingMode WRITE setFaceOrientationPickingMode NOTIFY faceOrientationPickingModeChanged) |
| 24 | Q_PROPERTY(float worldSpaceTolerance READ worldSpaceTolerance WRITE setWorldSpaceTolerance NOTIFY worldSpaceToleranceChanged REVISION 10) |
| 25 | public: |
| 26 | explicit QPickingSettings(Qt3DCore::QNode *parent = nullptr); |
| 27 | ~QPickingSettings(); |
| 28 | |
| 29 | enum PickMethod { |
| 30 | BoundingVolumePicking = 0x00, |
| 31 | TrianglePicking = 0x01, |
| 32 | LinePicking = 0x02, |
| 33 | PointPicking = 0x04, |
| 34 | PrimitivePicking = TrianglePicking | LinePicking | PointPicking |
| 35 | }; |
| 36 | Q_ENUM(PickMethod) // LCOV_EXCL_LINE |
| 37 | |
| 38 | enum PickResultMode { |
| 39 | NearestPick, |
| 40 | AllPicks, |
| 41 | NearestPriorityPick |
| 42 | }; |
| 43 | Q_ENUM(PickResultMode) // LCOV_EXCL_LINE |
| 44 | |
| 45 | enum FaceOrientationPickingMode { |
| 46 | FrontFace = 0x01, |
| 47 | BackFace = 0x02, |
| 48 | FrontAndBackFace = 0x03 |
| 49 | }; |
| 50 | Q_ENUM(FaceOrientationPickingMode) // LCOV_EXCL_LINE |
| 51 | |
| 52 | PickMethod pickMethod() const; |
| 53 | PickResultMode pickResultMode() const; |
| 54 | FaceOrientationPickingMode faceOrientationPickingMode() const; |
| 55 | float worldSpaceTolerance() const; |
| 56 | |
| 57 | public Q_SLOTS: |
| 58 | void setPickMethod(PickMethod pickMethod); |
| 59 | void setPickResultMode(PickResultMode pickResultMode); |
| 60 | void setFaceOrientationPickingMode(FaceOrientationPickingMode faceOrientationPickingMode); |
| 61 | void setWorldSpaceTolerance(float worldSpaceTolerance); |
| 62 | |
| 63 | Q_SIGNALS: |
| 64 | void pickMethodChanged(QPickingSettings::PickMethod pickMethod); |
| 65 | void pickResultModeChanged(QPickingSettings::PickResultMode pickResult); |
| 66 | void faceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode); |
| 67 | void worldSpaceToleranceChanged(float worldSpaceTolerance); |
| 68 | |
| 69 | protected: |
| 70 | Q_DECLARE_PRIVATE(QPickingSettings) |
| 71 | explicit QPickingSettings(QPickingSettingsPrivate &dd, Qt3DCore::QNode *parent = nullptr); |
| 72 | }; |
| 73 | |
| 74 | } // namespace Qt3Drender |
| 75 | |
| 76 | QT_END_NAMESPACE |
| 77 | |
| 78 | #endif // QT3DRENDER_QPICKINGSETTINGS_H |
| 79 | |