feat: apply_mesh for chunks is smeared over frames

This commit is contained in:
Sara Gerretsen 2026-02-25 22:42:07 +01:00
parent 226c821454
commit 1e44fcd09f
5 changed files with 47 additions and 11 deletions

View file

@ -12,6 +12,7 @@ class Terrain : public Node {
GDCLASS(Terrain, Node);
static void _bind_methods();
void child_order_changed();
void update_meshes();
protected:
void _notification(int what);
@ -21,11 +22,16 @@ public:
void construct_chunk_grid();
float height_at(Vector2 world_coordinate);
void push_changed(Rect2 area);
void mesh_dirty(TerrainChunkMesh *mesh);
private:
Vector<TerrainChunkMesh *> workload{};
Mutex workload_lock;
bool threads_stop{ false };
Mutex workload_lock;
Vector<TerrainChunkMesh *> dirty_meshes{};
Mutex dirty_meshes_lock{};
Vector<TerrainChunkMesh *> meshes{};
Vector<TerrainModifier *> modifiers{};
LocalVector<Thread> threads{};