QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
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
25class QDomElement;
26
27#define SIP_NO_FILE
28
34class _3D_EXPORT QgsShadowSettings
35{
36 public:
37
38 QgsShadowSettings() = default;
40 QgsShadowSettings &operator=( QgsShadowSettings const &rhs );
41
43 void readXml( const QDomElement &element, const QgsReadWriteContext &context );
45 void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
46
48 bool renderShadows() const { return mRenderShadows; }
50 int selectedDirectionalLight() const { return mSelectedDirectionalLight; }
51
58 double maximumShadowRenderingDistance() const { return mMaximumShadowRenderingDistance; }
59
65 double shadowBias() const { return mShadowBias; }
66
71 int shadowMapResolution() const { return mShadowMapResolution; }
72
74 void setRenderShadows( bool enabled ) { mRenderShadows = enabled; }
76 void setSelectedDirectionalLight( int selectedLight ) { mSelectedDirectionalLight = selectedLight; }
77
84 void setMaximumShadowRenderingDistance( double distance ) { mMaximumShadowRenderingDistance = distance; }
85
92 void setShadowBias( double shadowBias ) { mShadowBias = shadowBias; }
93
98 void setShadowMapResolution( int resolution ) { mShadowMapResolution = resolution; }
99
100 private:
101 bool mRenderShadows = false;
102 int mSelectedDirectionalLight = 0;
103 double mMaximumShadowRenderingDistance = 1500.0;
104 double mShadowBias = 0.00001;
105 int mShadowMapResolution = 2048;
106};
107
108#endif // QGSSKYBOXSETTINGS_H
The class is used as a container of context for various read/write operations on other objects.
class containing the configuration of shadows rendering 3
int selectedDirectionalLight() const
Returns the selected direcctional light used to cast shadows.
void setMaximumShadowRenderingDistance(double distance)
Sets the maximum shadow rendering distance accounted for when rendering shadows Objects further away ...
bool renderShadows() const
Returns whether shadow rendering is enabled.
int shadowMapResolution() const
Returns the resolution of the shadow map texture used to generate the shadows.
QgsShadowSettings()=default
double maximumShadowRenderingDistance() const
Returns the maximum shadow rendering distance accounted for when rendering shadows Objects further aw...
void setSelectedDirectionalLight(int selectedLight)
Sets which directional light is used to generate shadows.
void setRenderShadows(bool enabled)
Sets whether shadow rendering is enabled.
void setShadowMapResolution(int resolution)
Sets the resolution of the shadow map texture (this can be used to generate higher quality shadows)
double shadowBias() const
Returns the shadow bias used to correct the numerical imprecision of shadows (for the depth test) Thi...
void setShadowBias(double shadowBias)
Sets the shadow bias value Tweak this to reduce artifacts like self shadowing A reasonable range of v...