QGIS API Documentation 4.1.0-Master (659fe69c07c)
Loading...
Searching...
No Matches
qgstexturematerial.h
Go to the documentation of this file.
1/***************************************************************************
2 qgstexturematerial.h
3 --------------------------------------
4 Date : March 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 QGSTEXTUREMATERIAL_H
17#define QGSTEXTUREMATERIAL_H
18
19#include "qgis.h"
20#include "qgis_3d.h"
21#include "qgsmaterial.h"
22
23#include <QObject>
24
25#define SIP_NO_FILE
26
27class QMatrix4x4;
28
29
30// adapted from Qt's qtexturematerial.h
31namespace Qt3DRender
32{
33
34 class QFilterKey;
35 class QAbstractTexture;
36 class QTechnique;
37 class QParameter;
38 class QShaderProgram;
39 class QRenderPass;
40
41} // namespace Qt3DRender
42
44
50class _3D_EXPORT QgsTextureMaterial : public QgsMaterial
51{
52 Q_OBJECT
53
54 public:
58 explicit QgsTextureMaterial( Qt3DCore::QNode *parent = nullptr );
59 ~QgsTextureMaterial() override;
60
61 Qt3DRender::QAbstractTexture *texture() const;
62
68 void setInstancingEnabled( bool enabled, Qgis::InstancedMaterialFlags flags );
69
74 void setInstancingMeshTransform( const QMatrix4x4 &transform );
75
76 public slots:
77
84 void setTexture( Qt3DRender::QAbstractTexture *texture );
85
86 private:
87 void init();
88
89 Qt3DRender::QParameter *mTextureParameter = nullptr;
90 Qt3DRender::QTechnique *mGL3Technique = nullptr;
91 Qt3DRender::QRenderPass *mGL3RenderPass = nullptr;
92 Qt3DRender::QShaderProgram *mGL3Shader = nullptr;
93 Qt3DRender::QFilterKey *mFilterKey = nullptr;
94 bool mInstanced = false;
95 Qgis::InstancedMaterialFlags mInstanceFlags;
96 Qt3DRender::QParameter *mTransformParameter = nullptr;
97};
98
100
101#endif // QGSTEXTUREMATERIAL_H
QFlags< InstancedMaterialFlag > InstancedMaterialFlags
Definition qgis.h:4398
Base class for all materials used within QGIS 3D views.
Definition qgsmaterial.h:40