QGIS API Documentation  3.2.0-Bonn (bc43194)
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 
31 class _3D_EXPORT QgsPhongMaterialSettings
32 {
33  public:
35  : mAmbient( QColor::fromRgbF( 0.1f, 0.1f, 0.1f, 1.0f ) )
36  , mDiffuse( QColor::fromRgbF( 0.7f, 0.7f, 0.7f, 1.0f ) )
37  , mSpecular( QColor::fromRgbF( 1.0f, 1.0f, 1.0f, 1.0f ) )
38  {
39  }
40 
42  QColor ambient() const { return mAmbient; }
44  QColor diffuse() const { return mDiffuse; }
46  QColor specular() const { return mSpecular; }
48  float shininess() const { return mShininess; }
49 
51  void setAmbient( const QColor &ambient ) { mAmbient = ambient; }
53  void setDiffuse( const QColor &diffuse ) { mDiffuse = diffuse; }
55  void setSpecular( const QColor &specular ) { mSpecular = specular; }
57  void setShininess( float shininess ) { mShininess = shininess; }
58 
60  void readXml( const QDomElement &elem );
62  void writeXml( QDomElement &elem ) const;
63 
64  private:
65  QColor mAmbient;
66  QColor mDiffuse;
67  QColor mSpecular;
68  float mShininess = 0.0f;
69 };
70 
71 
72 #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...
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.