-
Notifications
You must be signed in to change notification settings - Fork 1
/
Shader.h
52 lines (42 loc) · 1.18 KB
/
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
46
47
48
49
50
51
52
#ifndef _SHADER_H_
#define _SHADER_H_
#include <fstream>
#include <sstream>
#include <iostream>
#include <string>
#include <GL/glew.h>
#include <memory>
#include <map>
#include <glm/common.hpp>
using namespace std;
enum ShaderEnum
{
SHADER_MODE_FLAT,
SHADER_MODE_PHONG,
SHADER_MODE_TEXTURED_FLAT,
SHADER_MODE_TEXTURED_PHONG
};
class Shader : public std::enable_shared_from_this<Shader>
{
public:
Shader(std::string name);
~Shader();
bool SetupShader();
bool SetupShader(const GLchar* vsPath, const GLchar* fsPath , const GLchar* gsPath);
bool SetupShader(const GLchar* vsPath, const GLchar* fsPath);
bool SetupShader(ShaderEnum);
void SetUniformMat4(const std::string& name, const glm::mat4& mat);
void SetUniformVec3(const std::string& name, const glm::vec3& mat);
void SetUniformInt(const std::string& name, const GLint value);
void SetUniformFloat(const std::string& name, const float value);
void Use();
//getter
inline std::string getName() { return m_name; };
inline const GLuint& getProgram() const { return m_program; };
private:
std::string m_name;
GLuint m_program;
GLuint m_vertex_shader, m_geometry_shader, m_fragment_shader;
void RegistToManager();
};
#endif