From 370e14f6c8de01fdb4490fd65a9e6fc4acf76d16 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 6 Mar 2020 14:27:04 +0100 Subject: [PATCH] Removed the temp mesh array I just added from voxel chunk. --- world/voxel_chunk.cpp | 15 +++++---------- world/voxel_chunk.h | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/world/voxel_chunk.cpp b/world/voxel_chunk.cpp index a4f16fc..4c7c3c9 100644 --- a/world/voxel_chunk.cpp +++ b/world/voxel_chunk.cpp @@ -780,18 +780,15 @@ void VoxelChunk::_build_phase(int phase) { ERR_FAIL_COND(!mesher.is_valid()); - temp_mesh_arr = mesher->build_mesh(); + if (mesher->get_vertex_count() == 0) { + next_phase(); + return; + } if (_mesh_rid != RID()) VS::get_singleton()->mesh_clear(_mesh_rid); - PoolVector3Array v = temp_mesh_arr[VisualServer::ARRAY_VERTEX]; - - if (temp_mesh_arr.size() == 0 || v.size() == 0) { - temp_mesh_arr.clear(); - next_phase(); - return; - } + Array temp_mesh_arr = mesher->build_mesh(); if (_mesh_rid == RID()) { allocate_main_mesh(); @@ -802,8 +799,6 @@ void VoxelChunk::_build_phase(int phase) { if (_library->get_material().is_valid()) VS::get_singleton()->mesh_surface_set_material(_mesh_rid, 0, _library->get_material()->get_rid()); - temp_mesh_arr.clear(); - next_phase(); return; diff --git a/world/voxel_chunk.h b/world/voxel_chunk.h index a2700a5..b9231a5 100644 --- a/world/voxel_chunk.h +++ b/world/voxel_chunk.h @@ -393,7 +393,6 @@ protected: Mutex *_build_phase_done_mutex; bool _build_phase_done; Thread *_build_thread; - Array temp_mesh_arr; }; VARIANT_ENUM_CAST(VoxelChunk::DefaultChannels);