QGIS API Documentation  3.6.0-Noosa (5873452)
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
float shininess() const
Returns shininess of the surface.
QColor specular() const
Returns specular color component.
3 Basic shading material used for rendering based on the Phong shading model with three color compone...
bool operator==(const QgsPhongMaterialSettings &other) const
void setShininess(float shininess)
Sets shininess of the surface.
QColor ambient() const
Returns ambient color component.
void setDiffuse(const QColor &diffuse)
Sets diffuse color component.
QColor diffuse() const
Returns diffuse color component.
void setAmbient(const QColor &ambient)
Sets ambient color component.
void setSpecular(const QColor &specular)
Sets specular color component.