QGIS API Documentation 4.1.0-Master (3fcefe620d1)
Loading...
Searching...
No Matches
qgsgoochmaterial.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgoochmaterial.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 QGSGOOCHMATERIAL_H
17#define QGSGOOCHMATERIAL_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
28class QMatrix4x4;
29
30
31namespace Qt3DRender
32{
33 class QParameter;
34 class QShaderProgram;
35} // namespace Qt3DRender
36
38
44class _3D_EXPORT QgsGoochMaterial : public QgsMaterial
45{
46 Q_OBJECT
47
48 public:
52 explicit QgsGoochMaterial( Qt3DCore::QNode *parent = nullptr );
53 ~QgsGoochMaterial() override;
54
60 void setInstancingEnabled( bool enabled, Qgis::InstancedMaterialFlags flags );
61
66 void setInstancingMeshTransform( const QMatrix4x4 &transform );
67
68 public slots:
70 void setDiffuse( const QColor &diffuse );
72 void setSpecular( const QColor &specular );
74 void setWarm( const QColor &warm );
76 void setCool( const QColor &cool );
77 void setShininess( float shininess );
78 void setAlpha( float alpha );
79 void setBeta( float beta );
80
86 void setDataDefinedEnabled( bool enabled );
87
88 private:
89 void init();
90 void updateShaders();
91
92 Qt3DRender::QParameter *mDiffuseParameter = nullptr;
93 Qt3DRender::QParameter *mSpecularParameter = nullptr;
94 Qt3DRender::QParameter *mWarmParameter = nullptr;
95 Qt3DRender::QParameter *mCoolParameter = nullptr;
96 Qt3DRender::QParameter *mShininessParameter = nullptr;
97 Qt3DRender::QParameter *mAlphaParameter = nullptr;
98 Qt3DRender::QParameter *mBetaParameter = nullptr;
99 Qt3DRender::QShaderProgram *mShaderProgram = nullptr;
100 bool mDataDefinedEnabled = false;
101 bool mInstanced = false;
102 Qgis::InstancedMaterialFlags mInstanceFlags;
103 Qt3DRender::QParameter *mTransformParameter = nullptr;
104 Qt3DRender::QParameter *mNormalTransformParameter = nullptr;
105};
106
108
109#endif // QGSGOOCHMATERIAL_H
QFlags< InstancedMaterialFlag > InstancedMaterialFlags
Definition qgis.h:4398
Base class for all materials used within QGIS 3D views.
Definition qgsmaterial.h:40