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_QPHONGALPHAMATERIAL_H
5#define QT3DEXTRAS_QPHONGALPHAMATERIAL_H
6
7#include <Qt3DExtras/qt3dextras_global.h>
8#include <Qt3DRender/qblendequation.h>
9#include <Qt3DRender/qblendequationarguments.h>
10#include <Qt3DRender/qmaterial.h>
11#include <QtGui/QColor>
12
13QT_BEGIN_NAMESPACE
14
15namespace Qt3DExtras {
16
17class QPhongAlphaMaterialPrivate;
18
19class Q_3DEXTRASSHARED_EXPORT QPhongAlphaMaterial : public Qt3DRender::QMaterial
20{
21 Q_OBJECT
22 Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
23 Q_PROPERTY(QColor diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
24 Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
25 Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
26 Q_PROPERTY(float alpha READ alpha WRITE setAlpha NOTIFY alphaChanged)
27 Q_PROPERTY(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg READ sourceRgbArg WRITE setSourceRgbArg NOTIFY sourceRgbArgChanged)
28 Q_PROPERTY(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg READ destinationRgbArg WRITE setDestinationRgbArg NOTIFY destinationRgbArgChanged)
29 Q_PROPERTY(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg READ sourceAlphaArg WRITE setSourceAlphaArg NOTIFY sourceAlphaArgChanged)
30 Q_PROPERTY(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg READ destinationAlphaArg WRITE setDestinationAlphaArg NOTIFY destinationAlphaArgChanged)
31 Q_PROPERTY(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg READ blendFunctionArg WRITE setBlendFunctionArg NOTIFY blendFunctionArgChanged)
32
33public:
34 explicit QPhongAlphaMaterial(Qt3DCore::QNode *parent = nullptr);
35 ~QPhongAlphaMaterial();
36
37 QColor ambient() const;
38 QColor diffuse() const;
39 QColor specular() const;
40 float shininess() const;
41 float alpha() const;
42
43 Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg() const;
44 Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg() const;
45 Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg() const;
46 Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg() const;
47 Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg() const;
48
49public Q_SLOTS:
50 void setAmbient(const QColor &ambient);
51 void setDiffuse(const QColor &diffuse);
52 void setSpecular(const QColor &specular);
53 void setShininess(float shininess);
54 void setAlpha(float alpha);
55 void setSourceRgbArg(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg);
56 void setDestinationRgbArg(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg);
57 void setSourceAlphaArg(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg);
58 void setDestinationAlphaArg(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg);
59 void setBlendFunctionArg(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg);
60
61Q_SIGNALS:
62 void ambientChanged(const QColor &ambient);
63 void diffuseChanged(const QColor &diffuse);
64 void specularChanged(const QColor &specular);
65 void shininessChanged(float shininess);
66 void alphaChanged(float alpha);
67 void sourceRgbArgChanged(Qt3DRender::QBlendEquationArguments::Blending sourceRgbArg);
68 void destinationRgbArgChanged(Qt3DRender::QBlendEquationArguments::Blending destinationRgbArg);
69 void sourceAlphaArgChanged(Qt3DRender::QBlendEquationArguments::Blending sourceAlphaArg);
70 void destinationAlphaArgChanged(Qt3DRender::QBlendEquationArguments::Blending destinationAlphaArg);
71 void blendFunctionArgChanged(Qt3DRender::QBlendEquation::BlendFunction blendFunctionArg);
72
73private:
74 Q_DECLARE_PRIVATE(QPhongAlphaMaterial)
75};
76
77} // namespace Qt3DExtras
78
79QT_END_NAMESPACE
80
81#endif // QT3DEXTRAS_QPHONGALPHAMATERIAL_H
82

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