00001 #ifndef SHADER_H 00002 #define SHADER_H 00003 00004 00005 #include <vector> 00006 #include "Vec3f.h" 00007 #include "RGBAColor.h" 00008 #include "Ray.h" 00009 00010 class Scene; 00011 class Texture; 00012 00013 00018 class Shader 00019 { 00020 public: 00025 Shader(Scene * scene); 00026 00029 virtual ~Shader() 00030 { 00031 } 00032 00035 virtual RGBAColor shade(const Ray & ray) const = 0; 00036 00039 unsigned int textureCount() const; 00040 00043 void addTexture(Texture* tex); 00044 00047 void removeTexture(Texture* tex); 00048 00051 const Texture * texture(unsigned int i) const; 00052 00055 const Texture* bumpTexture() const; 00056 00059 void setBumpTexture(Texture* tex); 00060 00063 const Vec3f normal(const Ray & ray) const; 00064 00065 00068 void setBumpCoefficient(const float f) 00069 { 00070 mBumpCoeff = f; 00071 } 00072 00075 float bumpCoefficient() const 00076 { 00077 return mBumpCoeff; 00078 } 00079 00080 protected: 00082 Scene * mScene; 00083 00085 std::vector<Texture *> mTextures; 00086 00088 Texture* mBumpTexture; 00089 00091 float mBumpCoeff; 00092 }; 00093 00094 #endif 00095