1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef SHADER_H
- #define SHADER_H
- #include "math/Vector.h"
- #include "utils/Error.h"
- #include "utils/List.h"
- #include "wrapper/GL.h"
- class Shader final {
- GL::Shader vertex;
- GL::Shader geometry;
- GL::Shader fragment;
- GL::Program program;
- public:
- Shader();
- ~Shader();
- Shader(const Shader& other) = delete;
- Shader(Shader&& other) = delete;
- Shader& operator=(const Shader& other) = delete;
- Shader& operator=(Shader&& other) = delete;
- Error compile(const char* vertexPath, const char* geometryPath,
- const char* fragmentPath);
- void use() const;
- void setMatrix(const char* name, const float* data);
- void setInt(const char* name, int data);
- void setFloat(const char* name, float data);
- void setVector(const char* name, const Vector2& v);
- void setVector(const char* name, const Vector3& v);
- void setVector(const char* name, const Vector4& v);
- private:
- Error compile(const char* path, GL::Shader& s, GL::ShaderType st);
- Error readFile(List<char>& code, const char* path) const;
- Error compile(GL::Shader& s, const List<char>& code, GL::ShaderType st);
- };
- #endif
|