QGIS API Documentation 3.99.0-Master (a8f284845db)
Loading...
Searching...
No Matches
qgsskyboxentity.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsskyboxentity.h
3 --------------------------------------
4 Date : August 2020
5 Copyright : (C) 2020 by Belgacem Nedjima
6 Email : gb uderscore nedjima at esi dot dz
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 QGSSKYBOXENTITY_H
17#define QGSSKYBOXENTITY_H
18
19#include "qgis_3d.h"
20
21#include <QMap>
22#include <QString>
23#include <QVector>
24#include <Qt3DCore/QEntity>
25#include <Qt3DRender/QTexture>
26
27#define SIP_NO_FILE
28
29namespace Qt3DExtras
30{
31 class QCuboidMesh;
32}
33
34namespace Qt3DRender
35{
36 class QEffect;
37 class QFilterKey;
38 class QMaterial;
39 class QParameter;
40 class QRenderPass;
41 class QShaderProgram;
42 class QTechnique;
43 class QTexture;
44} //namespace Qt3DRender
45
46class QgsImageTexture;
47
48
56class _3D_EXPORT QgsSkyboxEntity : public Qt3DCore::QEntity
57{
58 Q_OBJECT
59 public:
66
67 public:
69 QgsSkyboxEntity( QNode *parent = nullptr );
70
72 virtual SkyboxType type() const = 0;
73
74 protected:
75 Qt3DRender::QEffect *mEffect = nullptr;
76 Qt3DRender::QMaterial *mMaterial = nullptr;
77 Qt3DRender::QTechnique *mGl3Technique = nullptr;
78 Qt3DRender::QFilterKey *mFilterKey = nullptr;
79 Qt3DRender::QRenderPass *mGl3RenderPass = nullptr;
80 Qt3DExtras::QCuboidMesh *mMesh = nullptr;
81 Qt3DRender::QParameter *mGammaStrengthParameter = nullptr;
82 Qt3DRender::QParameter *mTextureParameter = nullptr;
83};
84
92{
93 Q_OBJECT
94
95 public:
97 QgsPanoramicSkyboxEntity( const QString &texturePath, Qt3DCore::QNode *parent = nullptr );
98
100 QString texturePath() const { return mTexturePath; }
102 SkyboxType type() const override { return SkyboxType::PanoramicSkybox; }
103
104 private:
105 void reloadTexture();
106
107 private:
108 QString mTexturePath;
109 Qt3DRender::QTextureLoader *mLoadedTexture = nullptr;
110 Qt3DRender::QShaderProgram *mGlShader = nullptr;
111};
112
120{
121 Q_OBJECT
122
123 public:
125 QgsCubeFacesSkyboxEntity( const QString &posX, const QString &posY, const QString &posZ, const QString &negX, const QString &negY, const QString &negZ, Qt3DCore::QNode *parent = nullptr );
126
129
130 private:
131 void init();
132 void reloadTexture();
133
134 private:
135 QMap<Qt3DRender::QTextureCubeMap::CubeMapFace, QString> mCubeFacesPaths;
136 Qt3DRender::QShaderProgram *mGlShader = nullptr;
137 QVector<Qt3DRender::QTextureImage *> mFacesTextureImages;
138 Qt3DRender::QTextureCubeMap *mCubeMap = nullptr;
139};
140
141#endif // QGSSKYBOXENTITY_H
QgsCubeFacesSkyboxEntity(const QString &posX, const QString &posY, const QString &posZ, const QString &negX, const QString &negY, const QString &negZ, Qt3DCore::QNode *parent=nullptr)
Constructs a skybox from 6 different images.
SkyboxType type() const override
Returns the type of the current skybox.
Holds an image that can be used as a texture in the 3D view.
QgsPanoramicSkyboxEntity(const QString &texturePath, Qt3DCore::QNode *parent=nullptr)
Construct a skybox from a panoramic 360 image.
QString texturePath() const
Returns the path of the current texture in use.
SkyboxType type() const override
Returns the type of the current skybox.
Base class for all skybox types.
QgsSkyboxEntity(QNode *parent=nullptr)
Constructor.
Qt3DRender::QRenderPass * mGl3RenderPass
virtual SkyboxType type() const =0
Returns the type of the current skybox.
SkyboxType
Skybox type enumeration.
Qt3DRender::QParameter * mGammaStrengthParameter
Qt3DRender::QFilterKey * mFilterKey
Qt3DRender::QEffect * mEffect
Qt3DExtras::QCuboidMesh * mMesh
Qt3DRender::QParameter * mTextureParameter
Qt3DRender::QMaterial * mMaterial
Qt3DRender::QTechnique * mGl3Technique