mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-04-10 06:14:07 +08:00
perf: optmize world rendering performance
This commit is contained in:
@@ -1,24 +1,21 @@
|
||||
#pragma once
|
||||
#include <glad/glad.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <Cubed/gameplay/block.hpp>
|
||||
#include <Cubed/tools/shader_tools.hpp>
|
||||
|
||||
|
||||
class TextureManager {
|
||||
private:
|
||||
std::vector<BlockTexture> m_block_textures;
|
||||
GLuint m_texture_array;
|
||||
|
||||
void load_block_texture(unsigned block_id);
|
||||
|
||||
public:
|
||||
TextureManager();
|
||||
~TextureManager();
|
||||
const BlockTexture& get_block_texture(const std::string& block_name);
|
||||
const BlockTexture& get_block_texture(unsigned block_id);
|
||||
void delet_texture();
|
||||
|
||||
void load_block_texture(const std::string& block_name);
|
||||
void load_block_texture(unsigned block_id);
|
||||
|
||||
void delet_texture();
|
||||
GLuint get_texture_array();
|
||||
// Must call after MapTable::init_map() and glfwMakeContextCurrent(window);
|
||||
void init_texture();
|
||||
};
|
||||
@@ -9,6 +9,7 @@ namespace 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);
|
||||
void delete_image_data(unsigned char* data);
|
||||
unsigned char* load_image_data(const std::string& tex_image_path);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user