| 1 | // Copyright (C) 2019 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_RENDER_ENTITYVISITOR_H |
| 5 | #define QT3DRENDER_RENDER_ENTITYVISITOR_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of other Qt classes. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <private/qglobal_p.h> |
| 19 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | namespace Qt3DRender { |
| 23 | namespace Render { |
| 24 | |
| 25 | class Entity; |
| 26 | class NodeManagers; |
| 27 | |
| 28 | class Q_AUTOTEST_EXPORT EntityVisitor |
| 29 | { |
| 30 | public: |
| 31 | enum Operation { |
| 32 | Continue, //! continue traversal |
| 33 | Prune, //! don't traverse children |
| 34 | Stop //! abort traversal |
| 35 | }; |
| 36 | |
| 37 | EntityVisitor(NodeManagers *manager); |
| 38 | virtual ~EntityVisitor(); |
| 39 | |
| 40 | virtual Operation visit(Entity *entity = nullptr); |
| 41 | |
| 42 | bool pruneDisabled() const; |
| 43 | void setPruneDisabled(bool pruneDisabled); |
| 44 | |
| 45 | bool apply(Entity *root); |
| 46 | |
| 47 | protected: |
| 48 | NodeManagers *m_manager; |
| 49 | |
| 50 | private: |
| 51 | bool m_pruneDisabled; |
| 52 | }; |
| 53 | |
| 54 | } // namespace Render |
| 55 | } // namespace Qt3DRender |
| 56 | |
| 57 | QT_END_NAMESPACE |
| 58 | |
| 59 | #endif // QT3DRENDER_RENDER_ENTITYVISITOR_H |
| 60 | |