QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 "qgsvector3d.h"
20 #include <QColor>
21 
22 class QDomDocument;
23 class QDomElement;
24 
37 {
38  public:
40  QgsPointLightSettings() = default;
41 
43  QgsVector3D position() const { return mPosition; }
45  void setPosition( const QgsVector3D &pos ) { mPosition = pos; }
46 
48  QColor color() const { return mColor; }
50  void setColor( const QColor &color ) { mColor = color; }
51 
53  float intensity() const { return mIntensity; }
55  void setIntensity( float intensity ) { mIntensity = intensity; }
56 
58  float constantAttenuation() const { return mConstantAttenuation; }
60  void setConstantAttenuation( float value ) { mConstantAttenuation = value; }
61 
63  float linearAttenuation() const { return mLinearAttenuation; }
65  void setLinearAttenuation( float value ) { mLinearAttenuation = value; }
66 
68  float quadraticAttenuation() const { return mQuadraticAttenuation; }
70  void setQuadraticAttenuation( float value ) { mQuadraticAttenuation = value; }
71 
73  QDomElement writeXml( QDomDocument &doc ) const;
75  void readXml( const QDomElement &elem );
76 
77  bool operator==( const QgsPointLightSettings &other );
78 
79  private:
80  QgsVector3D mPosition;
81  QColor mColor = Qt::white;
82  float mIntensity = 0.5;
83  float mConstantAttenuation = 1.0f;
84  float mLinearAttenuation = 0.0f;
85  float mQuadraticAttenuation = 0.0f;
86 };
87 
88 #endif // QGSPOINTLIGHTSETTINGS_H
3 Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double preci...
Definition: qgsvector3d.h:31
float quadraticAttenuation() const
Returns quadratic attenuation (A_2)
void setLinearAttenuation(float value)
Sets linear attenuation (A_1)
QColor color() const
Returns color of the light.
QgsVector3D position() const
Returns position of the light (in 3D world coordinates)
float constantAttenuation() const
Returns constant attenuation (A_0)
QgsPointLightSettings()=default
Construct a point light with default values.
3 Definition of a point light in a 3D map scene
void setConstantAttenuation(float value)
Sets constant attenuation (A_0)
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element and returns it.
void setQuadraticAttenuation(float value)
Sets quadratic attenuation (A_2)
float intensity() const
Returns intensity of the light.
void setPosition(const QgsVector3D &pos)
Sets position of the light (in 3D world coordinates)
bool operator==(const QgsPointLightSettings &other)
void setColor(const QColor &color)
Sets color of the light.
float linearAttenuation() const
Returns linear attenuation (A_1)
void setIntensity(float intensity)
Sets intensity of the light.
void readXml(const QDomElement &elem)
Reads configuration from a DOM element previously written using writeXml()