#ifndef POLYGUN_RENDERER_SHADER_H
#define POLYGUN_RENDERER_SHADER_H

#include "game/core.hpp"

namespace polygun::renderer {
	class Shader {
	public:
		Shader();
		Shader(const GLuint id);
		Shader(const char* vertex_path, const char* fragment_path);
		~Shader();
		
		void bind();
		void unbind();
		void set_uniform(const GLchar* u_name, unsigned int value);
		void set_uniform(const GLchar* u_name, int value);
		void set_uniform(const GLchar* u_name, GLfloat value);
		void set_uniform(const GLchar* u_name, GLfloat x, GLfloat y);
		void set_uniform(const GLchar* u_name, const glm::vec2& vector);
		void set_uniform(const GLchar* u_name, GLfloat x, GLfloat y, GLfloat z);
		void set_uniform(const GLchar* u_name, const glm::vec3& vector);
		void set_uniform(const GLchar* u_name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
		void set_uniform(const GLchar* u_name, const glm::vec4& vector);
		void set_uniform(const GLchar* u_name, const glm::mat4& mtx);
		void set_uniform(const GLchar* u_name, GLuint tex2d, GLint unit); // sample 2d
		
		GLuint get_uniform(const char* name) const;
		GLuint get_program() const { return m_program; }

	private:	
		void check_compile_errors(GLuint shader, const std::string& type);
		
		GLuint m_program;
	};
}

#endif
