1 #ifndef BLANK_SHADER_HPP_
2 #define BLANK_SHADER_HPP_
15 explicit Shader(GLenum type);
19 Shader &operator =(Shader &&);
21 Shader(const Shader &) = delete;
22 Shader &operator =(const Shader &) = delete;
24 void Source(const GLchar *src);
26 bool Compiled() const;
27 void Log(std::ostream &) const;
29 void AttachToProgram(GLuint id) const;
43 Program(const Program &) = delete;
44 Program &operator =(const Program &) = delete;
46 const Shader &LoadShader(GLenum type, const GLchar *src);
47 void Attach(Shader &);
50 void Log(std::ostream &) const;
52 GLint AttributeLocation(const GLchar *name) const;
53 GLint UniformLocation(const GLchar *name) const;
55 void Use() const { glUseProgram(handle); }
59 std::list<Shader> shaders;
64 class DirectionalLighting {
67 DirectionalLighting();
71 void SetLightDirection(const glm::vec3 &);
73 void SetFogDensity(float);
75 void SetM(const glm::mat4 &m);
76 void SetProjection(const glm::mat4 &p);
77 void SetView(const glm::mat4 &v);
78 void SetVP(const glm::mat4 &v, const glm::mat4 &p);
79 void SetMVP(const glm::mat4 &m, const glm::mat4 &v, const glm::mat4 &p);
81 const glm::mat4 &Projection() const { return projection; }
82 const glm::mat4 &View() const { return view; }
83 const glm::mat4 &GetVP() const { return vp; }
88 glm::vec3 light_direction;
89 glm::vec3 light_color;
100 GLuint light_direction_handle;
101 GLuint light_color_handle;
102 GLuint fog_density_handle;
106 class BlockLighting {
113 void SetFogDensity(float);
115 void SetM(const glm::mat4 &m);
116 void SetProjection(const glm::mat4 &p);
117 void SetView(const glm::mat4 &v);
118 void SetVP(const glm::mat4 &v, const glm::mat4 &p);
119 void SetMVP(const glm::mat4 &m, const glm::mat4 &v, const glm::mat4 &p);
121 const glm::mat4 &Projection() const { return projection; }
122 const glm::mat4 &View() const { return view; }
123 const glm::mat4 &GetVP() const { return vp; }
130 glm::mat4 projection;
136 GLuint light_direction_handle;
137 GLuint light_color_handle;
138 GLuint fog_density_handle;