feat: add TextureManager class

This commit is contained in:
2026-03-07 11:46:36 +08:00
parent fc7f3e75b1
commit 2ad9deff3e
6 changed files with 85 additions and 10 deletions

View File

@@ -0,0 +1,26 @@
#pragma once
#include <glad/glad.h>
#include <string>
#include <unordered_map>
#include <vector>
#include <Cubed/tools/shader_tools.hpp>
struct BlockTexture {
std::string name;
std::vector<GLuint> texture;
};
class TextureManager {
private:
static std::size_t make_hash(std::string);
std::unordered_map<std::size_t, BlockTexture> m_block_textures;
public:
TextureManager();
~TextureManager();
const BlockTexture& get_block_texture(std::string name);
void delet_texture();
void load_block_texture(std::string block_name);
};

View File

@@ -9,4 +9,5 @@ void print_shader_log(GLuint shader);
void print_program_info(int prog);
bool check_opengl_error();
std::string read_shader_source(const char* file_path);
GLuint load_texture(const std::string& tex_image_path);
GLuint load_texture(const char* tex_image_path);