QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgspointlightsettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspointlightsettings.h
3  --------------------------------------
4  Date : November 2018
5  Copyright : (C) 2018 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
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 QGSPOINTLIGHTSETTINGS_H
17 #define QGSPOINTLIGHTSETTINGS_H
18 
19 #include "qgis_3d.h"
20 
21 #include "qgsvector3d.h"
22 #include <QColor>
23 
24 class QDomDocument;
25 class QDomElement;
26 
38 class _3D_EXPORT QgsPointLightSettings
39 {
40  public:
42  QgsPointLightSettings() = default;
43 
45  QgsVector3D position() const { return mPosition; }
47  void setPosition( const QgsVector3D &pos ) { mPosition = pos; }
48 
50  QColor color() const { return mColor; }
52  void setColor( const QColor &color ) { mColor = color; }
53 
55  float intensity() const { return mIntensity; }
57  void setIntensity( float intensity ) { mIntensity = intensity; }
58 
60  float constantAttenuation() const { return mConstantAttenuation; }
62  void setConstantAttenuation( float value ) { mConstantAttenuation = value; }
63 
65  float linearAttenuation() const { return mLinearAttenuation; }
67  void setLinearAttenuation( float value ) { mLinearAttenuation = value; }
68 
70  float quadraticAttenuation() const { return mQuadraticAttenuation; }
72  void setQuadraticAttenuation( float value ) { mQuadraticAttenuation = value; }
73 
75  QDomElement writeXml( QDomDocument &doc ) const;
77  void readXml( const QDomElement &elem );
78 
79  bool operator==( const QgsPointLightSettings &other );
80 
81  private:
82  QgsVector3D mPosition;
83  QColor mColor = Qt::white;
84  float mIntensity = 0.5;
85  float mConstantAttenuation = 1.0f;
86  float mLinearAttenuation = 0.0f;
87  float mQuadraticAttenuation = 0.0f;
88 };
89 
90 #endif // QGSPOINTLIGHTSETTINGS_H
QgsPointLightSettings::constantAttenuation
float constantAttenuation() const
Returns constant attenuation (A_0)
Definition: qgspointlightsettings.h:60
QgsPointLightSettings::setIntensity
void setIntensity(float intensity)
Sets intensity of the light.
Definition: qgspointlightsettings.h:57
QgsPointLightSettings::position
QgsVector3D position() const
Returns position of the light (in 3D world coordinates)
Definition: qgspointlightsettings.h:45
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:399
QgsVector3D
Definition: qgsvector3d.h:31
QgsPointLightSettings::setPosition
void setPosition(const QgsVector3D &pos)
Sets position of the light (in 3D world coordinates)
Definition: qgspointlightsettings.h:47
QgsPointLightSettings::color
QColor color() const
Returns color of the light.
Definition: qgspointlightsettings.h:50
QgsPointLightSettings::setQuadraticAttenuation
void setQuadraticAttenuation(float value)
Sets quadratic attenuation (A_2)
Definition: qgspointlightsettings.h:72
QgsPointLightSettings::setColor
void setColor(const QColor &color)
Sets color of the light.
Definition: qgspointlightsettings.h:52
QgsPointLightSettings
Definition: qgspointlightsettings.h:38
QgsPointLightSettings::quadraticAttenuation
float quadraticAttenuation() const
Returns quadratic attenuation (A_2)
Definition: qgspointlightsettings.h:70
QgsPointLightSettings::intensity
float intensity() const
Returns intensity of the light.
Definition: qgspointlightsettings.h:55
qgsvector3d.h
QgsPointLightSettings::setConstantAttenuation
void setConstantAttenuation(float value)
Sets constant attenuation (A_0)
Definition: qgspointlightsettings.h:62
QgsPointLightSettings::linearAttenuation
float linearAttenuation() const
Returns linear attenuation (A_1)
Definition: qgspointlightsettings.h:65
QgsPointLightSettings::setLinearAttenuation
void setLinearAttenuation(float value)
Sets linear attenuation (A_1)
Definition: qgspointlightsettings.h:67