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