QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsphongmaterialsettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsphongmaterialsettings.h
3  --------------------------------------
4  Date : July 2017
5  Copyright : (C) 2017 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 QGSPHONGMATERIALSETTINGS_H
17 #define QGSPHONGMATERIALSETTINGS_H
18 
19 #include "qgis_3d.h"
20 
21 #include <QColor>
22 
23 class QDomElement;
24 
35 class _3D_EXPORT QgsPhongMaterialSettings
36 {
37  public:
39  : mAmbient( QColor::fromRgbF( 0.1f, 0.1f, 0.1f, 1.0f ) )
40  , mDiffuse( QColor::fromRgbF( 0.7f, 0.7f, 0.7f, 1.0f ) )
41  , mSpecular( QColor::fromRgbF( 1.0f, 1.0f, 1.0f, 1.0f ) )
42  {
43  }
44 
46  QColor ambient() const { return mAmbient; }
48  QColor diffuse() const { return mDiffuse; }
50  QColor specular() const { return mSpecular; }
52  float shininess() const { return mShininess; }
53 
55  void setAmbient( const QColor &ambient ) { mAmbient = ambient; }
57  void setDiffuse( const QColor &diffuse ) { mDiffuse = diffuse; }
59  void setSpecular( const QColor &specular ) { mSpecular = specular; }
61  void setShininess( float shininess ) { mShininess = shininess; }
62 
64  void readXml( const QDomElement &elem );
66  void writeXml( QDomElement &elem ) const;
67 
68  bool operator==( const QgsPhongMaterialSettings &other ) const
69  {
70  return mAmbient == other.mAmbient &&
71  mDiffuse == other.mDiffuse &&
72  mSpecular == other.mSpecular &&
73  mShininess == other.mShininess;
74  }
75 
76  private:
77  QColor mAmbient;
78  QColor mDiffuse;
79  QColor mSpecular;
80  float mShininess = 0.0f;
81 };
82 
83 
84 #endif // QGSPHONGMATERIALSETTINGS_H
QgsPhongMaterialSettings::ambient
QColor ambient() const
Returns ambient color component.
Definition: qgsphongmaterialsettings.h:46
QgsPhongMaterialSettings::diffuse
QColor diffuse() const
Returns diffuse color component.
Definition: qgsphongmaterialsettings.h:48
QgsPhongMaterialSettings::specular
QColor specular() const
Returns specular color component.
Definition: qgsphongmaterialsettings.h:50
QgsPhongMaterialSettings::setSpecular
void setSpecular(const QColor &specular)
Sets specular color component.
Definition: qgsphongmaterialsettings.h:59
QgsPhongMaterialSettings
Definition: qgsphongmaterialsettings.h:35
QgsPhongMaterialSettings::operator==
bool operator==(const QgsPhongMaterialSettings &other) const
Definition: qgsphongmaterialsettings.h:68
QgsPhongMaterialSettings::setShininess
void setShininess(float shininess)
Sets shininess of the surface.
Definition: qgsphongmaterialsettings.h:61
QgsPhongMaterialSettings::setDiffuse
void setDiffuse(const QColor &diffuse)
Sets diffuse color component.
Definition: qgsphongmaterialsettings.h:57
QgsPhongMaterialSettings::setAmbient
void setAmbient(const QColor &ambient)
Sets ambient color component.
Definition: qgsphongmaterialsettings.h:55
QgsPhongMaterialSettings::QgsPhongMaterialSettings
QgsPhongMaterialSettings()
Definition: qgsphongmaterialsettings.h:38
QgsPhongMaterialSettings::shininess
float shininess() const
Returns shininess of the surface.
Definition: qgsphongmaterialsettings.h:52