Retrieve mapblocks from the server in a sphere, not a cube
authorLars Hofhansl <larsh@apache.org>
Fri, 4 Nov 2016 07:14:07 +0000 (00:14 -0700)
committerparamat <mat.gregory@virginmedia.com>
Tue, 8 Nov 2016 15:15:27 +0000 (15:15 +0000)
Use unused range argument in 'isBlockInSight()' to limit mapblock sends
to a sphere of radius 'max block send distance'.

src/clientiface.cpp

index 4b9efcb49959b4104697c6133a0b1bc91733f3bb..7e75c69a48656fbe87f27f016041eaa5b0f70ec2 100644 (file)
@@ -175,6 +175,7 @@ void RemoteClient::GetNextBlocks (
 
        const s16 full_d_max = g_settings->getS16("max_block_send_distance");
        const s16 d_opt = g_settings->getS16("block_send_optimize_distance");
+       const s16 d_blocks_in_sight = (full_d_max + 1) * BS * MAP_BLOCKSIZE;
 
        s16 d_max = full_d_max;
        s16 d_max_gen = g_settings->getS16("max_block_generate_distance");
@@ -242,7 +243,7 @@ void RemoteClient::GetNextBlocks (
                        */
 
                        float camera_fov = (72.0*M_PI/180) * 4./3.;
-                       if(isBlockInSight(p, camera_pos, camera_dir, camera_fov, 10000*BS) == false)
+                       if(isBlockInSight(p, camera_pos, camera_dir, camera_fov, d_blocks_in_sight) == false)
                        {
                                continue;
                        }