| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef PARSER_H |
| 5 | #define PARSER_H |
| 6 | |
| 7 | #include <QtCore/qglobal.h> |
| 8 | #include <QtCore/qstring.h> |
| 9 | #include <QtCore/qvector.h> |
| 10 | #include <QtCore/qvariant.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class QQuick3DSceneEnvironment; |
| 15 | class QQuick3DAbstractLight; |
| 16 | class QQuick3DMaterial; |
| 17 | class QQuick3DViewport; |
| 18 | class QQuick3DTexture; |
| 19 | class QQuick3DModel; |
| 20 | class QQuick3DEffect; |
| 21 | class QQuick3DShaderUtilsShader; |
| 22 | class QDir; |
| 23 | |
| 24 | namespace MaterialParser { |
| 25 | |
| 26 | struct SceneData |
| 27 | { |
| 28 | QQuick3DViewport *viewport = nullptr; // NOTE!!! we're only handling one viewport atm. |
| 29 | QVector<QQuick3DAbstractLight *> lights; |
| 30 | QVector<QQuick3DMaterial *> materials; |
| 31 | QVector<QQuick3DTexture *> textures; |
| 32 | QVector<QQuick3DModel *> models; |
| 33 | QVector<QQuick3DEffect *> effects; |
| 34 | QVector<QQuick3DShaderUtilsShader *> shaders; |
| 35 | bool hasData() const { return viewport && (models.size() != 0 || materials.size() != 0 || effects.size() != 0); } |
| 36 | }; |
| 37 | |
| 38 | int parseQmlData(const QByteArray &code, const QString &fileName, SceneData &sceneData); |
| 39 | int parseQmlFiles(const QVector<QString> &filePaths, const QDir &sourceDir, SceneData &sceneData, bool verboseOutput); |
| 40 | |
| 41 | } |
| 42 | |
| 43 | QT_END_NAMESPACE |
| 44 | |
| 45 | #endif // PARSER_H |
| 46 |
