1// Copyright (C) 2019 The Qt Company Ltd.
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 QSGMATERIAL_H
5#define QSGMATERIAL_H
6
7#include <QtQuick/qtquickglobal.h>
8#include <QtQuick/qsgmaterialshader.h>
9#include <QtQuick/qsgmaterialtype.h>
10#include <QtQuick/qsgrendererinterface.h>
11
12QT_BEGIN_NAMESPACE
13
14class Q_QUICK_EXPORT QSGMaterial
15{
16public:
17 enum Flag {
18 Blending = 0x0001,
19 RequiresDeterminant = 0x0002, // Allow precalculated translation and 2D rotation
20 RequiresFullMatrixExceptTranslate = 0x0004 | RequiresDeterminant, // Allow precalculated translation
21 RequiresFullMatrix = 0x0008 | RequiresFullMatrixExceptTranslate,
22 NoBatching = 0x0010,
23
24#if QT_DEPRECATED_SINCE(6, 3)
25 CustomCompileStep Q_DECL_ENUMERATOR_DEPRECATED_X(
26 "Qt 6 does not have custom shader compilation support. If the intention is to just disable batching, use NoBatching instead."
27 ) = NoBatching
28#endif
29
30 };
31 Q_DECLARE_FLAGS(Flags, Flag)
32
33 QSGMaterial();
34 virtual ~QSGMaterial();
35
36 virtual QSGMaterialType *type() const = 0;
37 virtual QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const = 0;
38 virtual int compare(const QSGMaterial *other) const;
39
40 QSGMaterial::Flags flags() const { return m_flags; }
41 void setFlag(Flags flags, bool on = true);
42
43private:
44 Flags m_flags;
45 void *m_reserved;
46 Q_DISABLE_COPY(QSGMaterial)
47};
48
49Q_DECLARE_OPERATORS_FOR_FLAGS(QSGMaterial::Flags)
50
51QT_END_NAMESPACE
52
53#endif
54

source code of qtdeclarative/src/quick/scenegraph/coreapi/qsgmaterial.h