diff options
author | Lars <larsh@apache.org> | 2023-04-03 12:14:07 -0700 |
---|---|---|
committer | lhofhansl <larsh@apache.org> | 2023-04-03 13:57:05 -0700 |
commit | 7048fc25dd963490552214e15d5e9a4c612d6b18 (patch) | |
tree | 84b29daa857c27a2d9ab036bf31e65de4479611c /src | |
parent | b01f85d573b5366db9ab16afad4f4e191e46bea2 (diff) | |
download | minetest-7048fc25dd963490552214e15d5e9a4c612d6b18.tar.xz |
Take mesh-bounding-sphere into account in updateDrawListShadow
Diffstat (limited to 'src')
-rw-r--r-- | src/client/clientmap.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/client/clientmap.cpp b/src/client/clientmap.cpp index e50652ff4..e99e6b89d 100644 --- a/src/client/clientmap.cpp +++ b/src/client/clientmap.cpp @@ -1237,8 +1237,6 @@ void ClientMap::updateDrawListShadow(v3f shadow_light_pos, v3f shadow_light_dir, u32 blocks_loaded = 0; // Number of blocks with mesh in rendering range u32 blocks_in_range_with_mesh = 0; - // Number of blocks occlusion culled - u32 blocks_occlusion_culled = 0; for (auto §or_it : m_sectors) { MapSector *sector = sector_it.second; @@ -1253,14 +1251,15 @@ void ClientMap::updateDrawListShadow(v3f shadow_light_pos, v3f shadow_light_dir, Loop through blocks in sector */ for (MapBlock *block : sectorblocks) { - if (!block->mesh) { + MapBlockMesh *mesh = block->mesh; + if (!mesh) { // Ignore if mesh doesn't exist continue; } - v3f block_pos = intToFloat(block->getPos() * MAP_BLOCKSIZE, BS); + v3f block_pos = intToFloat(block->getPos() * MAP_BLOCKSIZE, BS) + mesh->getBoundingSphereCenter(); v3f projection = shadow_light_pos + shadow_light_dir * shadow_light_dir.dotProduct(block_pos - shadow_light_pos); - if (projection.getDistanceFrom(block_pos) > radius) + if (projection.getDistanceFrom(block_pos) > (radius + mesh->getBoundingRadius())) continue; blocks_in_range_with_mesh++; @@ -1276,7 +1275,6 @@ void ClientMap::updateDrawListShadow(v3f shadow_light_pos, v3f shadow_light_dir, } g_profiler->avg("SHADOW MapBlock meshes in range [#]", blocks_in_range_with_mesh); - g_profiler->avg("SHADOW MapBlocks occlusion culled [#]", blocks_occlusion_culled); g_profiler->avg("SHADOW MapBlocks drawn [#]", m_drawlist_shadow.size()); g_profiler->avg("SHADOW MapBlocks loaded [#]", blocks_loaded); } |