-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathShaderManager.h
62 lines (53 loc) · 1.17 KB
/
ShaderManager.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef SHADERMANAGER_H
#define SHADERMANAGER_H
#include <memory>
#include <vector>
#include <GL/glew.h>
#include "Camera.h"
#include "Geometry.h"
class Program {
public:
void Setup() {}
void Use();
protected:
GLuint id;
};
class TextureProgram : public Program {
public:
void Setup();
static std::unique_ptr<TextureProgram> Make();
private:
TextureProgram() {}
GLint texture_uniform_;
};
class TextProgram : public Program {
public:
void Setup();
static std::unique_ptr<TextProgram> Make();
void scale(float scale) { scale_ = scale; }
void offset(vec2f offset) { offset_ = offset; }
private:
TextProgram() {}
vec2f offset_ = {0, 0};
float scale_ = 1;
GLint texture_uniform_;
GLint transform_uniform_;
};
class MapProgram : public Program {
public:
void Setup();
void map_offset(const vec2f& offset) { map_offset_ = offset; }
static std::unique_ptr<MapProgram> Make();
private:
MapProgram() {}
vec2f map_offset_ = {0, 0};
GLint tileset_uniform_, tilemap_uniform_, offset_uniform_;
};
class ColorProgram : public Program {
public:
void Setup();
static std::unique_ptr<ColorProgram> Make();
private:
ColorProgram() {}
};
#endif