QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsphongtexturedmaterial.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsphongtexturedmaterial.h
3 --------------------------------------
4 Date : August 2024
5 Copyright : (C) 2024 by Jean Felder
6 Email : jean dot felder at oslandia dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSPHONGTEXTUREDMATERIAL_H
17#define QGSPHONGTEXTUREDMATERIAL_H
18
19#include "qgis_3d.h"
20#include "qgsmaterial.h"
21
22#include <QColor>
23#include <QObject>
24#include <Qt3DRender/QTexture>
25
26#define SIP_NO_FILE
27
28namespace Qt3DRender
29{
30 class QParameter;
31
32} // namespace Qt3DRender
33
35
41class _3D_EXPORT QgsPhongTexturedMaterial : public QgsMaterial
42{
43 Q_OBJECT
44 Q_PROPERTY( QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged )
45 Q_PROPERTY( Qt3DRender::QAbstractTexture *diffuseTexture READ diffuseTexture WRITE setDiffuseTexture NOTIFY diffuseTextureChanged )
46 Q_PROPERTY( float diffuseTextureScale READ diffuseTextureScale WRITE setDiffuseTextureScale NOTIFY diffuseTextureScaleChanged )
47 Q_PROPERTY( QColor specular READ specular WRITE setSpecular NOTIFY specularChanged )
48 Q_PROPERTY( float shininess READ shininess WRITE setShininess NOTIFY shininessChanged )
49 Q_PROPERTY( float opacity READ opacity WRITE setOpacity NOTIFY opacityChanged )
50
51 public:
52
56 explicit QgsPhongTexturedMaterial( Qt3DCore::QNode *parent = nullptr );
57 ~QgsPhongTexturedMaterial() override;
58
59 QColor ambient() const;
60 Qt3DRender::QAbstractTexture *diffuseTexture() const;
61 float diffuseTextureScale() const;
62 QColor specular() const;
63 float shininess() const;
64 float opacity() const;
65
66 public Q_SLOTS:
67 void setAmbient( const QColor &ambient );
68
73 void setDiffuseTexture( Qt3DRender::QAbstractTexture *texture );
74
75 void setDiffuseTextureScale( float textureScale );
76 void setSpecular( const QColor &specular );
77 void setShininess( float shininess );
78 void setOpacity( float opacity );
79
80 Q_SIGNALS:
81 void ambientChanged( const QColor &ambient );
82 void diffuseTextureChanged( Qt3DRender::QAbstractTexture *diffuseTexture );
83 void diffuseTextureScaleChanged( float diffuseTextureScale );
84 void specularChanged( const QColor &specular );
85 void shininessChanged( float shininess );
86 void opacityChanged( float opacity );
87
88 private:
89 void init();
90
91 void handleAmbientChanged( const QVariant &var );
92 void handleDiffuseTextureChanged( const QVariant &var );
93 void handleDiffuseTextureScaleChanged( const QVariant &var );
94 void handleSpecularChanged( const QVariant &var );
95 void handleShininessChanged( const QVariant &var );
96 void handleOpacityChanged( const QVariant &var );
97
98 Qt3DRender::QParameter *mAmbientParameter = nullptr;
99 Qt3DRender::QParameter *mDiffuseTextureParameter = nullptr;
100 Qt3DRender::QParameter *mDiffuseTextureScaleParameter = nullptr;
101 Qt3DRender::QParameter *mSpecularParameter = nullptr;
102 Qt3DRender::QParameter *mShininessParameter = nullptr;
103 Qt3DRender::QParameter *mOpacityParameter = nullptr;
104};
105
107
108#endif // QGSPHONGTEXTUREDMATERIAL_H