Back to index

salome-geom  6.5.0
Material_Model.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File   : Material_Model.h
00021 // Author : Margarita KARPUNINA, Open CASCADE S.A.S. (margarita.karpunina@opencascade.com)
00022 //
00023 #ifndef MATERIAL_MODEL_H
00024 #define MATERIAL_MODEL_H
00025 
00026 #include "Material.h"
00027 
00028 #include <QColor>
00029 #include <QMap>
00030 #include <QString>
00031 #include <QVector>
00032 
00033 #include <Graphic3d_MaterialAspect.hxx>
00034 
00035 class QtxResourceMgr;
00036 class GEOM_VTKPropertyMaterial;
00037 
00038 class MATERIAL_SALOME_EXPORT Material_Model
00039 {
00040 public:
00042   typedef enum {
00043     Ambient,  
00044     Diffuse,  
00045     Specular, 
00046     Emissive  
00047   } ReflectionType;
00048 
00049   Material_Model();
00050   virtual ~Material_Model();
00051 
00052   void                fromProperties( const QString& );
00053   QString             toProperties();
00054   void                fromResources( const QString& = QString(), QtxResourceMgr* = 0 );
00055   void                toResources( const QString&, QtxResourceMgr* );
00056 
00057   bool                isPhysical() const;
00058   void                setPhysical( bool );
00059 
00060   bool                hasReflection( ReflectionType ) const;
00061   void                setReflection( ReflectionType, bool );
00062 
00063   QColor              color( ReflectionType ) const;
00064   void                setColor( ReflectionType, const QColor& );
00065 
00066   double              reflection( ReflectionType ) const;
00067   void                setReflection( ReflectionType, double );
00068 
00069   double              shininess() const;
00070   void                setShininess( double );
00071 
00072   double              transparency() const;
00073   void                setTransparency( double );
00074 
00075   Graphic3d_MaterialAspect  getMaterialOCCAspect();
00076   GEOM_VTKPropertyMaterial* getMaterialVTKProperty();
00077 
00078 private:
00079   void                init();
00080 
00081 private:
00082   typedef struct {
00083     QColor color;
00084     double coef;
00085     bool   enabled;
00086   } ReflectionData;
00087 
00088   typedef QVector<ReflectionData> ReflectionList;
00089 
00090   bool                myIsPhysical;
00091   double              myShininess;
00092   double              myTransparency;
00093   ReflectionList      myReflection;
00094 };
00095 
00096 #endif // MATERIAL_MODEL_H