summaryrefslogtreecommitdiff
path: root/src/clientiface.cpp
diff options
context:
space:
mode:
authorLars Hofhansl <larsh@apache.org>2017-11-15 21:58:23 -0800
committerLars Hofhansl <larsh@apache.org>2017-11-15 22:03:58 -0800
commitae9b1aa1774aedca8f452514d9462c281e36773a (patch)
treed3d4a8d9b8f5b4209bc10548562dbb88906220a5 /src/clientiface.cpp
parentee6bb5a315cc13aa51cda509d02780c21333af44 (diff)
downloadminetest-ae9b1aa1774aedca8f452514d9462c281e36773a.tar.gz
minetest-ae9b1aa1774aedca8f452514d9462c281e36773a.tar.bz2
minetest-ae9b1aa1774aedca8f452514d9462c281e36773a.zip
Allow zoom to actually show more data.
This allows the client to retrieve blocks at a greater distance from the server, thus allowing for a real zoom.
Diffstat (limited to 'src/clientiface.cpp')
-rw-r--r--src/clientiface.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/clientiface.cpp b/src/clientiface.cpp
index bf0bdade0..8e469cafb 100644
--- a/src/clientiface.cpp
+++ b/src/clientiface.cpp
@@ -196,6 +196,20 @@ void RemoteClient::GetNextBlocks (
s16 wanted_range = sao->getWantedRange() + 1;
float camera_fov = sao->getFov();
+ const s16 full_d_max = std::min(adjustDist(m_max_send_distance, camera_fov), wanted_range);
+ const s16 d_opt = std::min(adjustDist(m_block_optimize_distance, camera_fov), wanted_range);
+ const s16 d_blocks_in_sight = full_d_max * BS * MAP_BLOCKSIZE;
+ infostream << "Fov from client " << camera_fov << " full_d_max " << full_d_max << std::endl;
+
+ s16 d_max = full_d_max;
+ s16 d_max_gen = std::min(adjustDist(m_max_gen_distance, camera_fov), wanted_range);
+
+ // Don't loop very much at a time, adjust with distance,
+ // do more work per RTT with greater distances.
+ s16 max_d_increment_at_time = full_d_max / 9 + 1;
+ if (d_max > d_start + max_d_increment_at_time)
+ d_max = d_start + max_d_increment_at_time;
+
// cos(angle between velocity and camera) * |velocity|
// Limit to 0.0f in case player moves backwards.
f32 dot = rangelim(camera_dir.dotProduct(playerspeed), 0.0f, 300.0f);
@@ -204,19 +218,6 @@ void RemoteClient::GetNextBlocks (
// limit max fov effect to 50%, 60% at 20n/s fly speed
camera_fov = camera_fov / (1 + dot / 300.0f);
- const s16 full_d_max = std::min(m_max_send_distance, wanted_range);
- const s16 d_opt = std::min(m_block_optimize_distance, wanted_range);
- const s16 d_blocks_in_sight = full_d_max * BS * MAP_BLOCKSIZE;
- //infostream << "Fov from client " << camera_fov << " full_d_max " << full_d_max << std::endl;
-
- s16 d_max = full_d_max;
- s16 d_max_gen = std::min(m_max_gen_distance, wanted_range);
-
- // Don't loop very much at a time
- s16 max_d_increment_at_time = 2;
- if (d_max > d_start + max_d_increment_at_time)
- d_max = d_start + max_d_increment_at_time;
-
s32 nearest_emerged_d = -1;
s32 nearest_emergefull_d = -1;
s32 nearest_sent_d = -1;