Fix rounding errors when slicing the shadow draw list (#13226)

This commit is contained in:
x2048 2023-02-20 21:01:05 +01:00 committed by GitHub
parent af4009d924
commit 2553db5c81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -978,9 +978,10 @@ void ClientMap::renderMapShadows(video::IVideoDriver *driver,
std::vector<DrawDescriptor> draw_order; std::vector<DrawDescriptor> draw_order;
int count = 0; std::size_t count = 0;
int low_bound = is_transparent_pass ? 0 : m_drawlist_shadow.size() / total_frames * frame; std::size_t meshes_per_frame = m_drawlist_shadow.size() / total_frames + 1;
int high_bound = is_transparent_pass ? m_drawlist_shadow.size() : m_drawlist_shadow.size() / total_frames * (frame + 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 // transparent pass should be rendered in one go
if (is_transparent_pass && frame != total_frames - 1) { if (is_transparent_pass && frame != total_frames - 1) {