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 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | class Q_QUICK_EXPORT QSGMaterial |
15 | { |
16 | public: |
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 | MultiView2 = 0x10000, |
25 | MultiView3 = 0x20000, |
26 | MultiView4 = 0x40000, |
27 | |
28 | #if QT_DEPRECATED_SINCE(6, 3) |
29 | CustomCompileStep Q_DECL_ENUMERATOR_DEPRECATED_X( |
30 | "Qt 6 does not have custom shader compilation support. If the intention is to just disable batching, use NoBatching instead." |
31 | ) = NoBatching |
32 | #endif |
33 | |
34 | }; |
35 | Q_DECLARE_FLAGS(Flags, Flag) |
36 | |
37 | QSGMaterial(); |
38 | virtual ~QSGMaterial(); |
39 | |
40 | virtual QSGMaterialType *type() const = 0; |
41 | virtual QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const = 0; |
42 | virtual int compare(const QSGMaterial *other) const; |
43 | |
44 | QSGMaterial::Flags flags() const { return m_flags; } |
45 | void setFlag(Flags flags, bool on = true); |
46 | |
47 | int viewCount() const; |
48 | |
49 | private: |
50 | Flags m_flags; |
51 | void *m_reserved; |
52 | Q_DISABLE_COPY(QSGMaterial) |
53 | }; |
54 | |
55 | Q_DECLARE_OPERATORS_FOR_FLAGS(QSGMaterial::Flags) |
56 | |
57 | QT_END_NAMESPACE |
58 | |
59 | #endif |
60 |