]> git.localhorst.tv Git - blank.git/blobdiff - src/shader.hpp
minor optimizations in chunk
[blank.git] / src / shader.hpp
index 873460bf17644947ee61f3e87e8f5be82ccad2d8..df625c6d3a018ae71caa9302b36043b5f748c364 100644 (file)
@@ -15,18 +15,18 @@ public:
        explicit Shader(GLenum type);
        ~Shader();
 
-       Shader(Shader &&);
-       Shader &operator =(Shader &&);
+       Shader(Shader &&) noexcept;
+       Shader &operator =(Shader &&) noexcept;
 
        Shader(const Shader &) = delete;
        Shader &operator =(const Shader &) = delete;
 
-       void Source(const GLchar *src);
-       void Compile();
-       bool Compiled() const;
+       void Source(const GLchar *src) noexcept;
+       void Compile() noexcept;
+       bool Compiled() const noexcept;
        void Log(std::ostream &) const;
 
-       void AttachToProgram(GLuint id) const;
+       void AttachToProgram(GLuint id) const noexcept;
 
 private:
        GLuint handle;
@@ -44,14 +44,15 @@ public:
        Program &operator =(const Program &) = delete;
 
        const Shader &LoadShader(GLenum type, const GLchar *src);
-       void Attach(Shader &);
-       void Link();
-       bool Linked() const;
+       void Attach(Shader &) noexcept;
+       void Link() noexcept;
+       bool Linked() const noexcept;
        void Log(std::ostream &) const;
 
-       GLint UniformLocation(const GLchar *name) const;
+       GLint AttributeLocation(const GLchar *name) const noexcept;
+       GLint UniformLocation(const GLchar *name) const noexcept;
 
-       void Use() const { glUseProgram(handle); }
+       void Use() const noexcept { glUseProgram(handle); }
 
 private:
        GLuint handle;
@@ -65,21 +66,21 @@ class DirectionalLighting {
 public:
        DirectionalLighting();
 
-       void Activate();
+       void Activate() noexcept;
 
-       void SetLightDirection(const glm::vec3 &);
+       void SetLightDirection(const glm::vec3 &) noexcept;
 
-       void SetFogDensity(float);
+       void SetFogDensity(float) noexcept;
 
-       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);
+       void SetM(const glm::mat4 &m) noexcept;
+       void SetProjection(const glm::mat4 &p) noexcept;
+       void SetView(const glm::mat4 &v) noexcept;
+       void SetVP(const glm::mat4 &v, const glm::mat4 &p) noexcept;
+       void SetMVP(const glm::mat4 &m, const glm::mat4 &v, const glm::mat4 &p) noexcept;
 
-       const glm::mat4 &Projection() const { return projection; }
-       const glm::mat4 &View() const { return view; }
-       const glm::mat4 &GetVP() const { return vp; }
+       const glm::mat4 &Projection() const noexcept { return projection; }
+       const glm::mat4 &View() const noexcept { return view; }
+       const glm::mat4 &GetVP() const noexcept { return vp; }
 
 private:
        Program program;
@@ -107,19 +108,19 @@ class BlockLighting {
 public:
        BlockLighting();
 
-       void Activate();
+       void Activate() noexcept;
 
-       void SetFogDensity(float);
+       void SetFogDensity(float) noexcept;
 
-       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);
+       void SetM(const glm::mat4 &m) noexcept;
+       void SetProjection(const glm::mat4 &p) noexcept;
+       void SetView(const glm::mat4 &v) noexcept;
+       void SetVP(const glm::mat4 &v, const glm::mat4 &p) noexcept;
+       void SetMVP(const glm::mat4 &m, const glm::mat4 &v, const glm::mat4 &p) noexcept;
 
-       const glm::mat4 &Projection() const { return projection; }
-       const glm::mat4 &View() const { return view; }
-       const glm::mat4 &GetVP() const { return vp; }
+       const glm::mat4 &Projection() const noexcept { return projection; }
+       const glm::mat4 &View() const noexcept { return view; }
+       const glm::mat4 &GetVP() const noexcept { return vp; }
 
 private:
        Program program;
@@ -130,7 +131,6 @@ private:
        glm::mat4 view;
        glm::mat4 vp;
 
-       GLuint m_handle;
        GLuint mv_handle;
        GLuint mvp_handle;
        GLuint light_direction_handle;