diff --git a/world/voxel_chunk.cpp b/world/voxel_chunk.cpp index 56c9253..071bc59 100644 --- a/world/voxel_chunk.cpp +++ b/world/voxel_chunk.cpp @@ -242,6 +242,18 @@ int VoxelChunk::get_job_count() const { return _jobs.size(); } +int VoxelChunk::get_current_job_index() { + return _current_job; +} +void VoxelChunk::next_job() { + ++_current_job; + + if (_current_job >= _jobs.size()) { + _current_job = 0; + set_is_generating(false); + } +} + Ref VoxelChunk::get_mesher(int index) const { ERR_FAIL_INDEX_V(index, _meshers.size(), Ref()); @@ -1320,6 +1332,9 @@ void VoxelChunk::_bind_methods() { ClassDB::bind_method(D_METHOD("add_job", "job"), &VoxelChunk::add_job); ClassDB::bind_method(D_METHOD("get_job_count"), &VoxelChunk::get_job_count); + ClassDB::bind_method(D_METHOD("get_current_job_index"), &VoxelChunk::get_current_job_index); + ClassDB::bind_method(D_METHOD("next_job"), &VoxelChunk::next_job); + ClassDB::bind_method(D_METHOD("get_mesher", "index"), &VoxelChunk::get_mesher); ClassDB::bind_method(D_METHOD("set_mesher", "index", "mesher"), &VoxelChunk::set_mesher); ClassDB::bind_method(D_METHOD("remove_mesher", "index"), &VoxelChunk::remove_mesher); diff --git a/world/voxel_chunk.h b/world/voxel_chunk.h index c24e45b..33f8e7f 100644 --- a/world/voxel_chunk.h +++ b/world/voxel_chunk.h @@ -147,6 +147,9 @@ public: void add_job(const Ref &job); int get_job_count() const; + int get_current_job_index(); + void next_job(); + //Meshers Ref get_mesher(const int index) const; void set_mesher(const int index, const Ref &mesher);