summaryrefslogtreecommitdiff
path: root/gfx/gl/shader.h
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl/shader.h')
-rw-r--r--gfx/gl/shader.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/gfx/gl/shader.h b/gfx/gl/shader.h
index a839b9b..98e0348 100644
--- a/gfx/gl/shader.h
+++ b/gfx/gl/shader.h
@@ -2,17 +2,20 @@
#define SHADER_INCLUDED_H
#include <GL/glew.h>
+#include <array>
#include <glRef.hpp>
#include <glm/glm.hpp>
#include <string_view>
class Shader {
public:
+ enum class Program { Basic = 0 };
+
Shader();
- void Bind() const;
void setView(glm::mat4 view) const;
- void setModel(glm::mat4 model) const;
+ void setModel(glm::mat4 model, Program = Program::Basic) const;
+ void setLight(glm::vec3 dir) const;
private:
class Source {
@@ -27,10 +30,16 @@ private:
static void CheckShaderError(GLuint shader, GLuint flag, bool isProgram, std::string_view errorMessage);
- using ProgramRef = glRef<GLuint, __glewCreateProgram, __glewDeleteProgram>;
+ class ProgramHandle {
+ public:
+ ProgramHandle(std::initializer_list<GLuint>);
+ using ProgramRef = glRef<GLuint, __glewCreateProgram, __glewDeleteProgram>;
+
+ ProgramRef m_program;
+ GLint viewProjection_uniform, model_uniform, lightDir_uniform;
+ };
- ProgramRef m_program;
- GLint viewProjection_uniform, model_uniform, lightDir_uniform;
+ std::array<ProgramHandle, 1> programs;
};
#endif