QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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:
38 QgsShadowSettings() = default;
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
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
Default constructor.
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...