mirror of
https://github.com/kuhyx/engineer-thesis-WUT.git
synced 2026-07-04 16:43:15 +02:00
38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
// "Copyright [2023] <Krzysztof Rudnicki>"
|
|
#ifndef SHADER_HPP
|
|
#define SHADER_HPP
|
|
|
|
#include <glad/glad.h>
|
|
|
|
#include <string>
|
|
#include <fstream>
|
|
#include <sstream>
|
|
#include <iostream>
|
|
|
|
class Shader
|
|
{
|
|
public:
|
|
unsigned int ID;
|
|
// constructor generates the shader on the fly
|
|
// ------------------------------------------------------------------------
|
|
Shader(const std::string vertexPath, const std::string fragmentPath);
|
|
const std::string fileToShader(const std::string shaderPath);
|
|
// activate the shader
|
|
// ------------------------------------------------------------------------
|
|
void use();
|
|
// utility uniform functions
|
|
// ------------------------------------------------------------------------
|
|
void setBool(const std::string &name, bool value) const;
|
|
// ------------------------------------------------------------------------
|
|
void setInt(const std::string &name, int value) const;
|
|
// ------------------------------------------------------------------------
|
|
void setFloat(const std::string &name, float value) const;
|
|
|
|
private:
|
|
// utility function for checking shader compilation/linking errors.
|
|
// ------------------------------------------------------------------------
|
|
void checkCompileErrors(unsigned int shader, std::string type);
|
|
void compileErrorsMessage(const unsigned int shader, const bool compilation, const std::string type, const std::string errorMessage);
|
|
};
|
|
#endif
|