diff options
author | x2048 <codeforsmile@gmail.com> | 2023-02-20 21:01:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 21:01:05 +0100 |
commit | 2553db5c81fe43fb5137e44da5314518f42d1f4b (patch) | |
tree | 0f4d828b50b0bd150a968dbc945ab551704bedee /src/client/clientmap.cpp | |
parent | af4009d92493f43b43e83c799a694117316f2884 (diff) | |
download | minetest-2553db5c81fe43fb5137e44da5314518f42d1f4b.tar.xz |
Fix rounding errors when slicing the shadow draw list (#13226)
Diffstat (limited to 'src/client/clientmap.cpp')
-rw-r--r-- | src/client/clientmap.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/clientmap.cpp b/src/client/clientmap.cpp index 39c811b85..d987a2ee3 100644 --- a/src/client/clientmap.cpp +++ b/src/client/clientmap.cpp @@ -978,9 +978,10 @@ void ClientMap::renderMapShadows(video::IVideoDriver *driver, std::vector<DrawDescriptor> draw_order; - int count = 0; - int low_bound = is_transparent_pass ? 0 : m_drawlist_shadow.size() / total_frames * frame; - int high_bound = is_transparent_pass ? m_drawlist_shadow.size() : m_drawlist_shadow.size() / total_frames * (frame + 1); + std::size_t count = 0; + std::size_t meshes_per_frame = m_drawlist_shadow.size() / total_frames + 1; + std::size_t low_bound = is_transparent_pass ? 0 : meshes_per_frame * frame; + std::size_t high_bound = is_transparent_pass ? m_drawlist_shadow.size() : meshes_per_frame * (frame + 1); // transparent pass should be rendered in one go if (is_transparent_pass && frame != total_frames - 1) { |