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_QTEXTUREMATERIAL_H
5#define QT3DEXTRAS_QTEXTUREMATERIAL_H
6
7#include <Qt3DExtras/qt3dextras_global.h>
8#include <Qt3DRender/qmaterial.h>
9#include <QtGui/QVector2D>
10#include <QtGui/QMatrix3x3>
11
12QT_BEGIN_NAMESPACE
13
14namespace Qt3DRender {
15
16class QAbstractTexture;
17
18} // namespace Qt3DRender
19
20namespace Qt3DExtras {
21
22class QTextureMaterialPrivate;
23
24class Q_3DEXTRASSHARED_EXPORT QTextureMaterial : public Qt3DRender::QMaterial
25{
26 Q_OBJECT
27 Q_PROPERTY(Qt3DRender::QAbstractTexture *texture READ texture WRITE setTexture NOTIFY textureChanged)
28 Q_PROPERTY(QVector2D textureOffset READ textureOffset WRITE setTextureOffset NOTIFY textureOffsetChanged)
29 Q_PROPERTY(QMatrix3x3 textureTransform READ textureTransform WRITE setTextureTransform NOTIFY textureTransformChanged REVISION 10)
30 Q_PROPERTY(bool alphaBlending READ isAlphaBlendingEnabled WRITE setAlphaBlendingEnabled NOTIFY alphaBlendingEnabledChanged REVISION 11)
31
32public:
33 explicit QTextureMaterial(Qt3DCore::QNode *parent = nullptr);
34 ~QTextureMaterial();
35
36 Qt3DRender::QAbstractTexture *texture() const;
37 QVector2D textureOffset() const;
38 QMatrix3x3 textureTransform() const;
39 bool isAlphaBlendingEnabled() const;
40
41public Q_SLOTS:
42 void setTexture(Qt3DRender::QAbstractTexture *texture);
43 void setTextureOffset(QVector2D textureOffset);
44 void setTextureTransform(const QMatrix3x3 &matrix);
45 void setAlphaBlendingEnabled(bool enabled);
46
47Q_SIGNALS:
48 void textureChanged(Qt3DRender::QAbstractTexture *texture);
49 void textureOffsetChanged(QVector2D textureOffset);
50 void textureTransformChanged(const QMatrix3x3 &textureTransform);
51 void alphaBlendingEnabledChanged(bool enabled);
52
53private:
54 Q_DECLARE_PRIVATE(QTextureMaterial)
55};
56
57} // Qt3DExtras
58
59QT_END_NAMESPACE
60
61#endif // QT3DEXTRAS_QTEXTUREMATERIAL_H
62

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