00001 #ifndef MATERIAL_H_INCLUDED
00002 #define MATERIAL_H_INCLUDED
00003
00004 #include "CGLA/Vec4f.h"
00005 #include "Component.h"
00006 #include "includeGL.h"
00007
00008
00009
00010 class GLSLShader;
00011 class Texture;
00012
00013
00014
00015 using namespace CGLA;
00016
00017 enum ColorEnum {
00018 RED,
00019 BLUE,
00020 GREEN,
00021 YELLOW,
00022 BLACK,
00023 WHITE
00024 };
00025
00026
00027 class Material:public Component{
00028 public :
00029 static const RTTI TYPE;
00030 virtual const RTTI& getType() const{ return TYPE; }
00031
00032 private:
00033 Vec4f color;
00034 Vec4f ambient;
00035 Vec4f diffuse;
00036 Vec4f specular;
00037 float shininess;
00038 Texture* texture;
00039 GLSLShader *shader;
00040
00041 public:
00042 Material();
00043 ~Material();
00044
00045 Material(ColorEnum Color);
00046 Material(const Vec4f& Color);
00047
00048 void setTexture(Texture* tex);
00049 void setShader(GLSLShader* Shader);
00050
00051 void setMaterialState(bool receives_shadow)const;
00052
00053 private:
00054
00055 friend class boost::serialization::access;
00056 template<class Archive>
00057 void serialize(Archive& ar, const unsigned int version){
00058
00059 ar & boost::serialization::base_object<Component>(*this);
00060 ar & color;
00061 ar & ambient;
00062 ar & diffuse;
00063 ar & specular;
00064 ar & shininess;
00065 ar & texture;
00066 ar & shader;
00067 }
00068
00069 };
00070
00071 #endif // MATERIAL_H_INCLUDED