-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShaders.h
More file actions
73 lines (52 loc) · 1.82 KB
/
Copy pathShaders.h
File metadata and controls
73 lines (52 loc) · 1.82 KB
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
73
#pragma once
#include "Common.h"
// A class that provides a wrapper around an OpenGL shader
class CShader
{
public:
CShader();
~CShader();
bool LoadShader(string sFile, int iType);
void DeleteShader();
bool GetLinesFromFile(string sFile, bool bIncludePart, vector<string>* vResult);
bool IsLoaded();
UINT GetShaderID();
private:
UINT m_uiShader; // ID of shader
int m_iType; // GL_VERTEX_SHADER, GL_FRAGMENT_SHADER...
bool m_bLoaded; // Whether shader was loaded and compiled
};
// A class the provides a wrapper around an OpenGL shader program
class CShaderProgram
{
public:
CShaderProgram();
void CreateProgram();
void DeleteProgram();
bool AddShaderToProgram(CShader* shShader);
bool LinkProgram();
void UseProgram();
UINT GetProgramID();
// Setting vectors
void SetUniform(string sName, glm::vec2* vVectors, int iCount = 1);
void SetUniform(string sName, const glm::vec2 vVector);
void SetUniform(string sName, glm::vec3* vVectors, int iCount = 1);
void SetUniform(string sName, const glm::vec3 vVector);
void SetUniform(string sName, glm::vec4* vVectors, int iCount = 1);
void SetUniform(string sName, const glm::vec4 vVector);
// Setting floats
void SetUniform(string sName, float* fValues, int iCount = 1);
void SetUniform(string sName, const float fValue);
// Setting 3x3 matrices
void SetUniform(string sName, glm::mat3* mMatrices, int iCount = 1);
void SetUniform(string sName, const glm::mat3 mMatrix);
// Setting 4x4 matrices
void SetUniform(string sName, glm::mat4* mMatrices, int iCount = 1);
void SetUniform(string sName, const glm::mat4 mMatrix);
// Setting integers
void SetUniform(string sName, int* iValues, int iCount = 1);
void SetUniform(string sName, const int iValue);
private:
UINT m_uiProgram; // ID of program
bool m_bLinked; // Whether program was linked and is ready to use
};