1/****************************************************************************
2**
3** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt3D module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qdiffusespecularmaterial.h"
41#include "qdiffusespecularmaterial_p.h"
42
43#include <Qt3DRender/qfilterkey.h>
44#include <Qt3DRender/qmaterial.h>
45#include <Qt3DRender/qeffect.h>
46#include <Qt3DRender/qtechnique.h>
47#include <Qt3DRender/qtexture.h>
48#include <Qt3DRender/qshaderprogram.h>
49#include <Qt3DRender/qshaderprogrambuilder.h>
50#include <Qt3DRender/qparameter.h>
51#include <Qt3DRender/qrenderpass.h>
52#include <Qt3DRender/qgraphicsapifilter.h>
53#include <Qt3DRender/qblendequation.h>
54#include <Qt3DRender/qblendequationarguments.h>
55#include <Qt3DRender/qnodepthmask.h>
56#include <QtCore/QUrl>
57#include <QtGui/QVector3D>
58#include <QtGui/QVector4D>
59
60
61QT_BEGIN_NAMESPACE
62
63using namespace Qt3DRender;
64
65namespace Qt3DExtras {
66
67QDiffuseSpecularMaterialPrivate::QDiffuseSpecularMaterialPrivate()
68 : QMaterialPrivate()
69 , m_effect(new QEffect())
70 , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(r: 0.05f, g: 0.05f, b: 0.05f, a: 1.0f)))
71 , m_diffuseParameter(new QParameter(QStringLiteral("kd"), QColor::fromRgbF(r: 0.7f, g: 0.7f, b: 0.7f, a: 1.0f)))
72 , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(r: 0.01f, g: 0.01f, b: 0.01f, a: 1.0f)))
73 , m_diffuseTextureParameter(new QParameter(QStringLiteral("diffuseTexture"), QVariant()))
74 , m_specularTextureParameter(new QParameter(QStringLiteral("specularTexture"), QVariant()))
75 , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
76 , m_normalTextureParameter(new QParameter(QStringLiteral("normalTexture"), QVariant()))
77 , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f))
78 , m_gl3Technique(new QTechnique())
79 , m_gl2Technique(new QTechnique())
80 , m_es2Technique(new QTechnique())
81 , m_rhiTechnique(new QTechnique())
82 , m_gl3RenderPass(new QRenderPass())
83 , m_gl2RenderPass(new QRenderPass())
84 , m_es2RenderPass(new QRenderPass())
85 , m_rhiRenderPass(new QRenderPass())
86 , m_gl3Shader(new QShaderProgram())
87 , m_gl3ShaderBuilder(new QShaderProgramBuilder())
88 , m_gl2es2Shader(new QShaderProgram())
89 , m_gl2es2ShaderBuilder(new QShaderProgramBuilder())
90 , m_rhiShader(new QShaderProgram())
91 , m_rhiShaderBuilder(new QShaderProgramBuilder())
92 , m_noDepthMask(new QNoDepthMask())
93 , m_blendState(new QBlendEquationArguments())
94 , m_blendEquation(new QBlendEquation())
95 , m_filterKey(new QFilterKey)
96{
97}
98
99void QDiffuseSpecularMaterialPrivate::init()
100{
101 Q_Q(QDiffuseSpecularMaterial);
102
103 connect(sender: m_ambientParameter, signal: &Qt3DRender::QParameter::valueChanged,
104 receiverPrivate: this, slot: &QDiffuseSpecularMaterialPrivate::handleAmbientChanged);
105 QObject::connect(sender: m_diffuseParameter, signal: &Qt3DRender::QParameter::valueChanged,
106 receiver: q, slot: &QDiffuseSpecularMaterial::diffuseChanged);
107 QObject::connect(sender: m_specularParameter, signal: &Qt3DRender::QParameter::valueChanged,
108 receiver: q, slot: &QDiffuseSpecularMaterial::specularChanged);
109 connect(sender: m_shininessParameter, signal: &Qt3DRender::QParameter::valueChanged,
110 receiverPrivate: this, slot: &QDiffuseSpecularMaterialPrivate::handleShininessChanged);
111 QObject::connect(sender: m_normalTextureParameter, signal: &Qt3DRender::QParameter::valueChanged,
112 receiver: q, slot: &QDiffuseSpecularMaterial::normalChanged);
113 connect(sender: m_textureScaleParameter, signal: &Qt3DRender::QParameter::valueChanged,
114 receiverPrivate: this, slot: &QDiffuseSpecularMaterialPrivate::handleTextureScaleChanged);
115 QObject::connect(sender: m_noDepthMask, signal: &QNoDepthMask::enabledChanged,
116 receiver: q, slot: &QDiffuseSpecularMaterial::alphaBlendingEnabledChanged);
117
118 m_gl3Shader->setVertexShaderCode(QShaderProgram::loadSource(sourceUrl: QUrl(QStringLiteral("qrc:/shaders/gl3/default.vert"))));
119 m_gl3ShaderBuilder->setParent(q);
120 m_gl3ShaderBuilder->setShaderProgram(m_gl3Shader);
121 m_gl3ShaderBuilder->setFragmentShaderGraph(QUrl(QStringLiteral("qrc:/shaders/graphs/phong.frag.json")));
122 m_gl3ShaderBuilder->setEnabledLayers({QStringLiteral("diffuse"),
123 QStringLiteral("specular"),
124 QStringLiteral("normal")});
125
126 m_gl2es2Shader->setVertexShaderCode(QShaderProgram::loadSource(sourceUrl: QUrl(QStringLiteral("qrc:/shaders/es2/default.vert"))));
127 m_gl2es2ShaderBuilder->setParent(q);
128 m_gl2es2ShaderBuilder->setShaderProgram(m_gl2es2Shader);
129 m_gl2es2ShaderBuilder->setFragmentShaderGraph(QUrl(QStringLiteral("qrc:/shaders/graphs/phong.frag.json")));
130 m_gl2es2ShaderBuilder->setEnabledLayers({QStringLiteral("diffuse"),
131 QStringLiteral("specular"),
132 QStringLiteral("normal")});
133
134 m_rhiShader->setVertexShaderCode(QShaderProgram::loadSource(sourceUrl: QUrl(QStringLiteral("qrc:/shaders/rhi/default.vert"))));
135 m_rhiShaderBuilder->setParent(q);
136 m_rhiShaderBuilder->setShaderProgram(m_rhiShader);
137 m_rhiShaderBuilder->setFragmentShaderGraph(QUrl(QStringLiteral("qrc:/shaders/graphs/phong.frag.json")));
138 m_rhiShaderBuilder->setEnabledLayers({QStringLiteral("diffuse"),
139 QStringLiteral("specular"),
140 QStringLiteral("normal")});
141
142
143 m_gl3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
144 m_gl3Technique->graphicsApiFilter()->setMajorVersion(3);
145 m_gl3Technique->graphicsApiFilter()->setMinorVersion(1);
146 m_gl3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
147
148 m_gl2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
149 m_gl2Technique->graphicsApiFilter()->setMajorVersion(2);
150 m_gl2Technique->graphicsApiFilter()->setMinorVersion(0);
151 m_gl2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
152
153 m_es2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
154 m_es2Technique->graphicsApiFilter()->setMajorVersion(2);
155 m_es2Technique->graphicsApiFilter()->setMinorVersion(0);
156 m_es2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
157
158 m_rhiTechnique->graphicsApiFilter()->setApi(QGraphicsApiFilter::RHI);
159 m_rhiTechnique->graphicsApiFilter()->setMajorVersion(1);
160 m_rhiTechnique->graphicsApiFilter()->setMinorVersion(0);
161
162 m_noDepthMask->setEnabled(false);
163 m_blendState->setEnabled(false);
164 m_blendState->setSourceRgb(QBlendEquationArguments::SourceAlpha);
165 m_blendState->setDestinationRgb(QBlendEquationArguments::OneMinusSourceAlpha);
166 m_blendEquation->setEnabled(false);
167 m_blendEquation->setBlendFunction(QBlendEquation::Add);
168
169 m_gl3RenderPass->setShaderProgram(m_gl3Shader);
170 m_gl2RenderPass->setShaderProgram(m_gl2es2Shader);
171 m_es2RenderPass->setShaderProgram(m_gl2es2Shader);
172 m_rhiRenderPass->setShaderProgram(m_rhiShader);
173
174 m_gl3RenderPass->addRenderState(state: m_noDepthMask);
175 m_gl3RenderPass->addRenderState(state: m_blendState);
176 m_gl3RenderPass->addRenderState(state: m_blendEquation);
177
178 m_gl2RenderPass->addRenderState(state: m_noDepthMask);
179 m_gl2RenderPass->addRenderState(state: m_blendState);
180 m_gl2RenderPass->addRenderState(state: m_blendEquation);
181
182 m_es2RenderPass->addRenderState(state: m_noDepthMask);
183 m_es2RenderPass->addRenderState(state: m_blendState);
184 m_es2RenderPass->addRenderState(state: m_blendEquation);
185
186 m_rhiRenderPass->addRenderState(state: m_noDepthMask);
187 m_rhiRenderPass->addRenderState(state: m_blendState);
188 m_rhiRenderPass->addRenderState(state: m_blendEquation);
189
190 m_gl3Technique->addRenderPass(pass: m_gl3RenderPass);
191 m_gl2Technique->addRenderPass(pass: m_gl2RenderPass);
192 m_es2Technique->addRenderPass(pass: m_es2RenderPass);
193 m_rhiTechnique->addRenderPass(pass: m_rhiRenderPass);
194
195 m_filterKey->setParent(q);
196 m_filterKey->setName(QStringLiteral("renderingStyle"));
197 m_filterKey->setValue(QStringLiteral("forward"));
198
199 m_gl3Technique->addFilterKey(filterKey: m_filterKey);
200 m_gl2Technique->addFilterKey(filterKey: m_filterKey);
201 m_es2Technique->addFilterKey(filterKey: m_filterKey);
202 m_rhiTechnique->addFilterKey(filterKey: m_filterKey);
203
204 m_effect->addTechnique(t: m_gl3Technique);
205 m_effect->addTechnique(t: m_gl2Technique);
206 m_effect->addTechnique(t: m_es2Technique);
207 m_effect->addTechnique(t: m_rhiTechnique);
208
209 m_effect->addParameter(parameter: m_ambientParameter);
210 m_effect->addParameter(parameter: m_diffuseParameter);
211 m_effect->addParameter(parameter: m_specularParameter);
212 m_effect->addParameter(parameter: m_shininessParameter);
213 m_effect->addParameter(parameter: m_textureScaleParameter);
214
215 q->setEffect(m_effect);
216}
217
218void QDiffuseSpecularMaterialPrivate::handleAmbientChanged(const QVariant &var)
219{
220 Q_Q(QDiffuseSpecularMaterial);
221 emit q->ambientChanged(ambient: var.value<QColor>());
222}
223
224void QDiffuseSpecularMaterialPrivate::handleShininessChanged(const QVariant &var)
225{
226 Q_Q(QDiffuseSpecularMaterial);
227 emit q->shininessChanged(shininess: var.toFloat());
228}
229
230void QDiffuseSpecularMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
231{
232 Q_Q(QDiffuseSpecularMaterial);
233 emit q->textureScaleChanged(textureScale: var.toFloat());
234}
235
236/*!
237 \class Qt3DExtras::QDiffuseSpecularMaterial
238 \ingroup qt3d-extras-materials
239 \brief The QDiffuseSpecularMaterial class provides a default implementation
240 of the phong lighting effect.
241 \inmodule Qt3DExtras
242 \since 5.10
243 \inherits Qt3DRender::QMaterial
244
245 The phong lighting effect is based on the combination of 3 lighting
246 components ambient, diffuse and specular. The relative strengths of these
247 components are controlled by means of their reflectivity coefficients which
248 are modelled as RGB triplets:
249
250 \list
251 \li Ambient is the color that is emitted by an object without any other
252 light source.
253 \li Diffuse is the color that is emitted for rought surface reflections
254 with the lights.
255 \li Specular is the color emitted for shiny surface reflections with the
256 lights.
257 \li The shininess of a surface is controlled by a float property.
258 \endlist
259
260 This material uses an effect with a single render pass approach and
261 performs per fragment lighting. Techniques are provided for OpenGL 2,
262 OpenGL 3 or above as well as OpenGL ES 2.
263*/
264/*!
265 \qmltype DiffuseSpecularMaterial
266 \brief The DiffuseSpecularMaterial class provides a default implementation
267 of the phong lighting effect.
268 \since 5.10
269 \inqmlmodule Qt3D.Extras
270 \instantiates Qt3DExtras::QDiffuseSpecularMaterial
271
272 The phong lighting effect is based on the combination of 3 lighting
273 components ambient, diffuse and specular. The relative strengths of these
274 components are controlled by means of their reflectivity coefficients which
275 are modelled as RGB triplets:
276
277 \list
278 \li Ambient is the color that is emitted by an object without any other
279 light source.
280 \li Diffuse is the color that is emitted for rough surface reflections
281 with the lights.
282 \li Specular is the color emitted for shiny surface reflections with the
283 lights.
284 \li The shininess of a surface is controlled by a float property.
285 \endlist
286
287 This material uses an effect with a single render pass approach and
288 performs per fragment lighting. Techniques are provided for OpenGL 2,
289 OpenGL 3 or above as well as OpenGL ES 2.
290 */
291
292/*!
293 Constructs a new QDiffuseSpecularMaterial instance with parent object \a parent.
294*/
295QDiffuseSpecularMaterial::QDiffuseSpecularMaterial(QNode *parent)
296 : QMaterial(*new QDiffuseSpecularMaterialPrivate, parent)
297{
298 Q_D(QDiffuseSpecularMaterial);
299 d->init();
300}
301
302/*!
303 Destroys the QDiffuseSpecularMaterial.
304*/
305QDiffuseSpecularMaterial::~QDiffuseSpecularMaterial()
306{
307}
308
309/*!
310 \property QDiffuseSpecularMaterial::ambient
311
312 Holds the ambient color that is emitted by an object without any other
313 light source.
314*/
315/*!
316 \qmlproperty color DiffuseSpecularMaterial::ambient
317
318 Holds the ambient color that is emitted by an object without any other
319 light source.
320*/
321QColor QDiffuseSpecularMaterial::ambient() const
322{
323 Q_D(const QDiffuseSpecularMaterial);
324 return d->m_ambientParameter->value().value<QColor>();
325}
326
327/*!
328 \property QDiffuseSpecularMaterial::diffuse
329
330 Holds the diffuse color of the material that is emitted for rough surface
331 reflections with the lights. This can be either a plain color value or a
332 texture.
333*/
334/*!
335 \qmlproperty var DiffuseSpecularMaterial::diffuse
336
337 Holds the diffuse color of the material that is emitted for rough surface
338 reflections with the lights. This can be either a plain color value or a
339 texture.
340*/
341QVariant QDiffuseSpecularMaterial::diffuse() const
342{
343 Q_D(const QDiffuseSpecularMaterial);
344 return d->m_diffuseParameter->value();
345}
346
347/*!
348 \property QDiffuseSpecularMaterial::specular
349
350 Holds the specular color of the material that is emitted for shiny surface
351 reflections with the lights. This can be either a plain color value or a
352 texture.
353*/
354/*!
355 \qmlproperty var DiffuseSpecularMaterial::specular
356
357 Holds the specular color of the material that is emitted for shiny surface
358 reflections with the lights. This can be either a plain color value or a
359 texture.
360*/
361QVariant QDiffuseSpecularMaterial::specular() const
362{
363 Q_D(const QDiffuseSpecularMaterial);
364 return d->m_specularParameter->value();
365}
366
367/*!
368 \property QDiffuseSpecularMaterial::shininess
369
370 Holds the shininess exponent. Higher values of shininess result in
371 a smaller and brighter highlight.
372
373 Defaults to 150.0.
374*/
375/*!
376 \qmlproperty real DiffuseSpecularMaterial::shininess
377
378 Holds the shininess exponent. Higher values of shininess result in
379 a smaller and brighter highlight.
380
381 Defaults to 150.0.
382*/
383float QDiffuseSpecularMaterial::shininess() const
384{
385 Q_D(const QDiffuseSpecularMaterial);
386 return d->m_shininessParameter->value().toFloat();
387}
388
389/*!
390 \property QDiffuseSpecularMaterial::normal
391
392 Holds the current normal map texture of the material. This can only be a
393 texture, otherwise it is ignored. By default this map is not set.
394*/
395/*!
396 \qmlproperty var DiffuseSpecularMaterial::normal
397
398 Holds the current normal map texture of the material. This can only be a
399 texture, otherwise it is ignored. By default this map is not set.
400*/
401QVariant QDiffuseSpecularMaterial::normal() const
402{
403 Q_D(const QDiffuseSpecularMaterial);
404 return d->m_normalTextureParameter->value();
405}
406
407/*!
408 \property QDiffuseSpecularMaterial::textureScale
409
410 Holds the current texture scale. It is applied as a multiplier to texture
411 coordinates at render time. Defaults to 1.0.
412
413 When used in conjunction with QTextureWrapMode::Repeat, textureScale provides a simple
414 way to tile a texture across a surface. For example, a texture scale of \c 4.0
415 would result in 16 (4x4) tiles.
416*/
417/*!
418 \qmlproperty real DiffuseSpecularMaterial::textureScale
419
420 Holds the current texture scale. It is applied as a multiplier to texture
421 coordinates at render time. Defaults to 1.0.
422
423 When used in conjunction with WrapMode.Repeat, textureScale provides a simple
424 way to tile a texture across a surface. For example, a texture scale of \c 4.0
425 would result in 16 (4x4) tiles.
426*/
427float QDiffuseSpecularMaterial::textureScale() const
428{
429 Q_D(const QDiffuseSpecularMaterial);
430 return d->m_textureScaleParameter->value().toFloat();
431}
432
433/*!
434 \property QDiffuseSpecularMaterial::alphaBlending
435
436 Indicates if the alpha information coming from the diffuse property will
437 be taken into account during rendering. Defaults to false.
438*/
439/*!
440 \qmlproperty bool DiffuseSpecularMaterial::alphaBlending
441
442 Indicates if the alpha information coming from the diffuse property will
443 be taken into account during rendering. Defaults to false.
444*/
445bool QDiffuseSpecularMaterial::isAlphaBlendingEnabled() const
446{
447 Q_D(const QDiffuseSpecularMaterial);
448 return d->m_noDepthMask->isEnabled();
449}
450
451void QDiffuseSpecularMaterial::setAmbient(const QColor &ambient)
452{
453 Q_D(QDiffuseSpecularMaterial);
454 d->m_ambientParameter->setValue(ambient);
455}
456
457void QDiffuseSpecularMaterial::setDiffuse(const QVariant &diffuse)
458{
459 Q_D(QDiffuseSpecularMaterial);
460 d->m_diffuseParameter->setValue(diffuse);
461 d->m_diffuseTextureParameter->setValue(diffuse);
462
463 auto layers = d->m_gl3ShaderBuilder->enabledLayers();
464 if (diffuse.value<QAbstractTexture *>()) {
465 layers.removeAll(QStringLiteral("diffuse"));
466 layers.append(QStringLiteral("diffuseTexture"));
467 d->m_effect->addParameter(parameter: d->m_diffuseTextureParameter);
468 d->m_effect->removeParameter(parameter: d->m_diffuseParameter);
469 } else {
470 layers.removeAll(QStringLiteral("diffuseTexture"));
471 layers.append(QStringLiteral("diffuse"));
472 d->m_effect->removeParameter(parameter: d->m_diffuseTextureParameter);
473 d->m_effect->addParameter(parameter: d->m_diffuseParameter);
474 }
475 d->m_gl3ShaderBuilder->setEnabledLayers(layers);
476 d->m_gl2es2ShaderBuilder->setEnabledLayers(layers);
477}
478
479void QDiffuseSpecularMaterial::setSpecular(const QVariant &specular)
480{
481 Q_D(QDiffuseSpecularMaterial);
482 d->m_specularParameter->setValue(specular);
483 d->m_specularTextureParameter->setValue(specular);
484
485 auto layers = d->m_gl3ShaderBuilder->enabledLayers();
486 if (specular.value<QAbstractTexture *>()) {
487 layers.removeAll(QStringLiteral("specular"));
488 layers.append(QStringLiteral("specularTexture"));
489 d->m_effect->addParameter(parameter: d->m_specularTextureParameter);
490 d->m_effect->removeParameter(parameter: d->m_specularParameter);
491 } else {
492 layers.removeAll(QStringLiteral("specularTexture"));
493 layers.append(QStringLiteral("specular"));
494 d->m_effect->removeParameter(parameter: d->m_specularTextureParameter);
495 d->m_effect->addParameter(parameter: d->m_specularParameter);
496 }
497 d->m_gl3ShaderBuilder->setEnabledLayers(layers);
498 d->m_gl2es2ShaderBuilder->setEnabledLayers(layers);
499}
500
501void QDiffuseSpecularMaterial::setShininess(float shininess)
502{
503 Q_D(QDiffuseSpecularMaterial);
504 d->m_shininessParameter->setValue(shininess);
505}
506
507void QDiffuseSpecularMaterial::setNormal(const QVariant &normal)
508{
509 Q_D(QDiffuseSpecularMaterial);
510 d->m_normalTextureParameter->setValue(normal);
511
512 auto layers = d->m_gl3ShaderBuilder->enabledLayers();
513 if (normal.value<QAbstractTexture *>()) {
514 layers.removeAll(QStringLiteral("normal"));
515 layers.append(QStringLiteral("normalTexture"));
516 d->m_effect->addParameter(parameter: d->m_normalTextureParameter);
517 } else {
518 layers.removeAll(QStringLiteral("normalTexture"));
519 layers.append(QStringLiteral("normal"));
520 d->m_effect->removeParameter(parameter: d->m_normalTextureParameter);
521 }
522 d->m_gl3ShaderBuilder->setEnabledLayers(layers);
523}
524
525void QDiffuseSpecularMaterial::setTextureScale(float textureScale)
526{
527 Q_D(QDiffuseSpecularMaterial);
528 d->m_textureScaleParameter->setValue(textureScale);
529}
530
531void QDiffuseSpecularMaterial::setAlphaBlendingEnabled(bool enabled)
532{
533 Q_D(QDiffuseSpecularMaterial);
534 d->m_noDepthMask->setEnabled(enabled);
535 d->m_blendState->setEnabled(enabled);
536 d->m_blendEquation->setEnabled(enabled);
537}
538
539} // namespace Qt3DExtras
540
541QT_END_NAMESPACE
542

source code of qt3d/src/extras/defaults/qdiffusespecularmaterial.cpp