1// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
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 QT3DEXTRAS_QDIFFUSESPECULARMATERIAL_H
5#define QT3DEXTRAS_QDIFFUSESPECULARMATERIAL_H
6
7#include <Qt3DExtras/qt3dextras_global.h>
8#include <Qt3DRender/qmaterial.h>
9#include <QtGui/QColor>
10
11QT_BEGIN_NAMESPACE
12
13namespace Qt3DExtras {
14
15class QDiffuseSpecularMaterialPrivate;
16
17class Q_3DEXTRASSHARED_EXPORT QDiffuseSpecularMaterial : public Qt3DRender::QMaterial
18{
19 Q_OBJECT
20 Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
21 Q_PROPERTY(QVariant diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
22 Q_PROPERTY(QVariant specular READ specular WRITE setSpecular NOTIFY specularChanged)
23 Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
24 Q_PROPERTY(QVariant normal READ normal WRITE setNormal NOTIFY normalChanged)
25 Q_PROPERTY(float textureScale READ textureScale WRITE setTextureScale NOTIFY textureScaleChanged)
26 Q_PROPERTY(bool alphaBlending READ isAlphaBlendingEnabled WRITE setAlphaBlendingEnabled NOTIFY alphaBlendingEnabledChanged)
27
28public:
29 explicit QDiffuseSpecularMaterial(Qt3DCore::QNode *parent = nullptr);
30 ~QDiffuseSpecularMaterial();
31
32 QColor ambient() const;
33 QVariant diffuse() const;
34 QVariant specular() const;
35 float shininess() const;
36 QVariant normal() const;
37 float textureScale() const;
38 bool isAlphaBlendingEnabled() const;
39
40public Q_SLOTS:
41 void setAmbient(const QColor &ambient);
42 void setDiffuse(const QVariant &diffuse);
43 void setSpecular(const QVariant &specular);
44 void setShininess(float shininess);
45 void setNormal(const QVariant &normal);
46 void setTextureScale(float textureScale);
47 void setAlphaBlendingEnabled(bool enabled);
48
49Q_SIGNALS:
50 void ambientChanged(const QColor &ambient);
51 void diffuseChanged(const QVariant &diffuse);
52 void specularChanged(const QVariant &specular);
53 void shininessChanged(float shininess);
54 void normalChanged(const QVariant &normal);
55 void textureScaleChanged(float textureScale);
56 void alphaBlendingEnabledChanged(bool enabled);
57
58private:
59 Q_DECLARE_PRIVATE(QDiffuseSpecularMaterial)
60};
61
62} // namespace Qt3DExtras
63
64QT_END_NAMESPACE
65
66#endif // QT3DEXTRAS_QDIFFUSESPECULARMATERIAL_H
67

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