IvfMaterial.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _CIvfMaterial_h_
00026 #define _CIvfMaterial_h_
00027 
00028 #include <ivf/IvfObject.h>
00029 
00030 IvfSmartPointer(CIvfMaterial);
00031 
00040 class IVF_API CIvfMaterial : public CIvfObject {
00041 public:
00042         bool getColorMaterial();
00043         void setColorMaterial(bool flag);
00045         CIvfMaterial ();
00046 
00048         virtual ~CIvfMaterial ();
00049 
00050         IvfClassInfo("CIvfMaterial",CIvfObject);
00051 
00058         void setShininess(float shininess);
00059 
00061         void getShininess(float &shininess);
00062 
00073         void setEmissionColor(const float red, const float green, const float blue, const float alfa);
00075         void getEmissionColor(float &red, float &green, float &blue, float &alfa);
00076         
00087         void setDiffuseColor (const float red, const float green, const float blue, const float alfa);
00088         
00090         void getDiffuseColor (float &red, float &green, float &blue, float &alfa);
00091         
00102         void setSpecularColor (const float red, const float green, const float blue, const float alfa);
00103         
00105         void getSpecularColor (float &red, float &green, float &blue, float &alfa);
00106         
00117         void setAmbientColor (const float red, const float green, const float blue, const float alfa);
00118         
00120         void getAmbientColor (float &red, float &green, float &blue, float &alfa);
00121 
00123         void setAlphaValue(float alpha);
00124         
00125         void multiplyColor(double factor);
00126         void multiplyEmission(double factor);
00127         void multiplyAmbient(double factor);
00128         void multiplyDiffuse(double factor);
00129         void multiplySpecular(double factor);
00130         void assignFrom(CIvfMaterial* material);
00131         void brightnessEmission(double factor);
00132         void brightnessAmbient(double factor);
00133         void brightnessDiffuse(double factor);
00134         void brightnessSpecular(double factor);
00135 
00136 private:
00137         float   m_shininess;
00138         float   m_diffuseColor[4];
00139         float   m_specularColor[4];
00140         float   m_ambientColor[4];
00141         float   m_emissionColor[4];
00142 
00143         bool m_colorMaterial;
00144 
00145         void modifyBrightness(float* color, double factor);
00146         void toGreyscale(float* color, float* grey);
00147 protected:
00148         virtual void createMaterial();
00149 };
00150 #endif

Generated on Fri Sep 1 15:36:45 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO