1 | // Copyright (C) 2019 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QSSGPRINCIPLEDMATERIAL_H |
5 | #define QSSGPRINCIPLEDMATERIAL_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtQuick3D/private/qquick3dmaterial_p.h> |
19 | #include <QtQuick3D/private/qquick3dtexture_p.h> |
20 | |
21 | #include <QColor> |
22 | #include <QHash> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class Q_QUICK3D_EXPORT QQuick3DPrincipledMaterial : public QQuick3DMaterial |
27 | { |
28 | Q_OBJECT |
29 | Q_PROPERTY(Lighting lighting READ lighting WRITE setLighting NOTIFY lightingChanged) |
30 | Q_PROPERTY(BlendMode blendMode READ blendMode WRITE setBlendMode NOTIFY blendModeChanged) |
31 | |
32 | Q_PROPERTY(QColor baseColor READ baseColor WRITE setBaseColor NOTIFY baseColorChanged) |
33 | Q_PROPERTY(QQuick3DTexture *baseColorMap READ baseColorMap WRITE setBaseColorMap NOTIFY baseColorMapChanged) |
34 | |
35 | Q_PROPERTY(float metalness READ metalness WRITE setMetalness NOTIFY metalnessChanged) |
36 | Q_PROPERTY(QQuick3DTexture *metalnessMap READ metalnessMap WRITE setMetalnessMap NOTIFY metalnessMapChanged) |
37 | Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping metalnessChannel READ metalnessChannel WRITE setMetalnessChannel NOTIFY metalnessChannelChanged) |
38 | |
39 | Q_PROPERTY(float specularAmount READ specularAmount WRITE setSpecularAmount NOTIFY specularAmountChanged) |
40 | Q_PROPERTY(QQuick3DTexture *specularMap READ specularMap WRITE setSpecularMap NOTIFY specularMapChanged) |
41 | Q_PROPERTY(float specularTint READ specularTint WRITE setSpecularTint NOTIFY specularTintChanged) |
42 | |
43 | Q_PROPERTY(float roughness READ roughness WRITE setRoughness NOTIFY roughnessChanged) |
44 | Q_PROPERTY(QQuick3DTexture *roughnessMap READ roughnessMap WRITE setRoughnessMap NOTIFY roughnessMapChanged) |
45 | Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping roughnessChannel READ roughnessChannel WRITE setRoughnessChannel NOTIFY roughnessChannelChanged) |
46 | |
47 | Q_PROPERTY(QVector3D emissiveFactor READ emissiveFactor WRITE setEmissiveFactor NOTIFY emissiveFactorChanged) |
48 | Q_PROPERTY(QQuick3DTexture *emissiveMap READ emissiveMap WRITE setEmissiveMap NOTIFY emissiveMapChanged) |
49 | |
50 | Q_PROPERTY(float opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) |
51 | Q_PROPERTY(QQuick3DTexture *opacityMap READ opacityMap WRITE setOpacityMap NOTIFY opacityMapChanged) |
52 | Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping opacityChannel READ opacityChannel WRITE setOpacityChannel NOTIFY opacityChannelChanged) |
53 | |
54 | Q_PROPERTY(QQuick3DTexture *normalMap READ normalMap WRITE setNormalMap NOTIFY normalMapChanged) |
55 | Q_PROPERTY(float normalStrength READ normalStrength WRITE setNormalStrength NOTIFY normalStrengthChanged) |
56 | |
57 | Q_PROPERTY(QQuick3DTexture *specularReflectionMap READ specularReflectionMap WRITE setSpecularReflectionMap NOTIFY specularReflectionMapChanged) |
58 | |
59 | Q_PROPERTY(QQuick3DTexture *occlusionMap READ occlusionMap WRITE setOcclusionMap NOTIFY occlusionMapChanged) |
60 | Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping occlusionChannel READ occlusionChannel WRITE setOcclusionChannel NOTIFY occlusionChannelChanged) |
61 | Q_PROPERTY(float occlusionAmount READ occlusionAmount WRITE setOcclusionAmount NOTIFY occlusionAmountChanged) |
62 | |
63 | Q_PROPERTY(AlphaMode alphaMode READ alphaMode WRITE setAlphaMode NOTIFY alphaModeChanged) |
64 | Q_PROPERTY(float alphaCutoff READ alphaCutoff WRITE setAlphaCutoff NOTIFY alphaCutoffChanged) |
65 | |
66 | Q_PROPERTY(float pointSize READ pointSize WRITE setPointSize NOTIFY pointSizeChanged) |
67 | Q_PROPERTY(float lineWidth READ lineWidth WRITE setLineWidth NOTIFY lineWidthChanged) |
68 | |
69 | Q_PROPERTY(QQuick3DTexture *heightMap READ heightMap WRITE setHeightMap NOTIFY heightMapChanged REVISION(6, 2)) |
70 | Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping heightChannel READ heightChannel WRITE setHeightChannel NOTIFY heightChannelChanged REVISION(6, 2)) |
71 | Q_PROPERTY(float heightAmount READ heightAmount WRITE setHeightAmount NOTIFY heightAmountChanged REVISION(6, 2)) |
72 | Q_PROPERTY(int minHeightMapSamples READ minHeightMapSamples WRITE setMinHeightMapSamples NOTIFY minHeightMapSamplesChanged REVISION(6, 2)) |
73 | Q_PROPERTY(int maxHeightMapSamples READ maxHeightMapSamples WRITE setMaxHeightMapSamples NOTIFY maxHeightMapSamplesChanged REVISION(6, 2)) |
74 | |
75 | Q_PROPERTY(float clearcoatAmount READ clearcoatAmount WRITE setClearcoatAmount NOTIFY clearcoatAmountChanged REVISION(6, 3)) |
76 | Q_PROPERTY(QQuick3DTexture *clearcoatMap READ clearcoatMap WRITE setClearcoatMap NOTIFY clearcoatMapChanged REVISION(6, 3)) |
77 | Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping clearcoatChannel READ clearcoatChannel WRITE setClearcoatChannel NOTIFY |
78 | clearcoatChannelChanged REVISION(6, 3)) |
79 | Q_PROPERTY(float clearcoatRoughnessAmount READ clearcoatRoughnessAmount WRITE setClearcoatRoughnessAmount NOTIFY |
80 | clearcoatRoughnessAmountChanged REVISION(6, 3)) |
81 | Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping clearcoatRoughnessChannel READ clearcoatRoughnessChannel WRITE |
82 | setClearcoatRoughnessChannel NOTIFY clearcoatRoughnessChannelChanged REVISION(6, 3)) |
83 | Q_PROPERTY(QQuick3DTexture *clearcoatRoughnessMap READ clearcoatRoughnessMap WRITE setClearcoatRoughnessMap NOTIFY |
84 | clearcoatRoughnessMapChanged REVISION(6, 3)) |
85 | Q_PROPERTY(QQuick3DTexture *clearcoatNormalMap READ clearcoatNormalMap WRITE setClearcoatNormalMap NOTIFY |
86 | clearcoatNormalMapChanged REVISION(6, 3)) |
87 | |
88 | Q_PROPERTY(float transmissionFactor READ transmissionFactor WRITE setTransmissionFactor NOTIFY transmissionFactorChanged) |
89 | Q_PROPERTY(QQuick3DTexture * transmissionMap READ transmissionMap WRITE setTransmissionMap NOTIFY transmissionMapChanged) |
90 | Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping transmissionChannel READ transmissionChannel WRITE setTransmissionChannel NOTIFY transmissionChannelChanged) |
91 | |
92 | Q_PROPERTY(float thicknessFactor READ thicknessFactor WRITE setThicknessFactor NOTIFY thicknessFactorChanged REVISION(6, 3)) |
93 | Q_PROPERTY(QQuick3DTexture *thicknessMap READ thicknessMap WRITE setThicknessMap NOTIFY thicknessMapChanged REVISION(6, 3)) |
94 | Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping thicknessChannel READ thicknessChannel WRITE setThicknessChannel NOTIFY |
95 | thicknessChannelChanged REVISION(6, 3)) |
96 | Q_PROPERTY(float attenuationDistance READ attenuationDistance WRITE setAttenuationDistance NOTIFY attenuationDistanceChanged REVISION(6, 3)) |
97 | Q_PROPERTY(QColor attenuationColor READ attenuationColor WRITE setAttenuationColor NOTIFY attenuationColorChanged REVISION(6, 3)) |
98 | |
99 | Q_PROPERTY(float indexOfRefraction READ indexOfRefraction WRITE setIndexOfRefraction NOTIFY indexOfRefractionChanged REVISION(6, 3)) |
100 | |
101 | Q_PROPERTY(bool vertexColorsEnabled READ vertexColorsEnabled WRITE setVertexColorsEnabled NOTIFY vertexColorsEnabledChanged REVISION(6, 5)) |
102 | |
103 | QML_NAMED_ELEMENT(PrincipledMaterial) |
104 | |
105 | public: |
106 | enum Lighting { |
107 | NoLighting = 0, |
108 | FragmentLighting |
109 | }; |
110 | Q_ENUM(Lighting) |
111 | |
112 | enum BlendMode { |
113 | SourceOver = 0, |
114 | Screen, |
115 | Multiply |
116 | }; |
117 | Q_ENUM(BlendMode) |
118 | |
119 | enum AlphaMode { |
120 | Default = 0, |
121 | Mask, |
122 | Blend, |
123 | Opaque |
124 | }; |
125 | Q_ENUM(AlphaMode) |
126 | |
127 | explicit QQuick3DPrincipledMaterial(QQuick3DObject *parent = nullptr); |
128 | ~QQuick3DPrincipledMaterial() override; |
129 | |
130 | Lighting lighting() const; |
131 | BlendMode blendMode() const; |
132 | QColor baseColor() const; |
133 | QQuick3DTexture *baseColorMap() const; |
134 | QQuick3DTexture *emissiveMap() const; |
135 | QVector3D emissiveFactor() const; |
136 | QQuick3DTexture *specularReflectionMap() const; |
137 | QQuick3DTexture *specularMap() const; |
138 | float specularTint() const; |
139 | float specularAmount() const; |
140 | float roughness() const; |
141 | QQuick3DTexture *roughnessMap() const; |
142 | float opacity() const; |
143 | QQuick3DTexture *opacityMap() const; |
144 | QQuick3DTexture *normalMap() const; |
145 | float metalness() const; |
146 | QQuick3DTexture *metalnessMap() const; |
147 | float normalStrength() const; |
148 | QQuick3DTexture *occlusionMap() const; |
149 | float occlusionAmount() const; |
150 | AlphaMode alphaMode() const; |
151 | float alphaCutoff() const; |
152 | TextureChannelMapping metalnessChannel() const; |
153 | TextureChannelMapping roughnessChannel() const; |
154 | TextureChannelMapping opacityChannel() const; |
155 | TextureChannelMapping occlusionChannel() const; |
156 | float pointSize() const; |
157 | float lineWidth() const; |
158 | Q_REVISION(6, 2) QQuick3DTexture *heightMap() const; |
159 | Q_REVISION(6, 2) TextureChannelMapping heightChannel() const; |
160 | Q_REVISION(6, 2) float heightAmount() const; |
161 | Q_REVISION(6, 2) int minHeightMapSamples() const; |
162 | Q_REVISION(6, 2) int maxHeightMapSamples() const; |
163 | |
164 | Q_REVISION(6, 3) float clearcoatAmount() const; |
165 | Q_REVISION(6, 3) QQuick3DTexture *clearcoatMap() const; |
166 | Q_REVISION(6, 3) TextureChannelMapping clearcoatChannel() const; |
167 | Q_REVISION(6, 3) float clearcoatRoughnessAmount() const; |
168 | Q_REVISION(6, 3) TextureChannelMapping clearcoatRoughnessChannel() const; |
169 | Q_REVISION(6, 3) QQuick3DTexture *clearcoatRoughnessMap() const; |
170 | Q_REVISION(6, 3) QQuick3DTexture *clearcoatNormalMap() const; |
171 | |
172 | Q_REVISION(6, 3) float transmissionFactor() const; |
173 | Q_REVISION(6, 3) QQuick3DTexture *transmissionMap() const; |
174 | Q_REVISION(6, 3) TextureChannelMapping transmissionChannel() const; |
175 | |
176 | Q_REVISION(6, 3) float thicknessFactor() const; |
177 | Q_REVISION(6, 3) QQuick3DTexture *thicknessMap() const; |
178 | Q_REVISION(6, 3) const TextureChannelMapping &thicknessChannel() const; |
179 | Q_REVISION(6, 3) float attenuationDistance() const; |
180 | Q_REVISION(6, 3) const QColor &attenuationColor() const; |
181 | |
182 | Q_REVISION(6, 3) float indexOfRefraction() const; |
183 | |
184 | Q_REVISION(6, 5) bool vertexColorsEnabled() const; |
185 | |
186 | public Q_SLOTS: |
187 | void setLighting(QQuick3DPrincipledMaterial::Lighting lighting); |
188 | void setBlendMode(QQuick3DPrincipledMaterial::BlendMode blendMode); |
189 | void setBaseColor(QColor baseColor); |
190 | void setBaseColorMap(QQuick3DTexture *baseColorMap); |
191 | void setEmissiveMap(QQuick3DTexture *emissiveMap); |
192 | void setEmissiveFactor(QVector3D emissiveFactor); |
193 | void setSpecularReflectionMap(QQuick3DTexture *specularReflectionMap); |
194 | void setSpecularMap(QQuick3DTexture *specularMap); |
195 | void setSpecularTint(float specularTint); |
196 | void setSpecularAmount(float specularAmount); |
197 | void setRoughness(float roughness); |
198 | void setRoughnessMap(QQuick3DTexture *roughnessMap); |
199 | void setOpacity(float opacity); |
200 | void setOpacityMap(QQuick3DTexture *opacityMap); |
201 | void setNormalMap(QQuick3DTexture *normalMap); |
202 | void setMetalness(float metalnessAmount); |
203 | void setMetalnessMap(QQuick3DTexture * metalnessMap); |
204 | void setNormalStrength(float normalStrength); |
205 | void setOcclusionMap(QQuick3DTexture *occlusionMap); |
206 | void setOcclusionAmount(float occlusionAmount); |
207 | void setAlphaMode(QQuick3DPrincipledMaterial::AlphaMode alphaMode); |
208 | void setAlphaCutoff(float alphaCutoff); |
209 | void setMetalnessChannel(QQuick3DMaterial::TextureChannelMapping channel); |
210 | void setRoughnessChannel(QQuick3DMaterial::TextureChannelMapping channel); |
211 | void setOpacityChannel(QQuick3DMaterial::TextureChannelMapping channel); |
212 | void setOcclusionChannel(QQuick3DMaterial::TextureChannelMapping channel); |
213 | void setPointSize(float size); |
214 | void setLineWidth(float width); |
215 | Q_REVISION(6, 2) void setHeightMap(QQuick3DTexture *heightMap); |
216 | Q_REVISION(6, 2) void setHeightChannel(QQuick3DMaterial::TextureChannelMapping channel); |
217 | Q_REVISION(6, 2) void setHeightAmount(float heightAmount); |
218 | Q_REVISION(6, 2) void setMinHeightMapSamples(int samples); |
219 | Q_REVISION(6, 2) void setMaxHeightMapSamples(int samples); |
220 | |
221 | Q_REVISION(6, 3) void setClearcoatAmount(float newClearcoatAmount); |
222 | Q_REVISION(6, 3) void setClearcoatMap(QQuick3DTexture *newClearcoatMap); |
223 | Q_REVISION(6, 3) void setClearcoatChannel(QQuick3DMaterial::TextureChannelMapping newClearcoatChannel); |
224 | Q_REVISION(6, 3) void setClearcoatRoughnessAmount(float newClearcoatRoughnessAmount); |
225 | Q_REVISION(6, 3) void setClearcoatRoughnessChannel(QQuick3DMaterial::TextureChannelMapping newClearcoatRoughnessChannel); |
226 | Q_REVISION(6, 3) void setClearcoatRoughnessMap(QQuick3DTexture *newClearcoatRoughnessMap); |
227 | Q_REVISION(6, 3) void setClearcoatNormalMap(QQuick3DTexture *newClearcoatNormalMap); |
228 | |
229 | Q_REVISION(6, 3) void setTransmissionFactor(float newTransmissionFactor); |
230 | Q_REVISION(6, 3) void setTransmissionMap(QQuick3DTexture *newTransmissionMap); |
231 | Q_REVISION(6, 3) void setTransmissionChannel(QQuick3DMaterial::TextureChannelMapping newTransmissionChannel); |
232 | |
233 | Q_REVISION(6, 3) void setThicknessFactor(float newThicknessFactor); |
234 | Q_REVISION(6, 3) void setThicknessMap(QQuick3DTexture *newThicknessMap); |
235 | Q_REVISION(6, 3) void setThicknessChannel(const QQuick3DMaterial::TextureChannelMapping &newThicknessChannel); |
236 | Q_REVISION(6, 3) void setAttenuationDistance(float newAttenuationDistance); |
237 | Q_REVISION(6, 3) void setAttenuationColor(const QColor &newAttenuationColor); |
238 | |
239 | Q_REVISION(6, 3) void setIndexOfRefraction(float indexOfRefraction); |
240 | |
241 | Q_REVISION(6, 5) void setVertexColorsEnabled(bool vertexColorsEnabled); |
242 | |
243 | Q_SIGNALS: |
244 | void lightingChanged(QQuick3DPrincipledMaterial::Lighting lighting); |
245 | void blendModeChanged(QQuick3DPrincipledMaterial::BlendMode blendMode); |
246 | void baseColorChanged(QColor baseColor); |
247 | void baseColorMapChanged(QQuick3DTexture *baseColorMap); |
248 | void emissiveMapChanged(QQuick3DTexture *emissiveMap); |
249 | void emissiveFactorChanged(QVector3D emissiveFactor); |
250 | void specularReflectionMapChanged(QQuick3DTexture *specularReflectionMap); |
251 | void specularMapChanged(QQuick3DTexture *specularMap); |
252 | void specularTintChanged(float specularTint); |
253 | void specularAmountChanged(float specularAmount); |
254 | void roughnessChanged(float roughness); |
255 | void roughnessMapChanged(QQuick3DTexture *roughnessMap); |
256 | void opacityChanged(float opacity); |
257 | void opacityMapChanged(QQuick3DTexture *opacityMap); |
258 | void normalMapChanged(QQuick3DTexture *normalMap); |
259 | void metalnessChanged(float metalness); |
260 | void metalnessMapChanged(QQuick3DTexture * metalnessMap); |
261 | void normalStrengthChanged(float normalStrength); |
262 | void occlusionMapChanged(QQuick3DTexture *occlusionMap); |
263 | void occlusionAmountChanged(float occlusionAmount); |
264 | void alphaModeChanged(QQuick3DPrincipledMaterial::AlphaMode alphaMode); |
265 | void alphaCutoffChanged(float alphaCutoff); |
266 | void metalnessChannelChanged(QQuick3DMaterial::TextureChannelMapping channel); |
267 | void roughnessChannelChanged(QQuick3DMaterial::TextureChannelMapping channel); |
268 | void opacityChannelChanged(QQuick3DMaterial::TextureChannelMapping channel); |
269 | void occlusionChannelChanged(QQuick3DMaterial::TextureChannelMapping channel); |
270 | void pointSizeChanged(); |
271 | void lineWidthChanged(); |
272 | Q_REVISION(6, 2) void heightMapChanged(QQuick3DTexture *heightMap); |
273 | Q_REVISION(6, 2) void heightChannelChanged(QQuick3DMaterial::TextureChannelMapping channel); |
274 | Q_REVISION(6, 2) void heightAmountChanged(float heightAmount); |
275 | Q_REVISION(6, 2) void minHeightMapSamplesChanged(int samples); |
276 | Q_REVISION(6, 2) void maxHeightMapSamplesChanged(int samples); |
277 | |
278 | Q_REVISION(6, 3) void clearcoatAmountChanged(float amount); |
279 | Q_REVISION(6, 3) void clearcoatMapChanged(QQuick3DTexture *texture); |
280 | Q_REVISION(6, 3) void clearcoatChannelChanged(QQuick3DMaterial::TextureChannelMapping channel); |
281 | Q_REVISION(6, 3) void clearcoatRoughnessAmountChanged(float amount); |
282 | Q_REVISION(6, 3) void clearcoatRoughnessChannelChanged(QQuick3DMaterial::TextureChannelMapping channel); |
283 | Q_REVISION(6, 3) void clearcoatRoughnessMapChanged(QQuick3DTexture *texture); |
284 | Q_REVISION(6, 3) void clearcoatNormalMapChanged(QQuick3DTexture *texture); |
285 | |
286 | Q_REVISION(6, 3) void transmissionFactorChanged(float amount); |
287 | Q_REVISION(6, 3) void transmissionMapChanged(QQuick3DTexture *texture); |
288 | Q_REVISION(6, 3) void transmissionChannelChanged(QQuick3DMaterial::TextureChannelMapping channel); |
289 | |
290 | Q_REVISION(6, 3) void thicknessFactorChanged(float amount); |
291 | Q_REVISION(6, 3) void thicknessMapChanged(QQuick3DTexture *texture); |
292 | Q_REVISION(6, 3) void thicknessChannelChanged(QQuick3DMaterial::TextureChannelMapping channel); |
293 | Q_REVISION(6, 3) void attenuationDistanceChanged(float distance); |
294 | Q_REVISION(6, 3) void attenuationColorChanged(QColor color); |
295 | |
296 | Q_REVISION(6, 3) void indexOfRefractionChanged(float indexOfRefraction); |
297 | |
298 | Q_REVISION(6, 5) void vertexColorsEnabledChanged(bool vertexColorsEnabled); |
299 | |
300 | protected: |
301 | QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override; |
302 | void markAllDirty() override; |
303 | void itemChange(ItemChange, const ItemChangeData &) override; |
304 | private: |
305 | enum DirtyType { |
306 | LightingModeDirty = 0x00000001, |
307 | BlendModeDirty = 0x00000002, |
308 | BaseColorDirty = 0x00000004, |
309 | EmissiveDirty = 0x00000008, |
310 | SpecularDirty = 0x00000010, |
311 | OpacityDirty = 0x00000020, |
312 | NormalDirty = 0x00000040, |
313 | MetalnessDirty = 0x00000080, |
314 | RoughnessDirty = 0x00000100, |
315 | OcclusionDirty = 0x00000200, |
316 | AlphaModeDirty = 0x00000400, |
317 | PointSizeDirty = 0x00000800, |
318 | LineWidthDirty = 0x00001000, |
319 | HeightDirty = 0x00002000, |
320 | ClearcoatDirty = 0x00004000, |
321 | TransmissionDirty = 0x00008000, |
322 | VolumeDirty = 0x00010000, |
323 | VertexColorsDirty = 0x00020000 |
324 | }; |
325 | |
326 | void updateSceneManager(QQuick3DSceneManager *window); |
327 | |
328 | // Note: The default values for properties that are also present in |
329 | // QSSGShaderCustomMaterialAdapter must match the values there, because a |
330 | // PrincipledMaterial { } and CustomMaterial { } must be identical. Same |
331 | // goes for the custom shader defaults in generateFragmentShader(), keep |
332 | // them in sync. |
333 | |
334 | Lighting m_lighting = FragmentLighting; |
335 | BlendMode m_blendMode = SourceOver; |
336 | AlphaMode m_alphaMode = Default; |
337 | QColor m_baseColor = Qt::white; |
338 | QQuick3DTexture *m_baseColorMap = nullptr; |
339 | QVector3D m_emissiveFactor; |
340 | QQuick3DTexture *m_emissiveMap = nullptr; |
341 | |
342 | QQuick3DTexture *m_specularReflectionMap = nullptr; |
343 | QQuick3DTexture *m_specularMap = nullptr; |
344 | QQuick3DTexture *m_roughnessMap = nullptr; |
345 | QQuick3DTexture *m_opacityMap = nullptr; |
346 | QQuick3DTexture *m_normalMap = nullptr; |
347 | QQuick3DTexture *m_metalnessMap = nullptr; |
348 | QQuick3DTexture *m_occlusionMap = nullptr; |
349 | float m_specularTint = 0.0f; |
350 | float m_specularAmount = 1.0f; |
351 | float m_roughness = 0.0f; |
352 | float m_opacity = 1.0f; |
353 | float m_metalnessAmount = 0.0f; |
354 | float m_normalStrength = 1.0f; |
355 | float m_occlusionAmount = 1.0f; |
356 | float m_alphaCutoff = 0.5f; |
357 | TextureChannelMapping m_metalnessChannel = QQuick3DMaterial::B; |
358 | TextureChannelMapping m_roughnessChannel = QQuick3DMaterial::G; |
359 | TextureChannelMapping m_opacityChannel = QQuick3DMaterial::A; |
360 | TextureChannelMapping m_occlusionChannel = QQuick3DMaterial::R; |
361 | float m_pointSize = 1.0f; |
362 | float m_lineWidth = 1.0f; |
363 | QQuick3DTexture *m_heightMap = nullptr; |
364 | TextureChannelMapping m_heightChannel = QQuick3DMaterial::R; |
365 | float m_heightAmount = 0.0f; |
366 | int m_minHeightMapSamples = 8; |
367 | int m_maxHeightMapSamples = 32; |
368 | float m_clearcoatAmount = 0.0f; |
369 | QQuick3DTexture *m_clearcoatMap = nullptr; |
370 | TextureChannelMapping m_clearcoatChannel = QQuick3DMaterial::R; |
371 | float m_clearcoatRoughnessAmount = 0.0f; |
372 | TextureChannelMapping m_clearcoatRoughnessChannel = QQuick3DMaterial::G; |
373 | QQuick3DTexture *m_clearcoatRoughnessMap = nullptr; |
374 | QQuick3DTexture *m_clearcoatNormalMap = nullptr; |
375 | float m_transmissionFactor = 0.0f; |
376 | QQuick3DTexture *m_transmissionMap = nullptr; |
377 | TextureChannelMapping m_transmissionChannel = QQuick3DMaterial::R; |
378 | float m_thicknessFactor = 0.0f; |
379 | QQuick3DTexture *m_thicknessMap = nullptr; |
380 | TextureChannelMapping m_thicknessChannel = QQuick3DMaterial::G; |
381 | float m_attenuationDistance = std::numeric_limits<float>::infinity(); |
382 | QColor m_attenuationColor = Qt::white; |
383 | float m_indexOfRefraction = 1.5f; |
384 | bool m_vertexColorsEnabled = true; |
385 | |
386 | quint32 m_dirtyAttributes = 0xffffffff; // all dirty by default |
387 | void markDirty(DirtyType type); |
388 | }; |
389 | |
390 | QT_END_NAMESPACE |
391 | |
392 | #endif // QSSGPRINCIPLEDMATERIAL_H |
393 | |