-
Notifications
You must be signed in to change notification settings - Fork 2
/
Shaders.hpp
72 lines (56 loc) · 1.91 KB
/
Shaders.hpp
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
63
64
65
66
67
68
69
70
71
72
#ifndef SHADER_H
#define SHADER_H
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
using namespace std;
#include <GL/glew.h> // Include glew to get all the required OpenGL
class Texture;
#include "includes.hpp"// msh 3aref ha3ml include wla hasibo keda
class Shader
{
public:
Shader();
~Shader(void);
string GetName() const;
GLuint Program() const;
void Init();
bool IsInUse() const;
void Use() const;
void Release() const;
void LoadShader(string shaderName, const char * vertexSourcePath, const char * fragmentSourcePath);
// //TODO : send a matrix/texture as a uniform to shader
// void SendUniform(string name, Texture* texture);
void SendUniform(const char * name, glm::mat4 mat);
void SendUniform(const char * name, glm::mat3 mat);
void SendUniform(const char * name, float value);
void SendUniform(const char * name, int value);
void SendUniform(const char * name, glm::vec2 vec);
void SendUniform(const char * name, glm::vec3 vec);
void SendUniform(const char * name, glm::vec4 vec);
void Link();
GLuint Uniform(const char * uniformName) const;
GLuint Attribute(const char * attributeName) const;
GLuint ProgramID;
bool loaded;
private:
GLuint fragment;
GLuint vertex;
string name;
};//static PhongShader ("PhongShader", "StandardShading.vertexshader", "StandardShading.fragmentshader");
// static Shader PhongShader("PhongShader", "StandardShading.vertexshader", "StandardShading.fragmentshader");
/////////////////////////////////////////////////////
// Shaders Hints
// 1- PhongShader
// - MVP : MVPMatrix
// - V : ViewMatrix
// - M : ModelMatrix
// - LightPower
// - vertexPosition_modelspace
// - vertexUV
// - vertexNormal_modelspace
// - myTextureSampler
// - LightPosition_worldspace
/////////////////////////////////////////////////////
#endif