QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsshadowsettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsshadowsettings.h
3  --------------------------------------
4  Date : September 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 QGSSHADOWSETTINGS_H
17 #define QGSSHADOWSETTINGS_H
18 
19 #include <QString>
20 #include <QMap>
21 
22 #include "qgis_3d.h"
23 
25 class QDomElement;
26 
27 #define SIP_NO_FILE
28 
34 class _3D_EXPORT QgsShadowSettings
35 {
36  public:
37 
39  void readXml( const QDomElement &element, const QgsReadWriteContext &context );
41  void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
42 
44  bool renderShadows() const { return mRenderShadows; }
46  int selectedDirectionalLight() const { return mSelectedDirectionalLight; }
47 
54  double maximumShadowRenderingDistance() const { return mMaximumShadowRenderingDistance; }
55 
61  double shadowBias() const { return mShadowBias; }
62 
67  int shadowMapResolution() const { return mShadowMapResolution; }
68 
70  void setRenderShadows( bool enabled ) { mRenderShadows = enabled; }
72  void setSelectedDirectionalLight( int selectedLight ) { mSelectedDirectionalLight = selectedLight; }
73 
80  void setMaximumShadowRenderingDistance( double distance ) { mMaximumShadowRenderingDistance = distance; }
81 
88  void setShadowBias( double shadowBias ) { mShadowBias = shadowBias; }
89 
94  void setShadowMapResolution( int resolution ) { mShadowMapResolution = resolution; }
95 
96  private:
97  bool mRenderShadows = false;
98  int mSelectedDirectionalLight = -1;
99  double mMaximumShadowRenderingDistance = 500.0;
100  double mShadowBias = 0.00001;
101  int mShadowMapResolution = 2048;
102 };
103 
104 #endif // QGSSKYBOXSETTINGS_H
QgsShadowSettings::maximumShadowRenderingDistance
double maximumShadowRenderingDistance() const
Returns the maximum shadow rendering distance accounted for when rendering shadows Objects further aw...
Definition: qgsshadowsettings.h:54
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:35
QgsShadowSettings::setShadowBias
void setShadowBias(double shadowBias)
Sets the shadow bias value Tweak this to reduce artifacts like self shadowing A reasonable range of v...
Definition: qgsshadowsettings.h:88
QgsShadowSettings::shadowMapResolution
int shadowMapResolution() const
Returns the resolution of the shadow map texture used to generate the shadows.
Definition: qgsshadowsettings.h:67
QgsShadowSettings::setMaximumShadowRenderingDistance
void setMaximumShadowRenderingDistance(double distance)
Sets the maximum shadow rendering distance accounted for when rendering shadows Objects further away ...
Definition: qgsshadowsettings.h:80
QgsShadowSettings::setShadowMapResolution
void setShadowMapResolution(int resolution)
Sets the resolution of the shadow map texture (this can be used to generate higher quality shadows)
Definition: qgsshadowsettings.h:94
QgsShadowSettings::shadowBias
double shadowBias() const
Returns the shadow bias used to correct the numerical imprecision of shadows (for the depth test) Thi...
Definition: qgsshadowsettings.h:61
QgsShadowSettings::renderShadows
bool renderShadows() const
Returns whether shadow rendering is enabled.
Definition: qgsshadowsettings.h:44
QgsShadowSettings::selectedDirectionalLight
int selectedDirectionalLight() const
Returns the selected direcctional light used to cast shadows.
Definition: qgsshadowsettings.h:46
QgsShadowSettings
class containing the configuration of shadows rendering 3
Definition: qgsshadowsettings.h:35
QgsShadowSettings::setSelectedDirectionalLight
void setSelectedDirectionalLight(int selectedLight)
Sets which directional light is used to generate shadows.
Definition: qgsshadowsettings.h:72
QgsShadowSettings::setRenderShadows
void setRenderShadows(bool enabled)
Sets whether shadow rendering is enabled.
Definition: qgsshadowsettings.h:70