mirror of
https://github.com/Relintai/voxelman.git
synced 2025-04-13 21:00:47 +02:00
Add queued generation the VoxelChunkDefault.
This commit is contained in:
parent
f00dd13c43
commit
a306f8cf91
@ -274,6 +274,14 @@ void VoxelChunkDefault::next_phase() {
|
|||||||
++_current_build_phase;
|
++_current_build_phase;
|
||||||
|
|
||||||
if (_current_build_phase >= _max_build_phases) {
|
if (_current_build_phase >= _max_build_phases) {
|
||||||
|
if (_queued_generation) {
|
||||||
|
_current_build_phase = BUILD_PHASE_DONE;
|
||||||
|
++_current_build_phase;
|
||||||
|
|
||||||
|
_queued_generation = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_current_build_phase = BUILD_PHASE_DONE;
|
_current_build_phase = BUILD_PHASE_DONE;
|
||||||
_is_generating = false;
|
_is_generating = false;
|
||||||
|
|
||||||
@ -1052,6 +1060,7 @@ VoxelChunkDefault::VoxelChunkDefault() {
|
|||||||
_is_generating = false;
|
_is_generating = false;
|
||||||
|
|
||||||
_abort_build = false;
|
_abort_build = false;
|
||||||
|
_queued_generation = false;
|
||||||
_dirty = false;
|
_dirty = false;
|
||||||
_state = VOXEL_CHUNK_STATE_OK;
|
_state = VOXEL_CHUNK_STATE_OK;
|
||||||
|
|
||||||
@ -1503,6 +1512,7 @@ void VoxelChunkDefault::_create_meshers() {
|
|||||||
|
|
||||||
void VoxelChunkDefault::_build(bool immediate) {
|
void VoxelChunkDefault::_build(bool immediate) {
|
||||||
if (_current_build_phase == BUILD_PHASE_DONE) {
|
if (_current_build_phase == BUILD_PHASE_DONE) {
|
||||||
|
_queued_generation = false;
|
||||||
_build_prioritized = true;
|
_build_prioritized = true;
|
||||||
|
|
||||||
wait_and_finish_thread();
|
wait_and_finish_thread();
|
||||||
@ -1517,6 +1527,8 @@ void VoxelChunkDefault::_build(bool immediate) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
build_step();
|
build_step();
|
||||||
|
} else {
|
||||||
|
_queued_generation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +263,7 @@ protected:
|
|||||||
int _build_flags;
|
int _build_flags;
|
||||||
|
|
||||||
bool _abort_build;
|
bool _abort_build;
|
||||||
|
bool _queued_generation;
|
||||||
|
|
||||||
int _current_build_phase;
|
int _current_build_phase;
|
||||||
int _max_build_phases;
|
int _max_build_phases;
|
||||||
|
Loading…
Reference in New Issue
Block a user