Version: 9.12.0
Material_Model.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 // File : Material_Model.h
21 // Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
22 //
23 #ifndef MATERIAL_MODEL_H
24 #define MATERIAL_MODEL_H
25 
26 #include "Material.h"
27 
28 #include <QColor>
29 #include <QMap>
30 #include <QString>
31 #include <QVector>
32 
33 #include <Graphic3d_MaterialAspect.hxx>
34 
37 
39 {
40 public:
42  typedef enum {
46  Emissive
47  } ReflectionType;
48 
50  virtual ~Material_Model();
51 
52  void fromProperties( const QString& );
53  QString toProperties();
54  void fromResources( const QString& = QString(), Material_ResourceMgr* = 0 );
55  void toResources( const QString&, Material_ResourceMgr* );
56 
57  bool isPhysical() const;
58  void setPhysical( bool );
59 
60  bool hasReflection( ReflectionType ) const;
61  void setReflection( ReflectionType, bool );
62 
63  QColor color( ReflectionType ) const;
64  void setColor( ReflectionType, const QColor& );
65 
66  double reflection( ReflectionType, bool = true ) const;
67  void setReflection( ReflectionType, double, bool = true );
68 
69  double shininess( bool = true) const;
70  void setShininess( double, bool = true );
71 
72  double transparency() const;
73  void setTransparency( double );
74 
75  Graphic3d_MaterialAspect getMaterialOCCAspect( bool = true );
76  GEOM_VTKPropertyMaterial* getMaterialVTKProperty( bool = true );
77 
78 private:
79  void init();
80  void read( const QString&, Material_ResourceMgr* );
81 
82 private:
83  typedef struct {
84  QColor color;
85  double front_coef;
86  double back_coef;
87  bool enabled;
89 
90  typedef QVector<ReflectionData> ReflectionList;
91 
97 };
98 
99 #endif // MATERIAL_MODEL_H
#define MATERIAL_SALOME_EXPORT
Definition: Material.h:33
Definition: GEOM_VTKPropertyMaterial.hxx:34
Definition: Material_Model.h:39
ReflectionList myReflection
Definition: Material_Model.h:96
double myBackShininess
Definition: Material_Model.h:94
double myTransparency
Definition: Material_Model.h:95
QVector< ReflectionData > ReflectionList
Definition: Material_Model.h:90
@ Specular
Specular.
Definition: Material_Model.h:45
@ Diffuse
Diffuse.
Definition: Material_Model.h:44
@ Ambient
Ambient.
Definition: Material_Model.h:43
bool myIsPhysical
Definition: Material_Model.h:92
double myFrontShininess
Definition: Material_Model.h:93
Material properties resources manager.
Definition: Material_ResourceMgr.h:35
Definition: Material_Model.h:83
double front_coef
Definition: Material_Model.h:85
QColor color
Definition: Material_Model.h:84
double back_coef
Definition: Material_Model.h:86
bool enabled
Definition: Material_Model.h:87