Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/wip5.8.0' into wip5.8.0webport
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Oct 24, 2024
2 parents b41c136 + 11ff040 commit b2e8137
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 29 deletions.
18 changes: 11 additions & 7 deletions build_tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 .


Expand Down
6 changes: 6 additions & 0 deletions build_tools/docker.sh
Original file line number Diff line number Diff line change
@@ -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 "
2 changes: 2 additions & 0 deletions cmake/Modules/FindJson.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
12 changes: 5 additions & 7 deletions src/client/fm_farmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand All @@ -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<std::unordered_set<v3bpos_t>, FARMESH_STEP_MAX> blocks;
runFarAll(draw_control, cbpos, draw_control.cell_size_pow, cbpos.Y ?: 1,
[this, &draw_control, &blocks](
Expand Down Expand Up @@ -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({});
}
Expand Down
13 changes: 6 additions & 7 deletions src/client/fm_farmesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> last_async;
float m_speed{};

#if FARMESH_FAST
constexpr static uint16_t grid_size_max_y{32};
Expand All @@ -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{};

Expand All @@ -115,7 +114,7 @@ class FarMesh
int go_flat();
uint32_t far_iteration_complete{};
bool complete_set{};
uint32_t reset_timestamp{static_cast<uint32_t>(-1)};
uint32_t collect_reset_timestamp{static_cast<uint32_t>(-1)};
uint8_t planes_processed_last{};
concurrent_shared_unordered_map<uint16_t, concurrent_unordered_set<v3bpos_t>>
far_blocks_list;
Expand Down
3 changes: 0 additions & 3 deletions src/fm_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
6 changes: 3 additions & 3 deletions src/mapgen/earth/hgt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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<size_t, size_t, ll_t, ll_t> ll_to_xy(ll_t lat, ll_t lon) override
Expand Down
8 changes: 6 additions & 2 deletions util/autotest/auto.pl
Original file line number Diff line number Diff line change
Expand Up @@ -803,15 +803,19 @@ ()
'-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'
],

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',
Expand Down

0 comments on commit b2e8137

Please sign in to comment.