mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
perf:greedy meshing (#23)
* feat(gameplay): implement greedy meshing for chunk generation Replace the per-face vertex generation with a greedy meshing algorithm that merges adjacent faces of the same block type into larger quads. Introduce `FaceKey` struct and helper functions (`axis_dir_to_face`, `get_block_safe`, `is_face_culled`, `choose_buf`) to support the new algorithm. Comment out the old `gen_vertices` implementation. In texture management, rename `m_pbr_texture_array` to `m_normal_texture_array` to reflect its actual usage, and set texture wrap mode to `GL_REPEAT` for both the block and normal texture arrays. * fix(primitive_data): correct back face texture coordinates and tangents * fix(texture-manager): correct texture deletion and refactor reload Make hot_reload private and add public need_reload method. Update UI to call need_reload instead of hot_reload. Fix incorrect use of glDeleteBuffers for normal texture array by using glDeleteTextures.
This commit is contained in:
@@ -12,7 +12,7 @@ private:
|
||||
GLuint m_texture_array = 0;
|
||||
GLuint m_cross_plane_array = 0;
|
||||
GLuint m_ui_array = 0;
|
||||
GLuint m_pbr_texture_array = 0;
|
||||
GLuint m_normal_texture_array = 0;
|
||||
GLfloat m_max_aniso = 0.0f;
|
||||
|
||||
int m_aniso = 1;
|
||||
@@ -29,6 +29,7 @@ private:
|
||||
void init_block();
|
||||
void init_ui();
|
||||
void init_block_status();
|
||||
void hot_reload();
|
||||
|
||||
public:
|
||||
TextureManager();
|
||||
@@ -43,7 +44,7 @@ public:
|
||||
const std::vector<GLuint>& item_textures() const;
|
||||
// Must call after MapTable::init_map() and glfwMakeContextCurrent(window);
|
||||
void init_texture();
|
||||
void hot_reload();
|
||||
|
||||
void need_reload();
|
||||
void update();
|
||||
int max_aniso() const;
|
||||
|
||||
Reference in New Issue
Block a user