-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathShader.h
56 lines (48 loc) · 1.59 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
53
54
55
56
#ifndef SHADER_H
#define SHADER_H
#include <string>
#include <vector>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
/**
* @brief Class defined for shader
*/
class Shader {
/**
* @brief Method defined to read the shader file
* @param path path to the shader file
*/
static std::string readShaderFile(const std::string &path);
/**
* @brief method defined to compile the shader file
* @param path path of the shader file
* @param type type of the shader
*/
static GLuint compileShader(const std::string &path, GLenum type);
/**
* @brief Method implemented to get the location of the uniform
* @param name name of the uniform
*/
inline GLuint getLoc(const std::string &name) const;
public:
GLuint id;
/**
* @brief constructor for Shader class
*/
Shader(const std::string &vertPath, const std::string &fragPath);
void use();
/**
* Methods to set the input to the shaders
*/
void set(const std::string &name, GLboolean value) const;
void set(const std::string &name, GLint value) const;
void set(const std::string &name, GLfloat value) const;
void set(const std::string &name, const std::vector<GLint> &values) const;
void set(const std::string &name, const std::vector<GLfloat> &values) const;
void set(const std::string &name, const glm::vec3 &value) const;
void set(const std::string &name, const glm::mat4x4 &value) const;
void setf(const std::string &name, const std::vector<GLfloat> &values) const;
};
#endif