QGIS API Documentation 3.41.0-Master (cea29feecf2)
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 QgsShadowSettings() = default;
39 QgsShadowSettings &operator=( QgsShadowSettings const &rhs );
40
42 void readXml( const QDomElement &element, const QgsReadWriteContext &context );
44 void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
45
47 bool renderShadows() const { return mRenderShadows; }
49 int selectedDirectionalLight() const { return mSelectedDirectionalLight; }
50
57 double maximumShadowRenderingDistance() const { return mMaximumShadowRenderingDistance; }
58
64 double shadowBias() const { return mShadowBias; }
65
70 int shadowMapResolution() const { return mShadowMapResolution; }
71
73 void setRenderShadows( bool enabled ) { mRenderShadows = enabled; }
75 void setSelectedDirectionalLight( int selectedLight ) { mSelectedDirectionalLight = selectedLight; }
76
83 void setMaximumShadowRenderingDistance( double distance ) { mMaximumShadowRenderingDistance = distance; }
84
91 void setShadowBias( double shadowBias ) { mShadowBias = shadowBias; }
92
97 void setShadowMapResolution( int resolution ) { mShadowMapResolution = resolution; }
98
99 private:
100 bool mRenderShadows = false;
101 int mSelectedDirectionalLight = 0;
102 double mMaximumShadowRenderingDistance = 1500.0;
103 double mShadowBias = 0.00001;
104 int mShadowMapResolution = 2048;
105};
106
107#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...