QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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:
38  QgsShadowSettings() = default;
40  QgsShadowSettings( const QgsShadowSettings &other );
42  QgsShadowSettings &operator=( QgsShadowSettings const &rhs );
43 
45  void readXml( const QDomElement &element, const QgsReadWriteContext &context );
47  void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
48 
50  bool renderShadows() const { return mRenderShadows; }
52  int selectedDirectionalLight() const { return mSelectedDirectionalLight; }
53 
60  double maximumShadowRenderingDistance() const { return mMaximumShadowRenderingDistance; }
61 
67  double shadowBias() const { return mShadowBias; }
68 
73  int shadowMapResolution() const { return mShadowMapResolution; }
74 
76  void setRenderShadows( bool enabled ) { mRenderShadows = enabled; }
78  void setSelectedDirectionalLight( int selectedLight ) { mSelectedDirectionalLight = selectedLight; }
79 
86  void setMaximumShadowRenderingDistance( double distance ) { mMaximumShadowRenderingDistance = distance; }
87 
94  void setShadowBias( double shadowBias ) { mShadowBias = shadowBias; }
95 
100  void setShadowMapResolution( int resolution ) { mShadowMapResolution = resolution; }
101 
102  private:
103  bool mRenderShadows = false;
104  int mSelectedDirectionalLight = 0;
105  double mMaximumShadowRenderingDistance = 1500.0;
106  double mShadowBias = 0.00001;
107  int mShadowMapResolution = 2048;
108 };
109 
110 #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:60
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
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:94
QgsShadowSettings::shadowMapResolution
int shadowMapResolution() const
Returns the resolution of the shadow map texture used to generate the shadows.
Definition: qgsshadowsettings.h:73
QgsShadowSettings::setMaximumShadowRenderingDistance
void setMaximumShadowRenderingDistance(double distance)
Sets the maximum shadow rendering distance accounted for when rendering shadows Objects further away ...
Definition: qgsshadowsettings.h:86
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:100
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:67
QgsShadowSettings::renderShadows
bool renderShadows() const
Returns whether shadow rendering is enabled.
Definition: qgsshadowsettings.h:50
QgsShadowSettings::selectedDirectionalLight
int selectedDirectionalLight() const
Returns the selected direcctional light used to cast shadows.
Definition: qgsshadowsettings.h:52
QgsShadowSettings
class containing the configuration of shadows rendering
Definition: qgsshadowsettings.h:34
QgsShadowSettings::setSelectedDirectionalLight
void setSelectedDirectionalLight(int selectedLight)
Sets which directional light is used to generate shadows.
Definition: qgsshadowsettings.h:78
QgsShadowSettings::setRenderShadows
void setRenderShadows(bool enabled)
Sets whether shadow rendering is enabled.
Definition: qgsshadowsettings.h:76