QGIS API Documentation 3.41.0-Master (cea29feecf2)
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:
55 explicit QgsPhongTexturedMaterial( Qt3DCore::QNode *parent = nullptr );
56 ~QgsPhongTexturedMaterial() override;
57
58 QColor ambient() const;
59 Qt3DRender::QAbstractTexture *diffuseTexture() const;
60 float diffuseTextureScale() const;
61 QColor specular() const;
62 float shininess() const;
63 float opacity() const;
64
65 public Q_SLOTS:
66 void setAmbient( const QColor &ambient );
67
72 void setDiffuseTexture( Qt3DRender::QAbstractTexture *texture );
73
74 void setDiffuseTextureScale( float textureScale );
75 void setSpecular( const QColor &specular );
76 void setShininess( float shininess );
77 void setOpacity( float opacity );
78
79 Q_SIGNALS:
80 void ambientChanged( const QColor &ambient );
81 void diffuseTextureChanged( Qt3DRender::QAbstractTexture *diffuseTexture );
82 void diffuseTextureScaleChanged( float diffuseTextureScale );
83 void specularChanged( const QColor &specular );
84 void shininessChanged( float shininess );
85 void opacityChanged( float opacity );
86
87 private:
88 void init();
89
90 void handleAmbientChanged( const QVariant &var );
91 void handleDiffuseTextureChanged( const QVariant &var );
92 void handleDiffuseTextureScaleChanged( const QVariant &var );
93 void handleSpecularChanged( const QVariant &var );
94 void handleShininessChanged( const QVariant &var );
95 void handleOpacityChanged( const QVariant &var );
96
97 Qt3DRender::QParameter *mAmbientParameter = nullptr;
98 Qt3DRender::QParameter *mDiffuseTextureParameter = nullptr;
99 Qt3DRender::QParameter *mDiffuseTextureScaleParameter = nullptr;
100 Qt3DRender::QParameter *mSpecularParameter = nullptr;
101 Qt3DRender::QParameter *mShininessParameter = nullptr;
102 Qt3DRender::QParameter *mOpacityParameter = nullptr;
103};
104
106
107#endif // QGSPHONGTEXTUREDMATERIAL_H