engineer-thesis-WUT/Engine/engine/shader.hpp

29 lines
1010 B
C++

#ifndef SHADER_HPP
#define SHADER_HPP
#include <glad/glad.h>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
class Shader
{
public:
// the program ID
unsigned int ID;
unsigned int linkShaderObjectsShaderProgram(const unsigned int vertexShaders, const unsigned int fragmentShader) const;
int shaderSuccessful(const unsigned int shader, const bool compilation) const;
unsigned int compileShader(const GLenum shaderType, const char *shaderSource) const;
const char *getSourceCode(const std::string_view sourcePath) const;
// constructor reads and builds the shader
Shader(const std::string_view vertexPath, const std::string_view fragmentPath);
// use/activate the shader
void use();
// utility uniform functions
void setBool(const std::string_view &name, const bool value) const;
void setInt(const std::string_view &name, const int value) const;
void setFloat(const std::string_view &name, const float value) const;
};
#endif