QGIS API Documentation 4.1.0-Master (ca2ac17535b)
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; }
50
57 QString lightSource() const { return mLightSourceId; }
58
65 double maximumShadowRenderingDistance() const { return mMaximumShadowRenderingDistance; }
66
72 double shadowBias() const { return mShadowBias; }
73
80 Qgis::ShadowQuality shadowQuality() const { return mShadowQuality; }
81
83 void setRenderShadows( bool enabled ) { mRenderShadows = enabled; }
84
91 void setLightSource( const QString &id ) { mLightSourceId = id; }
92
99 void setMaximumShadowRenderingDistance( double distance ) { mMaximumShadowRenderingDistance = distance; }
100
107 void setShadowBias( double shadowBias ) { mShadowBias = shadowBias; }
108
115 void setShadowQuality( Qgis::ShadowQuality quality ) { mShadowQuality = quality; }
116
122 static int qualityToMapResolution( Qgis::ShadowQuality quality );
123
131 bool showCascadeSplits() const;
132
140 void setShowCascadeSplits( bool show );
141
142 private:
143 bool mRenderShadows = false;
144 QString mLightSourceId;
145 double mMaximumShadowRenderingDistance = 1500.0;
146 double mShadowBias = 0.00001;
148 bool mShowCascadeSplits = false;
149};
150
151#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.
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.
void setLightSource(const QString &id)
Sets the id of the light source casting shadows.
QgsShadowSettings & operator=(QgsShadowSettings const &rhs)
QgsShadowSettings()=default
double maximumShadowRenderingDistance() const
Returns the maximum shadow rendering distance accounted for when rendering shadows Objects further aw...
QString lightSource() const
Returns the ID of the light source casting 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...