mirror of
https://github.com/Relintai/godot_voxel.git
synced 2024-11-11 20:35:08 +01:00
Add an internal option to run the terrain in editor, which defaults to false because editor integration currently isn't thread-safe
This commit is contained in:
parent
4d6765130d
commit
1cac9beec4
@ -21,6 +21,9 @@ VoxelTerrain::VoxelTerrain()
|
||||
|
||||
_provider_thread = NULL;
|
||||
_block_updater = NULL;
|
||||
|
||||
_generate_collisions = false;
|
||||
_run_in_editor = false;
|
||||
}
|
||||
|
||||
VoxelTerrain::~VoxelTerrain() {
|
||||
@ -403,7 +406,8 @@ void VoxelTerrain::_notification(int p_what) {
|
||||
break;
|
||||
|
||||
case NOTIFICATION_PROCESS:
|
||||
_process();
|
||||
if (!Engine::get_singleton()->is_editor_hint() || _run_in_editor)
|
||||
_process();
|
||||
break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE:
|
||||
@ -656,7 +660,8 @@ void VoxelTerrain::_process() {
|
||||
int queue_index = 0;
|
||||
|
||||
// The following is done on the main thread because Godot doesn't really support multithreaded Mesh allocation.
|
||||
// This also proved to be very slow compared to the meshing process itself... hopefully Vulkan will improve this?
|
||||
// This also proved to be very slow compared to the meshing process itself...
|
||||
// hopefully Vulkan will allow us to upload graphical resources without stalling rendering as they upload?
|
||||
|
||||
for (; queue_index < _blocks_pending_main_thread_update.size() && os.get_ticks_msec() < timeout; ++queue_index) {
|
||||
|
||||
|
@ -135,6 +135,7 @@ private:
|
||||
int _last_view_distance_blocks;
|
||||
|
||||
bool _generate_collisions;
|
||||
bool _run_in_editor;
|
||||
|
||||
Ref<Material> _materials[VoxelMesher::MAX_MATERIALS];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user