diff --git a/build_tools/build.sh b/build_tools/build.sh index 03ebfdf4c..3482c0dd4 100755 --- a/build_tools/build.sh +++ b/build_tools/build.sh @@ -11,17 +11,21 @@ set -x # curl https://raw.githubusercontent.com/freeminer/freeminer/master/build_tools/build.sh | sh #1. To compile need to install packages: -DIST=${DIST=`lsb_release --short --id`} ||: -DIST=${DIST=`cat /etc/issue /etc/issue.net | head -n1 | cut -d " " -f1`} +DIST=${DIST:=$(lsb_release --short --id)} ||: +DIST=${DIST:=$(cat /etc/issue /etc/issue.net | head -n1 | cut -d " " -f1)} +DIST=${DIST:=$(sh -c '. /etc/os-release && echo $NAME')} + if [ -z "$NO_DEPS" ]; then + SUDO=${SUDO=$(which sudo ||:)} if [ "$DIST" = "Debian" ] || [ "$DIST" = "Ubuntu" ]; then - sudo apt install -y git subversion build-essential cmake ninja-build ccache libbz2-dev libzstd-dev libjpeg-dev libfreetype6-dev libxxf86vm-dev libxi-dev libsqlite3-dev libhiredis-dev libvorbis-dev libopenal-dev libcurl4-openssl-dev libssl-dev libluajit-5.1-dev libgettextpo0 libmsgpack-dev libboost-system-dev clang lld llvm libc++-dev libc++abi-dev + ${SUDO} apt update + ${SUDO} env DEBIAN_FRONTEND=noninteractive apt install -y git subversion build-essential cmake ninja-build ccache libbz2-dev libzstd-dev libjpeg-dev libfreetype6-dev libxxf86vm-dev libxi-dev libsqlite3-dev libhiredis-dev libvorbis-dev libopenal-dev libcurl4-openssl-dev libssl-dev libluajit-5.1-dev libgettextpo0 libmsgpack-dev libboost-system-dev clang lld llvm libc++-dev libc++abi-dev for PACKAGE in libpng12-dev libpng-dev libgles1-mesa-dev libgles2-mesa-dev libgl1-mesa-dev ; do - sudo apt install -y $PACKAGE ||: + ${SUDO} apt install -y $PACKAGE ||: done elif [ -e /etc/arch-release ]; then - sudo pacman --needed --noconfirm -S git subversion cmake ninja ccache bzip2 zstd libjpeg-turbo freetype2 glfw-x11 libxxf86vm libxi sqlite3 hiredis libvorbis openal curl luajit gettext msgpack-cxx boost clang lld llvm libc++ libc++abi libpng12 libpng libunwind - echo Todo + ${SUDO} pacman --needed --noconfirm -Sy which git subversion cmake ninja ccache bzip2 zstd libjpeg-turbo freetype2 glfw-x11 libxxf86vm libxi sqlite3 hiredis libvorbis openal curl luajit gettext msgpack-cxx boost clang lld llvm libc++ libc++abi libpng12 libpng libunwind + CMAKE_OPT=${CMAKE_OPT=-DCMAKE_BUILD_WITH_INSTALL_RPATH=1} fi fi @@ -44,7 +48,7 @@ git pull --rebase ||: git submodule update --init --recursive ||: #compile -cmake .. -GNinja -DENABLE_GLES=1 -DCMAKE_C_COMPILER=`which clang` -DCMAKE_CXX_COMPILER=`which clang++` +cmake .. -GNinja -DENABLE_GLES=1 -DCMAKE_C_COMPILER=`which clang` -DCMAKE_CXX_COMPILER=`which clang++` ${CMAKE_OPT} nice cmake --build . diff --git a/build_tools/docker.sh b/build_tools/docker.sh new file mode 100755 index 000000000..332118372 --- /dev/null +++ b/build_tools/docker.sh @@ -0,0 +1,6 @@ +# IMAGE=ubuntu ./docker.sh +# IMAGE=debian ./docker.sh +# IMAGE=manjarolinux ./docker.sh +# IMAGE=archlinux ./docker.sh + +docker run -v $(pwd)/..:/work -it ${IMAGE=ubuntu} bash -c " cd /work && build_tools/build.sh " diff --git a/cmake/Modules/FindJson.cmake b/cmake/Modules/FindJson.cmake index f0d70861e..cd2f37471 100644 --- a/cmake/Modules/FindJson.cmake +++ b/cmake/Modules/FindJson.cmake @@ -1,7 +1,9 @@ # Look for JsonCpp, with fallback to bundeled version mark_as_advanced(JSON_LIBRARY JSON_INCLUDE_DIR) +if (NOT USE_LIBCXX) option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JsonCpp" TRUE) +endif() set(USE_SYSTEM_JSONCPP FALSE) if(ENABLE_SYSTEM_JSONCPP) diff --git a/src/client/fm_farmesh.cpp b/src/client/fm_farmesh.cpp index 1b26d0f0e..2e7eaf391 100644 --- a/src/client/fm_farmesh.cpp +++ b/src/client/fm_farmesh.cpp @@ -96,8 +96,8 @@ void FarMesh::makeFarBlock(const v3bpos_t &blockpos, block_step_t step, bool nea block.reset(client_map.createBlankBlockNoInsert(blockpos_actual)); block->far_step = step; - reset_timestamp = block->far_make_mesh_timestamp = - m_client->m_uptime + wait_server_far_bock; + collect_reset_timestamp = block->far_make_mesh_timestamp = + m_client->m_uptime + wait_server_far_block + step; far_blocks.insert_or_assign(blockpos_actual, block); ++m_client->m_new_meshes; } @@ -254,9 +254,6 @@ FarMesh::FarMesh(Client *client, Server *server, MapDrawControl *control) : FarMesh::~FarMesh() { - if (last_async.valid()) { - last_async.wait(); - } } auto align_shift(auto pos, const auto amount) @@ -279,6 +276,7 @@ int FarMesh::go_flat() const auto cbpos = getNodeBlockPos(m_camera_pos_aligned); + // todo: maybe save blocks while cam pos not changed std::array, FARMESH_STEP_MAX> blocks; runFarAll(draw_control, cbpos, draw_control.cell_size_pow, cbpos.Y ?: 1, [this, &draw_control, &blocks]( @@ -543,8 +541,8 @@ uint8_t FarMesh::update(v3opos_t camera_pos, m_client->m_new_farmeshes = 0; plane_processed.fill({}); } - if (m_client->m_uptime > reset_timestamp) { - reset_timestamp = -1; + if (m_client->m_uptime > collect_reset_timestamp) { + collect_reset_timestamp = -1; plane_processed.fill({}); direction_caches.fill({}); } diff --git a/src/client/fm_farmesh.h b/src/client/fm_farmesh.h index 122b03543..49d9559e4 100644 --- a/src/client/fm_farmesh.h +++ b/src/client/fm_farmesh.h @@ -69,12 +69,11 @@ class FarMesh f32 m_camera_fov; f32 m_camera_pitch; f32 m_camera_yaw;*/ - Client *m_client; - MapDrawControl *m_control; + Client *m_client{}; + MapDrawControl *m_control{}; pos_t distance_min{MAP_BLOCKSIZE * 9}; //v3pos_t m_camera_offset; - float m_speed; - std::future last_async; + float m_speed{}; #if FARMESH_FAST constexpr static uint16_t grid_size_max_y{32}; @@ -90,8 +89,8 @@ class FarMesh static constexpr uint16_t grid_size_y{grid_size_max_y}; static constexpr uint16_t grid_size_xy{grid_size_x * grid_size_y}; - static constexpr uint8_t wait_server_far_bock{ - 5}; // minimum 1 ; maybe make dynamic depend on avg server ask/response time, or on fast mode + static constexpr uint8_t wait_server_far_block{ + 3}; // minimum 1 ; maybe make dynamic depend on avg server ask/response time, or on fast mode Mapgen *mg{}; @@ -115,7 +114,7 @@ class FarMesh int go_flat(); uint32_t far_iteration_complete{}; bool complete_set{}; - uint32_t reset_timestamp{static_cast(-1)}; + uint32_t collect_reset_timestamp{static_cast(-1)}; uint8_t planes_processed_last{}; concurrent_shared_unordered_map> far_blocks_list; diff --git a/src/fm_map.cpp b/src/fm_map.cpp index c5138ff75..20b69a711 100644 --- a/src/fm_map.cpp +++ b/src/fm_map.cpp @@ -390,9 +390,6 @@ u32 Map::timerUpdate(float uptime, float unload_timeout, s32 max_loaded_blocks, : &m_blocks_delete_1); if (!m_blocks_delete->empty()) verbosestream << "Deleting blocks=" << m_blocks_delete->size() << std::endl; - for (auto &ir : *m_blocks_delete) { - //delete ir.first; - } m_blocks_delete->clear(); getBlockCacheFlush(); const thread_local static auto block_delete_time = diff --git a/src/mapgen/earth/hgt.h b/src/mapgen/earth/hgt.h index 5cf935706..eff777664 100644 --- a/src/mapgen/earth/hgt.h +++ b/src/mapgen/earth/hgt.h @@ -75,7 +75,7 @@ class height_hgt : public height bool load(ll_t lat, ll_t lon) override; }; -class height_tif : public height +class height_tif final : public height { const std::string folder; int lat_loading = 200; @@ -89,7 +89,7 @@ class height_tif : public height bool load(ll_t lat, ll_t lon) override; }; -class height_gebco_tif : public height +class height_gebco_tif final : public height { const std::string folder; int lat_loading = 200; @@ -108,7 +108,7 @@ class height_gebco_tif : public height static int lon90_start(ll_t lon); }; -class height_dummy : public height +class height_dummy final : public height { protected: std::tuple ll_to_xy(ll_t lat, ll_t lon) override diff --git a/util/autotest/auto.pl b/util/autotest/auto.pl index 53b86d268..ec8bee7bf 100755 --- a/util/autotest/auto.pl +++ b/util/autotest/auto.pl @@ -803,7 +803,9 @@ () '-fixed_map_seed' => 1, '--autoexit' => $options->{pass}{autoexit} || 300, -max_block_generate_distance => 100, '-max_block_send_distance' => 100, '----fly' => 1, '----forward' => 1, '---world_clear' => 1, '---world' => $script_path . 'world_bench', - '-static_spawnpoint' => '(0,25,0)', + '-static_spawnpoint' => '(0,60,0)', + '-fps_max' => 120, + '-fps_max_unfocused' => 120, }, 'fly' ], @@ -811,7 +813,9 @@ () bench1 => [{ '-fixed_map_seed' => 1, '--autoexit' => $options->{pass}{autoexit} || 300, -max_block_generate_distance => 100, '-max_block_send_distance' => 100, '---world_clear' => 1, '--world' => $script_path . 'world_bench1', - -mg_name => 'math', '-static_spawnpoint' => "(0,20000,0)", + -mg_name => 'math', '-static_spawnpoint' => "(0,20202,0)", + '-fps_max' => 120, + '-fps_max_unfocused' => 120, }, 'set_client', 'build',