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

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