X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fshader.hpp;h=ea5b84474223fab1da9bb8fd18ad1c7e859643c9;hb=1a7bbd64b1fef1f4e2f9303f820d6f3ce76cebf1;hp=c112c533e42109bca7e75ce2839c06f6e82eefa8;hpb=918b4955c28fad1836a57ab3e9e033448144996c;p=blank.git diff --git a/src/shader.hpp b/src/shader.hpp index c112c53..ea5b844 100644 --- a/src/shader.hpp +++ b/src/shader.hpp @@ -2,7 +2,9 @@ #define BLANK_SHADER_HPP_ #include +#include #include +#include namespace blank { @@ -41,6 +43,7 @@ public: Program(const Program &) = delete; Program &operator =(const Program &) = delete; + const Shader &LoadShader(GLenum type, const GLchar *src); void Attach(Shader &); void Link(); bool Linked() const; @@ -52,6 +55,44 @@ public: private: GLuint handle; + std::list shaders; + +}; + + +class DirectionalLighting { + +public: + DirectionalLighting(); + + void Activate(); + + void SetLightDirection(const glm::vec3 &); + + void SetM(const glm::mat4 &m); + void SetProjection(const glm::mat4 &p); + void SetView(const glm::mat4 &v); + void SetVP(const glm::mat4 &v, const glm::mat4 &p); + void SetMVP(const glm::mat4 &m, const glm::mat4 &v, const glm::mat4 &p); + + const glm::mat4 &Projection() const { return projection; } + const glm::mat4 &View() const { return view; } + const glm::mat4 &GetVP() const { return vp; } + +private: + Program program; + + glm::vec3 light_direction; + glm::vec3 light_color; + + glm::mat4 projection; + glm::mat4 view; + glm::mat4 vp; + + GLuint m_handle; + GLuint mvp_handle; + GLuint light_direction_handle; + GLuint light_color_handle; };