From c9aa295b03baf3f91462427dd2b7dd0b98c47107 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Wed, 6 Apr 2022 01:31:51 +0100 Subject: [PATCH] Fix unused variables --- server/load_block_data_task.cpp | 2 +- server/load_block_data_task.h | 2 +- terrain/fixed_lod/voxel_terrain.cpp | 6 +++--- terrain/variable_lod/voxel_lod_terrain.cpp | 8 ++++---- .../voxel_lod_terrain_update_task.cpp | 16 +++++++--------- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/server/load_block_data_task.cpp b/server/load_block_data_task.cpp index 1b81aa71..f78425c8 100644 --- a/server/load_block_data_task.cpp +++ b/server/load_block_data_task.cpp @@ -21,7 +21,7 @@ LoadBlockDataTask::LoadBlockDataTask(uint32_t p_volume_id, Vector3i p_block_pos, _lod(p_lod), _block_size(p_block_size), _request_instances(p_request_instances), - _request_voxels(true), + //_request_voxels(true), _stream_dependency(p_stream_dependency) { // ++g_debug_load_block_tasks_count; diff --git a/server/load_block_data_task.h b/server/load_block_data_task.h index ddcecda5..38fa04a8 100644 --- a/server/load_block_data_task.h +++ b/server/load_block_data_task.h @@ -33,7 +33,7 @@ private: bool _has_run = false; bool _too_far = false; bool _request_instances = false; - bool _request_voxels = false; + //bool _request_voxels = false; bool _max_lod_hint = false; bool _fallback_on_generator = false; std::shared_ptr _stream_dependency; diff --git a/terrain/fixed_lod/voxel_terrain.cpp b/terrain/fixed_lod/voxel_terrain.cpp index bc786e73..9729260f 100644 --- a/terrain/fixed_lod/voxel_terrain.cpp +++ b/terrain/fixed_lod/voxel_terrain.cpp @@ -621,7 +621,7 @@ struct ScheduleSaveAction { void VoxelTerrain::unload_data_block(Vector3i bpos) { const bool save = _stream.is_valid() && (!Engine::get_singleton()->is_editor_hint() || _run_stream_in_editor); - _data_map.remove_block(bpos, [this, bpos, save](VoxelDataBlock &block) { + _data_map.remove_block(bpos, [this, save](VoxelDataBlock &block) { emit_data_block_unloaded(block); if (save) { // Note: no need to copy the block because it gets removed from the map anyways @@ -1090,8 +1090,8 @@ void VoxelTerrain::process_viewers() { VoxelServer::get_singleton()->is_viewer_requiring_data_block_notifications(viewer.id); // Unview blocks that just fell out of range - prev_data_box.difference(new_data_box, [this, &viewer](Box3i out_of_range_box) { - out_of_range_box.for_each_cell([this, &viewer](Vector3i bpos) { // + prev_data_box.difference(new_data_box, [this](Box3i out_of_range_box) { + out_of_range_box.for_each_cell([this](Vector3i bpos) { // unview_data_block(bpos); }); }); diff --git a/terrain/variable_lod/voxel_lod_terrain.cpp b/terrain/variable_lod/voxel_lod_terrain.cpp index bc0f0451..63283369 100644 --- a/terrain/variable_lod/voxel_lod_terrain.cpp +++ b/terrain/variable_lod/voxel_lod_terrain.cpp @@ -1669,10 +1669,10 @@ Dictionary VoxelLodTerrain::_b_get_statistics() const { const unsigned int lod_count = _update_data->settings.lod_count; - int deferred_collision_updates = 0; - for (unsigned int lod_index = 0; lod_index < lod_count; ++lod_index) { - deferred_collision_updates += _deferred_collision_updates_per_lod[lod_index].size(); - } + // int deferred_collision_updates = 0; + // for (unsigned int lod_index = 0; lod_index < lod_count; ++lod_index) { + // deferred_collision_updates += _deferred_collision_updates_per_lod[lod_index].size(); + // } // Breakdown of information and time spent in _process and the update task. diff --git a/terrain/variable_lod/voxel_lod_terrain_update_task.cpp b/terrain/variable_lod/voxel_lod_terrain_update_task.cpp index c83ea8eb..8ebfba4a 100644 --- a/terrain/variable_lod/voxel_lod_terrain_update_task.cpp +++ b/terrain/variable_lod/voxel_lod_terrain_update_task.cpp @@ -250,14 +250,12 @@ static void process_unload_data_blocks_sliding_box(VoxelLodTerrainUpdateData::St VOXEL_PROFILE_SCOPE_NAMED("Unload data"); VoxelDataLodMap::Lod &data_lod = data.lods[lod_index]; RWLockWrite wlock(data_lod.map_lock); - prev_box.difference( - new_box, [&lod, &data_lod, lod_index, &blocks_to_save, can_save](Box3i out_of_range_box) { - out_of_range_box.for_each_cell( - [&lod, &data_lod, lod_index, &blocks_to_save, can_save](Vector3i pos) { - //print_line(String("Immerge {0}").format(varray(pos.to_vec3()))); - unload_data_block_no_lock(lod, data_lod, pos, blocks_to_save, can_save); - }); - }); + prev_box.difference(new_box, [&lod, &data_lod, &blocks_to_save, can_save](Box3i out_of_range_box) { + out_of_range_box.for_each_cell([&lod, &data_lod, &blocks_to_save, can_save](Vector3i pos) { + //print_line(String("Immerge {0}").format(varray(pos.to_vec3()))); + unload_data_block_no_lock(lod, data_lod, pos, blocks_to_save, can_save); + }); + }); } { @@ -345,7 +343,7 @@ static void process_unload_mesh_blocks_sliding_box(VoxelLodTerrainUpdateData::St { VOXEL_PROFILE_SCOPE_NAMED("Cancel updates"); // Cancel block updates that are not within the new region - unordered_remove_if(lod.blocks_pending_update, [&lod, new_box](Vector3i bpos) { // + unordered_remove_if(lod.blocks_pending_update, [new_box](Vector3i bpos) { // return !new_box.contains(bpos); }); }