-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshader.h
45 lines (33 loc) · 893 Bytes
/
shader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include <string>
#include <memory>
#include <map>
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
// forward declare
struct lua_State;
namespace graphics
{
class shader {
public:
static void register_lua_functions();
shader(std::string vert_path, std::string frag_path);
~shader();
void reload();
void use();
GLuint m_shader_program;
std::string m_vert_path;
std::string m_frag_path;
static void reload_shaders();
static std::shared_ptr<shader> get_shader(std::string name);
private:
void load();
void release();
GLuint m_vertex_shader;
GLuint m_fragment_shader;
inline static std::map<std::string, std::shared_ptr<shader>> s_shaders;
// lua functions
static int load_shader(lua_State* state);
};
}