Added get_current_job_index and next_job tp VoxelChunk.

This commit is contained in:
Relintai 2020-10-02 16:49:36 +02:00
parent 46132202b0
commit 0db9475db1
2 changed files with 18 additions and 0 deletions

View File

@ -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<VoxelMesher> VoxelChunk::get_mesher(int index) const {
ERR_FAIL_INDEX_V(index, _meshers.size(), Ref<VoxelMesher>());
@ -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);

View File

@ -147,6 +147,9 @@ public:
void add_job(const Ref<VoxelMesher> &job);
int get_job_count() const;
int get_current_job_index();
void next_job();
//Meshers
Ref<VoxelMesher> get_mesher(const int index) const;
void set_mesher(const int index, const Ref<VoxelMesher> &mesher);