1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Allow cheaper culling checks at a distance (#14073)

* Allow cheaper culling checks at a distance
* Pick a random ray, so that far missing block will eventually be shown
This commit is contained in:
lhofhansl 2023-12-16 15:04:21 -08:00 committed by GitHub
parent 16c22477c2
commit ca1a723890
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 5 deletions

View file

@ -59,6 +59,7 @@ RemoteClient::RemoteClient() :
g_settings->getFloat("full_block_send_enable_min_time_from_building")),
m_max_send_distance(g_settings->getS16("max_block_send_distance")),
m_block_optimize_distance(g_settings->getS16("block_send_optimize_distance")),
m_block_cull_optimize_distance(g_settings->getS16("block_cull_optimize_distance")),
m_max_gen_distance(g_settings->getS16("max_block_generate_distance")),
m_occ_cull(g_settings->getBool("server_side_occlusion_culling"))
{
@ -225,6 +226,8 @@ void RemoteClient::GetNextBlocks (
wanted_range);
const s16 d_opt = std::min(adjustDist(m_block_optimize_distance, prop_zoom_fov),
wanted_range);
const s16 d_cull_opt = std::min(adjustDist(m_block_cull_optimize_distance, prop_zoom_fov),
wanted_range);
const s16 d_blocks_in_sight = full_d_max * BS * MAP_BLOCKSIZE;
s16 d_max_gen = std::min(adjustDist(m_max_gen_distance, prop_zoom_fov),
@ -355,7 +358,7 @@ void RemoteClient::GetNextBlocks (
continue;
if (m_occ_cull && !block_not_found &&
env->getMap().isBlockOccluded(block, cam_pos_nodes)) {
env->getMap().isBlockOccluded(block, cam_pos_nodes, d >= d_cull_opt)) {
m_blocks_occ.insert(p);
continue;
}