diff options
author | lhofhansl <larsh@apache.org> | 2022-10-28 09:52:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-28 09:52:54 -0700 |
commit | b8292319924994352d56d6111faa73fe315d149a (patch) | |
tree | 32bd3eeb0824b82e77ddcdf0b8eb5ea545781538 /src/client/clientmap.cpp | |
parent | 9aaed75eea0145ef3ee88bdd6d5507e5fd8d76c2 (diff) | |
download | minetest-b8292319924994352d56d6111faa73fe315d149a.tar.xz |
Fix incorrect culling introduced by ##12710 (#12887)
Diffstat (limited to 'src/client/clientmap.cpp')
-rw-r--r-- | src/client/clientmap.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/clientmap.cpp b/src/client/clientmap.cpp index b74499ac3..3b6a319f3 100644 --- a/src/client/clientmap.cpp +++ b/src/client/clientmap.cpp @@ -259,11 +259,13 @@ void ClientMap::updateDrawList() } v3s16 block_coord = block->getPos(); - v3s16 block_position = block->getPosRelative() + MAP_BLOCKSIZE / 2; - - // First, perform a simple distance check, with a padding of one extra block. + v3f mesh_sphere_center = intToFloat(block->getPosRelative(), BS) + + block->mesh->getBoundingSphereCenter(); + f32 mesh_sphere_radius = block->mesh->getBoundingRadius(); + // First, perform a simple distance check. if (!m_control.range_all && - block_position.getDistanceFrom(cam_pos_nodes) > m_control.wanted_range) + mesh_sphere_center.getDistanceFrom(intToFloat(cam_pos_nodes, BS)) > + m_control.wanted_range * BS + mesh_sphere_radius) continue; // Out of range, skip. // Keep the block alive as long as it is in range. @@ -274,9 +276,6 @@ void ClientMap::updateDrawList() // Only do coarse culling here, to account for fast camera movement. // This is needed because this function is not called every frame. constexpr float frustum_cull_extra_radius = 300.0f; - v3f mesh_sphere_center = intToFloat(block->getPosRelative(), BS) - + block->mesh->getBoundingSphereCenter(); - f32 mesh_sphere_radius = block->mesh->getBoundingRadius(); if (is_frustum_culled(mesh_sphere_center, mesh_sphere_radius + frustum_cull_extra_radius)) continue; |