| 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_QSCENELOADER_H |
| 5 | #define QT3DRENDER_QSCENELOADER_H |
| 6 | |
| 7 | #include <Qt3DCore/qcomponent.h> |
| 8 | #include <Qt3DRender/qt3drender_global.h> |
| 9 | #include <QtCore/QUrl> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | namespace Qt3DRender { |
| 14 | |
| 15 | class QSceneLoaderPrivate; |
| 16 | |
| 17 | class Q_3DRENDERSHARED_EXPORT QSceneLoader : public Qt3DCore::QComponent |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) |
| 21 | Q_PROPERTY(Status status READ status NOTIFY statusChanged) |
| 22 | public: |
| 23 | explicit QSceneLoader(Qt3DCore::QNode *parent = nullptr); |
| 24 | ~QSceneLoader(); |
| 25 | |
| 26 | enum Status { |
| 27 | None = 0, |
| 28 | Loading, |
| 29 | Ready, |
| 30 | Error |
| 31 | }; |
| 32 | Q_ENUM(Status) // LCOV_EXCL_LINE |
| 33 | |
| 34 | enum ComponentType { |
| 35 | UnknownComponent = 0, |
| 36 | GeometryRendererComponent, |
| 37 | TransformComponent, |
| 38 | MaterialComponent, |
| 39 | LightComponent, |
| 40 | CameraLensComponent |
| 41 | }; |
| 42 | Q_ENUM(ComponentType) |
| 43 | |
| 44 | QUrl source() const; |
| 45 | Status status() const; |
| 46 | |
| 47 | Q_REVISION(2, 9) Q_INVOKABLE Qt3DCore::QEntity *entity(const QString &entityName) const; |
| 48 | Q_REVISION(2, 9) Q_INVOKABLE QStringList entityNames() const; |
| 49 | Q_REVISION(2, 9) Q_INVOKABLE Qt3DCore::QComponent *component(const QString &entityName, |
| 50 | ComponentType componentType) const; |
| 51 | |
| 52 | public Q_SLOTS: |
| 53 | void setSource(const QUrl &arg); |
| 54 | |
| 55 | Q_SIGNALS: |
| 56 | void sourceChanged(const QUrl &source); |
| 57 | void statusChanged(Status status); |
| 58 | |
| 59 | protected: |
| 60 | explicit QSceneLoader(QSceneLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr); |
| 61 | |
| 62 | private: |
| 63 | Q_DECLARE_PRIVATE(QSceneLoader) |
| 64 | }; |
| 65 | |
| 66 | } // namespace Qt3DRender |
| 67 | |
| 68 | QT_END_NAMESPACE |
| 69 | |
| 70 | #endif // QT3DRENDER_QSCENELOADER_H |
| 71 | |