1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
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
12QT_BEGIN_NAMESPACE
13
14class QQuick3DSceneEnvironment;
15class QQuick3DAbstractLight;
16class QQuick3DMaterial;
17class QQuick3DViewport;
18class QQuick3DTexture;
19class QQuick3DModel;
20class QQuick3DEffect;
21class QQuick3DShaderUtilsShader;
22class QDir;
23
24namespace MaterialParser {
25
26struct 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
38int parseQmlData(const QByteArray &code, const QString &fileName, SceneData &sceneData);
39int parseQmlFiles(const QVector<QString> &filePaths, const QDir &sourceDir, SceneData &sceneData, bool verboseOutput);
40
41}
42
43QT_END_NAMESPACE
44
45#endif // PARSER_H
46

source code of qtquick3d/tools/shadergen/parser.h