From ba4b704ebf24952ab9a84c914b8ad6c45dabfaba Mon Sep 17 00:00:00 2001 From: Lars Hofhansl Date: Mon, 27 Feb 2017 23:06:15 -0800 Subject: Allow server side occlusion culling. --- src/clientiface.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/clientiface.cpp') diff --git a/src/clientiface.cpp b/src/clientiface.cpp index 0eb68c9c1..76a34c392 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -197,6 +197,9 @@ void RemoteClient::GetNextBlocks ( s32 nearest_sent_d = -1; //bool queue_is_full = false; + const v3s16 cam_pos_nodes = floatToInt(camera_pos, BS); + const bool occ_cull = g_settings->getBool("server_side_occlusion_culling"); + s16 d; for(d = d_start; d <= d_max; d++) { /* @@ -298,6 +301,11 @@ void RemoteClient::GetNextBlocks ( if(block->getDayNightDiff() == false) continue; } + + if (occ_cull && !block_is_invalid && + env->getMap().isBlockOccluded(block, cam_pos_nodes)) { + continue; + } } /* -- cgit v1.2.3