QGIS API Documentation 4.1.0-Master (0cdd3ae6384)
Loading...
Searching...
No Matches
qgs3d.h
Go to the documentation of this file.
1/***************************************************************************
2 qgs3d.h
3 --------
4 begin : July 2020
5 copyright : (C) 2020 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGS3D_H
19#define QGS3D_H
20
21#include <memory>
22
23#include "qgis.h"
24#include "qgis_3d.h"
25#include "qgis_sip.h"
26
31class QgsMaterial;
33class QgsUnlitMaterial;
36template<class T> class QgsSettingsEntryEnumFlag;
37
38#ifndef SIP_RUN
39namespace Qt3DCore
40{
41 class QGeometry;
42}
43
44namespace Qt3DRender
45{
46 class QEffect;
47}
48#endif
49
56class _3D_EXPORT Qgs3D
57{
58 public:
62
63 Qgs3D( const Qgs3D &other ) = delete;
64 Qgs3D &operator=( const Qgs3D &other ) = delete;
65
69 static Qgs3D *instance();
70
71 ~Qgs3D();
72
76 static void initialize();
77
82
87
88#ifndef SIP_RUN
97
104 static QgsUnlitMaterial *createHighlightMaterial();
105
110
111 // if you change this, also update the corresponding constant in shadows.inc.frag!
113 static constexpr int NUM_SHADOW_CASCADES = 4;
114
115#endif
116
117 private:
118 Qgs3D();
119
120#ifdef SIP_RUN
121 Qgs3D( const Qgs3D &other );
122#endif
123
124 bool mInitialized = false;
125
126 Qgs3DTerrainRegistry *mTerrainRegistry = nullptr;
127 std::unique_ptr< QgsAbstractMaterial3DHandler > mNullMaterialHandler;
128 std::unique_ptr< QgsAbstractMaterial3DHandler > mPhongMaterialHandler;
129 std::unique_ptr< QgsAbstractMaterial3DHandler > mPhongTexturedMaterialHandler;
130 std::unique_ptr< QgsAbstractMaterial3DHandler > mSimpleLineMaterialHandler;
131 std::unique_ptr< QgsAbstractMaterial3DHandler > mGoochMaterialHandler;
132 std::unique_ptr< QgsAbstractMaterial3DHandler > mMetalRoughMaterialHandler;
133 std::unique_ptr< QgsAbstractMaterial3DHandler > mMetalRoughTexturedMaterialHandler;
134};
135
136#endif // QGS3D_H
MaterialRenderingTechnique
Material rendering techniques.
Definition qgis.h:4375
Registry of available 3d terrain classes.
static void initialize()
Initializes the 3D framework.
Definition qgs3d.cpp:79
static Qgs3DTerrainRegistry * terrainRegistry()
Returns the terrain registry, used for managing 3D terrains.
Definition qgs3d.cpp:132
static const QgsSettingsEntryEnumFlag< Qgis::TextureFilterQuality > * settingTextureFilterQuality
Definition qgs3d.h:60
static QgsMaterial * toMaterial(const QgsAbstractMaterialSettings *settings, Qgis::MaterialRenderingTechnique technique, const QgsMaterialContext &context)
Creates a new QgsMaterial object representing the material settings.
Definition qgs3d.cpp:154
static const QgsSettingsEntryBool * settingMsaaEnabled
Definition qgs3d.h:59
static QgsMaterialRegistry * materialRegistry()
Returns the material registry, used for managing 3D materials.
Definition qgs3d.cpp:127
static Qgs3D * instance()
Returns a pointer to the singleton instance.
Definition qgs3d.cpp:62
static QgsUnlitMaterial * createHighlightMaterial()
Creates a new highlight material, consisting of an unlit material respecting the user's map highlight...
Definition qgs3d.cpp:163
static const QgsAbstractMaterial3DHandler * handlerForMaterialSettings(const QgsAbstractMaterialSettings *settings)
Returns the handler to use for a material settings.
Definition qgs3d.cpp:137
Qgs3D & operator=(const Qgs3D &other)=delete
static constexpr int NUM_SHADOW_CASCADES
Number of shadow map cascades.
Definition qgs3d.h:113
Qgs3D(const Qgs3D &other)=delete
static const QgsSettingsEntryEnumFlag< Qgis::ShadowQuality > * settingShadowQuality
Definition qgs3d.h:61
Abstract base class for material 3D handlers.
Abstract base class for material settings.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Context settings for a material.
Registry of available 3d material settings classes.
Base class for all materials used within QGIS 3D views.
Definition qgsmaterial.h:40
A boolean settings entry.
A template class for enum and flag settings entry.
#define SIP_SKIP
Definition qgis_sip.h:133