QGIS API Documentation 4.1.0-Master (64dc32379c2)
Loading...
Searching...
No Matches
qgsphongmaterial.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsphongmaterial.h
3 --------------------------------------
4 Date : April 2026
5 Copyright : (C) 2026 by Dominik Cindrić
6 Email : viper dot miniq at gmail 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 QGSPHONGMATERIAL_H
17#define QGSPHONGMATERIAL_H
18
19#include "qgis_3d.h"
20#include "qgsmaterial.h"
21
22#include <QColor>
23#include <QObject>
24
25#define SIP_NO_FILE
26
27namespace Qt3DRender
28{
29 class QParameter;
30 class QShaderProgram;
31} // namespace Qt3DRender
32
34
41class _3D_EXPORT QgsPhongMaterial : public QgsMaterial
42{
43 Q_OBJECT
44
45 public:
49 explicit QgsPhongMaterial( Qt3DCore::QNode *parent = nullptr );
50 ~QgsPhongMaterial() override;
51
52 public slots:
54 void setAmbient( const QColor &ambient, float scaleFactor = 1 );
56 void setDiffuse( const QColor &diffuse, float scaleFactor = 1 );
58 void setSpecular( const QColor &specular, float scaleFactor = 1 );
59 void setShininess( float shininess );
60 void setOpacity( float opacity );
61
67 void setDataDefinedEnabled( bool enabled );
68
69 private:
70 void init();
71 void updateShaders();
72
73 Qt3DRender::QParameter *mAmbientParameter = nullptr;
74 Qt3DRender::QParameter *mDiffuseParameter = nullptr;
75 Qt3DRender::QParameter *mSpecularParameter = nullptr;
76 Qt3DRender::QParameter *mShininessParameter = nullptr;
77 Qt3DRender::QParameter *mOpacityParameter = nullptr;
78 Qt3DRender::QShaderProgram *mShaderProgram = nullptr;
79 bool mDataDefinedEnabled = false;
80};
81
83
84#endif // QGSPHONGMATERIAL_H
Base class for all materials used within QGIS 3D views.
Definition qgsmaterial.h:40