]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/Material/Material_Model.h
Salome HOME
0021672: [CEA 565] Dump Study from script
[modules/geom.git] / src / Material / Material_Model.h
index 8543e7a5cf49d0a77882d61699eb1bca5fce5644..3f3c8ff24695231fed5077aed4e5c3a1d8ba734a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <QColor>
 #include <QMap>
 #include <QString>
+#include <QVector>
 
-class Graphic3d_MaterialAspect;
-
-class vtkProperty;
+#include <Graphic3d_MaterialAspect.hxx>
 
 class QtxResourceMgr;
+class GEOM_VTKPropertyMaterial;
 
 class MATERIAL_SALOME_EXPORT Material_Model
 {
-
 public:
-
-  //! Enumeration of reflection types of material
+  //! Reflection type
   typedef enum {
     Ambient,  //!< Ambient 
     Diffuse,  //!< Diffuse
     Specular, //!< Specular
-    Emission  //!< Emission
+    Emissive  //!< Emissive
   } ReflectionType;
 
-
   Material_Model();
   virtual ~Material_Model();
 
-  static Material_Model* getMaterialModel( QStringList );
-
-  QString                getMaterialProperty();
-
-  Graphic3d_MaterialAspect getMaterialOCCAspect();
-  vtkProperty*             getMaterialVTKProperty();
+  void                fromProperties( const QString& );
+  QString             toProperties();
+  void                fromResources( const QString& = QString(), QtxResourceMgr* = 0 );
+  void                toResources( const QString&, QtxResourceMgr* );
 
-  void                initDefaults();
-  void                fromResources( QtxResourceMgr*, const QString& = QString(), bool theIsFront = true );
-  void                save( QtxResourceMgr* = 0, const QString& = QString(), bool theIsFront = true );
+  bool                isPhysical() const;
+  void                setPhysical( bool );
 
-  QtxResourceMgr*     resourceMgr() const;
-  QString             resourceSection( bool theIsFront ) const;
-
-  bool                hasAmbientReflection();
-  bool                hasDiffuseReflection();
-  bool                hasSpecularReflection();
-  bool                hasEmissionReflection();
+  bool                hasReflection( ReflectionType ) const;
+  void                setReflection( ReflectionType, bool );
 
   QColor              color( ReflectionType ) const;
   void                setColor( ReflectionType, const QColor& );
-  void                setColor( QString,
-                               QString,
-                               ReflectionType );
-  void                removeColor( ReflectionType );
-
-  double              coefficient( ReflectionType ) const;
-  void                setCoefficient( ReflectionType, double );  
-  void                setCoefficient( QString,
-                                     QString,
-                                     ReflectionType );
-  void                removeCoefficient( ReflectionType );
+
+  double              reflection( ReflectionType ) const;
+  void                setReflection( ReflectionType, double );
 
   double              shininess() const;
-  void                setShininess( double );  
+  void                setShininess( double );
 
-private:
-  void                clearModel();
+  double              transparency() const;
+  void                setTransparency( double );
+
+  Graphic3d_MaterialAspect  getMaterialOCCAspect();
+  GEOM_VTKPropertyMaterial* getMaterialVTKProperty();
 
 private:
-  typedef QMap<ReflectionType, QColor> ColorMap;
-  typedef QMap<ReflectionType, double> CoefficientMap;
+  void                init();
 
-  QtxResourceMgr*     myResourceMgr;
-  QString             myResourceSection;
+private:
+  typedef struct {
+    QColor color;
+    double coef;
+    bool   enabled;
+  } ReflectionData;
 
-  ColorMap            myColors;
-  CoefficientMap      myCoefficients;
+  typedef QVector<ReflectionData> ReflectionList;
 
+  bool                myIsPhysical;
   double              myShininess;
-
+  double              myTransparency;
+  ReflectionList      myReflection;
 };
 
 #endif // MATERIAL_MODEL_H