| 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 | #ifndef QT3DRENDER_QSORTPOLICY_H |
| 5 | #define QT3DRENDER_QSORTPOLICY_H |
| 6 | |
| 7 | #include <Qt3DRender/qframegraphnode.h> |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | namespace Qt3DRender { |
| 12 | |
| 13 | class QSortPolicyPrivate; |
| 14 | |
| 15 | class Q_3DRENDERSHARED_EXPORT QSortPolicy : public QFrameGraphNode |
| 16 | { |
| 17 | Q_OBJECT |
| 18 | Q_PROPERTY(QList<int> sortTypes READ sortTypesInt WRITE setSortTypes NOTIFY sortTypesChanged) |
| 19 | public: |
| 20 | explicit QSortPolicy(Qt3DCore::QNode *parent = nullptr); |
| 21 | ~QSortPolicy(); |
| 22 | |
| 23 | enum SortType { |
| 24 | StateChangeCost = (1 << 0), |
| 25 | BackToFront = (1 << 1), |
| 26 | Material = (1 << 2), |
| 27 | FrontToBack = (1 << 3), |
| 28 | Texture = (1 << 4), |
| 29 | Uniform = (1 << 5) |
| 30 | }; |
| 31 | Q_ENUM(SortType) // LCOV_EXCL_LINE |
| 32 | |
| 33 | QList<SortType> sortTypes() const; |
| 34 | QList<int> sortTypesInt() const; |
| 35 | |
| 36 | public Q_SLOTS: |
| 37 | void setSortTypes(const QList<SortType> &sortTypes); |
| 38 | void setSortTypes(const QList<int> &sortTypesInt); |
| 39 | |
| 40 | Q_SIGNALS: |
| 41 | void sortTypesChanged(const QList<SortType> &sortTypes); |
| 42 | void sortTypesChanged(const QList<int> &sortTypes); |
| 43 | |
| 44 | protected: |
| 45 | explicit QSortPolicy(QSortPolicyPrivate &dd, Qt3DCore::QNode *parent = nullptr); |
| 46 | |
| 47 | private: |
| 48 | Q_DECLARE_PRIVATE(QSortPolicy) |
| 49 | }; |
| 50 | |
| 51 | } // namespace Qt3DRender |
| 52 | |
| 53 | QT_END_NAMESPACE |
| 54 | |
| 55 | #endif // QT3DRENDER_QSORTPOLICY_H |
| 56 | |