#pragma once // LearnOpenGL::Shader // OpenGL Shader Class Wrapper // Updated by dawsh // https://learnopengl.com/code_viewer_gh.php?code=includes/learnopengl/shader.h #include #include #include #include #include #include #include #include #include #include #include namespace LearnOpenGL { using J3ML::LinearAlgebra::Vector2; using J3ML::LinearAlgebra::Vector3; using J3ML::LinearAlgebra::Vector4; using J3ML::LinearAlgebra::Matrix2x2; using J3ML::LinearAlgebra::Matrix3x3; using J3ML::LinearAlgebra::Matrix4x4; class Shader { public: unsigned int ID{}; Shader(); Shader(std::filesystem::path vertexProgramPath, std::filesystem::path fragmentProgramPath); Shader(std::string vertexProgramSrc, std::string fragmentProgramSrc); void use(); // Utility uniform functions void setBool(const std::string& name, bool value) const; void setInt(const std::string& name, int value) const; void setFloat(const std::string& name, float value) const; void setVec2(const std::string& name, const Vector2& value) const; void setVec2(const std::string& name, float x, float y) const; void setVec3(const std::string& name, const Vector3& value) const; void setVec3(const std::string& name, float x, float y, float z) const; void setVec4(const std::string& name, const Vector4& value) const; void setVec4(const std::string& name, float x, float y, float z, float w) const; void setMat2(const std::string& name, const Matrix2x2 &mat) const; void setMat3(const std::string& name, const Matrix3x3 &mat) const; void setMat4(const std::string& name, const Matrix4x4 &mat) const; GLint getAttribute(const std::string& name) const; GLint getUniform(const std::string& name) const; private: void checkCompileErrors(GLuint shader, std::string type); }; }