QGIS API Documentation 4.1.0-Master (9af12b5a203)
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 "qgis.h"
20#include "qgis_3d.h"
21
22#include <QMap>
23#include <QString>
24
25#define SIP_NO_FILE
26
28class QDomElement;
29
30
36class _3D_EXPORT QgsShadowSettings
37{
38 public:
39 QgsShadowSettings() = default;
42
44 void readXml( const QDomElement &element, const QgsReadWriteContext &context );
46 void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
47
49 bool renderShadows() const { return mRenderShadows; }
51 int selectedDirectionalLight() const { return mSelectedDirectionalLight; }
52
59 double maximumShadowRenderingDistance() const { return mMaximumShadowRenderingDistance; }
60
66 double shadowBias() const { return mShadowBias; }
67
74 Qgis::ShadowQuality shadowQuality() const { return mShadowQuality; }
75
77 void setRenderShadows( bool enabled ) { mRenderShadows = enabled; }
79 void setSelectedDirectionalLight( int selectedLight ) { mSelectedDirectionalLight = selectedLight; }
80
87 void setMaximumShadowRenderingDistance( double distance ) { mMaximumShadowRenderingDistance = distance; }
88
95 void setShadowBias( double shadowBias ) { mShadowBias = shadowBias; }
96
103 void setShadowQuality( Qgis::ShadowQuality quality ) { mShadowQuality = quality; }
104
110 static int qualityToMapResolution( Qgis::ShadowQuality quality );
111
119 bool showCascadeSplits() const;
120
128 void setShowCascadeSplits( bool show );
129
130 private:
131 bool mRenderShadows = false;
132 int mSelectedDirectionalLight = 0;
133 double mMaximumShadowRenderingDistance = 1500.0;
134 double mShadowBias = 0.00001;
136 bool mShowCascadeSplits = false;
137};
138
139#endif // QGSSKYBOXSETTINGS_H
ShadowQuality
Shadow texture quality.
Definition qgis.h:4389
@ High
High quality.
Definition qgis.h:4392
A container for the context for various read/write operations on objects.
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.
QgsShadowSettings & operator=(QgsShadowSettings const &rhs)
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 setShadowQuality(Qgis::ShadowQuality quality)
Sets the quality of the shadow map texture.
void setRenderShadows(bool enabled)
Sets whether shadow rendering is enabled.
void writeXml(QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to a DOM element.
double shadowBias() const
Returns the shadow bias used to correct the numerical imprecision of shadows (for the depth test) Thi...
Qgis::ShadowQuality shadowQuality() const
Returns the quality of the shadow map texture used to generate the shadows.
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from a DOM element.
void setShadowBias(double shadowBias)
Sets the shadow bias value Tweak this to reduce artifacts like self shadowing A reasonable range of v...