Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dmaterial_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QSSGMATERIAL_H
7#define QSSGMATERIAL_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3D/qquick3dobject.h>
21#include <QtQuick3D/private/qquick3dtexture_p.h>
22
23#include <QtCore/QVector>
24
25QT_BEGIN_NAMESPACE
26
27class QQuick3DSceneManager;
28class Q_QUICK3D_EXPORT QQuick3DMaterial : public QQuick3DObject
29{
30 Q_OBJECT
31 Q_PROPERTY(QQuick3DTexture *lightProbe READ lightProbe WRITE setLightProbe NOTIFY lightProbeChanged)
32 Q_PROPERTY(CullMode cullMode READ cullMode WRITE setCullMode NOTIFY cullModeChanged)
33 Q_PROPERTY(DepthDrawMode depthDrawMode READ depthDrawMode WRITE setDepthDrawMode NOTIFY depthDrawModeChanged)
34
35 QML_NAMED_ELEMENT(Material)
36 QML_UNCREATABLE("Material is Abstract")
37
38public:
39 enum CullMode {
40 BackFaceCulling = 1,
41 FrontFaceCulling = 2,
42 NoCulling = 3
43 };
44 Q_ENUM(CullMode)
45
46 enum TextureChannelMapping {
47 R = 0,
48 G,
49 B,
50 A,
51 };
52 Q_ENUM(TextureChannelMapping)
53
54 enum DepthDrawMode {
55 OpaqueOnlyDepthDraw = 0,
56 AlwaysDepthDraw,
57 NeverDepthDraw,
58 OpaquePrePassDepthDraw,
59 };
60 Q_ENUM(DepthDrawMode)
61
62 enum VertexColorMask {
63 NoMask = 0,
64 RoughnessMask = 1,
65 NormalStrengthMask = 2,
66 SpecularAmountMask = 4,
67 ClearcoatAmountMask = 8,
68 ClearcoatRoughnessAmountMask = 16,
69 ClearcoatNormalStrengthMask = 32,
70 HeightAmountMask = 64,
71 MetalnessMask = 128,
72 OcclusionAmountMask = 256,
73 ThicknessFactorMask = 512,
74 TransmissionFactorMask = 1024
75 };
76 Q_ENUM(VertexColorMask)
77 Q_DECLARE_FLAGS(VertexColorMaskFlags, VertexColorMask)
78 Q_FLAG(VertexColorMaskFlags)
79
80 ~QQuick3DMaterial() override;
81
82 QQuick3DTexture *lightProbe() const;
83
84 CullMode cullMode() const;
85
86 DepthDrawMode depthDrawMode() const;
87
88public Q_SLOTS:
89 void setLightProbe(QQuick3DTexture *lightProbe);
90 void setCullMode(QQuick3DMaterial::CullMode cullMode);
91 void setDepthDrawMode(QQuick3DMaterial::DepthDrawMode depthDrawMode);
92
93Q_SIGNALS:
94 void lightProbeChanged(QQuick3DTexture *lightProbe);
95 void cullModeChanged(QQuick3DMaterial::CullMode cullMode);
96 void depthDrawModeChanged(QQuick3DMaterial::DepthDrawMode depthDrawMode);
97
98protected:
99 explicit QQuick3DMaterial(QQuick3DObjectPrivate &dd, QQuick3DObject *parent = nullptr);
100 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
101 void itemChange(ItemChange, const ItemChangeData &) override;
102
103private:
104 void updateSceneManager(QQuick3DSceneManager *sceneManager);
105 QQuick3DTexture *m_iblProbe = nullptr;
106
107 CullMode m_cullMode = CullMode::BackFaceCulling;
108 DepthDrawMode m_depthDrawMode = DepthDrawMode::OpaqueOnlyDepthDraw;
109};
110
111QT_END_NAMESPACE
112
113#endif // QSSGMATERIAL_H
Combined button and popup list for selecting options.