QGIS API Documentation 4.1.0-Master (31622b25bb0)
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.h"
20#include "qgis_3d.h"
21#include "qgsmaterial.h"
22
23#include <QColor>
24#include <QObject>
25
26#define SIP_NO_FILE
27
28namespace Qt3DRender
29{
30 class QParameter;
31 class QShaderProgram;
32} // namespace Qt3DRender
33
35
42class _3D_EXPORT QgsPhongMaterial : public QgsMaterial
43{
44 Q_OBJECT
45
46 public:
50 explicit QgsPhongMaterial( Qt3DCore::QNode *parent = nullptr );
51
57 void setInstancingEnabled( bool enabled, Qgis::InstancedMaterialFlags flags );
58
59 ~QgsPhongMaterial() override;
60
61 public slots:
63 void setAmbient( const QColor &ambient, float scaleFactor = 1 );
65 void setDiffuse( const QColor &diffuse, float scaleFactor = 1 );
67 void setSpecular( const QColor &specular, float scaleFactor = 1 );
68 void setShininess( float shininess );
69 void setOpacity( float opacity );
70
76 void setDataDefinedEnabled( bool enabled );
77
78 private:
79 void init();
80 void updateShaders();
81
82 Qt3DRender::QParameter *mAmbientParameter = nullptr;
83 Qt3DRender::QParameter *mDiffuseParameter = nullptr;
84 Qt3DRender::QParameter *mSpecularParameter = nullptr;
85 Qt3DRender::QParameter *mShininessParameter = nullptr;
86 Qt3DRender::QParameter *mOpacityParameter = nullptr;
87 Qt3DRender::QShaderProgram *mShaderProgram = nullptr;
88 bool mDataDefinedEnabled = false;
89 bool mInstanced = false;
90 Qgis::InstancedMaterialFlags mInstanceFlags;
91};
92
94
95#endif // QGSPHONGMATERIAL_H
QFlags< InstancedMaterialFlag > InstancedMaterialFlags
Definition qgis.h:4365
Base class for all materials used within QGIS 3D views.
Definition qgsmaterial.h:40