]> git.localhorst.tv Git - blank.git/blobdiff - src/shader.hpp
fix dec/rad error in camera FOV
[blank.git] / src / shader.hpp
index aefcffe1f8b54e819f92eb895e3cebfcba9f6cf0..bb9ad845445acbacc101313e129d9c0c50f39cdc 100644 (file)
@@ -4,6 +4,7 @@
 #include <iosfwd>
 #include <list>
 #include <GL/glew.h>
+#include <glm/glm.hpp>
 
 
 namespace blank {
@@ -48,6 +49,7 @@ public:
        bool Linked() const;
        void Log(std::ostream &) const;
 
+       GLint AttributeLocation(const GLchar *name) const;
        GLint UniformLocation(const GLchar *name) const;
 
        void Use() const { glUseProgram(handle); }
@@ -58,6 +60,85 @@ private:
 
 };
 
+
+class DirectionalLighting {
+
+public:
+       DirectionalLighting();
+
+       void Activate();
+
+       void SetLightDirection(const glm::vec3 &);
+
+       void SetFogDensity(float);
+
+       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;
+
+       float fog_density;
+
+       glm::mat4 projection;
+       glm::mat4 view;
+       glm::mat4 vp;
+
+       GLuint m_handle;
+       GLuint mv_handle;
+       GLuint mvp_handle;
+       GLuint light_direction_handle;
+       GLuint light_color_handle;
+       GLuint fog_density_handle;
+
+};
+
+class BlockLighting {
+
+public:
+       BlockLighting();
+
+       void Activate();
+
+       void SetFogDensity(float);
+
+       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;
+
+       float fog_density;
+
+       glm::mat4 projection;
+       glm::mat4 view;
+       glm::mat4 vp;
+
+       GLuint mv_handle;
+       GLuint mvp_handle;
+       GLuint light_direction_handle;
+       GLuint light_color_handle;
+       GLuint fog_density_handle;
+
+};
+
 }
 
 #endif