Класс шейдерной программы
This commit is contained in:
30
include/Shader.h
Normal file
30
include/Shader.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef SHADER_H
|
||||
#define SHADER_H
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
// Класс шейдерной программы
|
||||
class ShaderProgram
|
||||
{
|
||||
public:
|
||||
ShaderProgram();
|
||||
ShaderProgram(const ShaderProgram ©);
|
||||
~ShaderProgram();
|
||||
ShaderProgram& operator=(const ShaderProgram& other);
|
||||
|
||||
void use(); // Использование шейдеров
|
||||
void load(GLuint type, const char* filename); // Функция для загрузки шейдеров
|
||||
void link(); // Формирование программы из загруженных шейдеров
|
||||
GLuint getUniformLoc(const char* name); // Возвращает местоположение uniform-переменной
|
||||
void bindUniformBlock(const char* name, int binding); // Привязка uniform-блока
|
||||
void bindTextures(const char* textures_base_shader_names[], int count); // Инициализация текстур на шейдере
|
||||
private:
|
||||
GLuint program; // Дескриптор
|
||||
static std::map<int, int> handler_count; // Получение количества использований по дескриптору шейдера (Shared pointer)
|
||||
std::map<const char*, GLuint> uniformLocations; // Местоположения uniform-переменных
|
||||
};
|
||||
|
||||
#endif // SHADER_H
|
||||
@@ -20,7 +20,6 @@ class Texture
|
||||
|
||||
Texture& operator=(const Texture& other); // Оператор присваивания
|
||||
|
||||
static void init_textures(GLuint programID); // Инициализация текстур на шейдере
|
||||
void use(); // Привязка текстуры
|
||||
static void disable(GLuint type); // Отвязка текстуры по типу
|
||||
GLuint getType(); // Возвращает тип текстуры
|
||||
|
||||
Reference in New Issue
Block a user