00001 /* Copyright (C) 2001 W.P. van Paassen - peter@paassen.tmfweb.nl 00002 00003 This program is free software; you can redistribute it and/or modify it under 00004 the terms of the GNU General Public License as published by the Free 00005 Software Foundation; either version 2 of the License, or (at your 00006 option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, but WITHOUT 00009 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00010 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00011 for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; see the file COPYING. If not, write to the Free 00015 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 00016 00017 #ifndef WP_MATERIAL_H 00018 #define WP_MATERIAL_H 00019 00020 #include "WP_Def.h" 00021 #include "WP_Color.h" 00022 00023 namespace WPCG 00024 { 00043 class WP_Material 00044 { 00045 public: 00046 00047 WP_Material(); 00048 ~WP_Material(); 00049 00055 WP_Material& operator=(const WP_Material& m); 00056 00060 void setDefault(); 00061 00065 void initMaterialGL() const; 00066 00070 void setTransparency(scalar t) 00071 { 00072 transparency = t; 00073 ambient.components[3] = 1.0 - t; 00074 diffuse.components[3] = ambient.components[3]; 00075 specular.components[3] = ambient.components[3]; 00076 emissive.components[3] = ambient.components[3]; 00077 }; 00078 00082 WP_Color ambient; 00083 00087 WP_Color diffuse; 00088 00092 WP_Color specular; 00093 00097 WP_Color emissive; 00098 00102 scalar specularExponent; 00103 00107 scalar transparency; 00108 }; 00109 } 00110 #endif 00111