-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshader.h
81 lines (63 loc) · 2.77 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//******** PRACTICA VISUALITZACIÓ GRÀFICA INTERACTIVA (Escola Enginyeria - UAB)
//******** Entorn bàsic VS2022 MULTIFINESTRA amb OpenGL 4.3+, interfície MFC i llibreries GLM
//******** Enric Martí Gòdia (Setembre 2023)
// shader.h : interface of the Shader class
//
/////////////////////////////////////////////////////////////////////////////
#ifndef SHADER_H
#define SHADER_H
// Entorn VGI: Constants i tipus de l'aplicació entorn VGI
#include "stdafx.h"
/*
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
*/
class Shader
{
// Atributos
public:
//-------------- Entorn VGI: Variables globals de la classe Shader
unsigned int programID; // the program ID
//-------------- Entorn VGI: Fi De Variables globals de la classe Shader
//-------------- Entorn VGI: Funcions (mètodes) de de la classe Shader
// Constructor reads and builds the Vertex Shader (VS) and Fragment Shader (FS) into a Program (programID)
// Shader(std::string file_Vert, std::string file_Frag);
Shader();
// Destructor
~Shader();
// Funcions Auxiliars
GLuint loadFileShaders(std::string file_Vert, std::string file_Frag);
GLuint loadFileShadersG(std::string file_Vert, std::string file_Frag, std::string file_Geom);
// For testing
GLuint loadFileShadersTest(std::string file_Vert, std::string file_Frag);
GLuint loadFileShadersGTest(std::string file_Vert, std::string file_Frag, std::string file_Geom);
int DisplayMessageBox(std::string mess, std::string fileShader);
char* textFileRead(const char* fn);
void releaseAllShaders();
// Get programID
GLuint getProgramID();
// Use/activate the shader
void use();
// Utility uniform functions
// Pas de valors simples (bool, int, float o double)
void setBool(const std::string &name, bool value);
void setInt(const std::string &name, int value);
void setFloat(const std::string &name, float value);
void setDouble(const std::string &name, double value);
// Pas de vectors de 3 posicions (bool, int, float o double)
void setBool3(const std::string &name, bool value1, bool value2, bool value3);
void setInt3(const std::string &name, int value1, int value2, int value3);
void setFloat3(const std::string &name, float value1, float value2, float value3);
void setDouble3(const std::string &name, double value1, double value2, double value3);
// Pas de vectors de 4 posicions (float o double)
void setFloat4(const std::string &name, float value1, float value2, float value3, float value4);
void setDouble4(const std::string &name, double value1, double value2, double value3, double value4);
// Pas de Matrius 3x3 i 4x4
void setMatrix3fv(const std::string &name, glm::mat3 trans);
void setMatrix4fv(const std::string &name, glm::mat4 trans);
void DeleteProgram();
//-------------- Entorn VGI: Fi Funcions (mètodes) de de la classe Shader
};
#endif