Класс текстуры
This commit is contained in:
34
include/Texture.h
Normal file
34
include/Texture.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef TEXTURE_H
|
||||
#define TEXTURE_H
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
enum TexType {
|
||||
TEX_DIFFUSE,
|
||||
TEX_AVAILABLE_COUNT
|
||||
};
|
||||
|
||||
class Texture
|
||||
{
|
||||
public:
|
||||
Texture(GLuint type = TEX_AVAILABLE_COUNT, const std::string& filename = ""); // Загрузка текстуры с диска или использование "пустой"
|
||||
Texture(const Texture& other); // Конструктор копирования
|
||||
~Texture();
|
||||
|
||||
Texture& operator=(const Texture& other); // Оператор присваивания
|
||||
|
||||
static void init_textures(GLuint programID); // Инициализация текстур на шейдере
|
||||
void use(); // Привязка текстуры
|
||||
static void disable(GLuint type); // Отвязка текстуры по типу
|
||||
GLuint getType(); // Возвращает тип текстуры
|
||||
private:
|
||||
GLuint handler; // Дескриптор текстуры
|
||||
GLuint type; // Тип текстуры, соответствует её слоту
|
||||
static std::map<std::string, int> filename_handler; // Получение дескриптора текстуры по её имени
|
||||
static std::map<int, int> handler_count; // Получение количества использований по дескриптору текстуры (Shared pointer)
|
||||
};
|
||||
|
||||
#endif // TEXTURE_H
|
||||
Reference in New Issue
Block a user