diff options
author | Lars <larsh@apache.org> | 2023-04-06 09:32:26 -1000 |
---|---|---|
committer | lhofhansl <larsh@apache.org> | 2023-04-09 07:10:17 -1000 |
commit | 4a742be73ef63a8771af1248b2940f10553d40a8 (patch) | |
tree | 55c967b6ff29f5a2a8e5d5ddd7490ab3d208dd37 /src | |
parent | 89829986813549ae7d199ae9a025f97e5982c35e (diff) | |
download | minetest-4a742be73ef63a8771af1248b2940f10553d40a8.tar.xz |
Do not call updateDrawList, updateDrawListShadow, and touchMapBlocks in the same frame
Diffstat (limited to 'src')
-rw-r--r-- | src/client/game.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp index e0f13307f..426fbc453 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -4075,11 +4075,12 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime, runData.update_draw_list_timer += dtime; runData.touch_blocks_timer += dtime; - bool draw_list_updated = false; - float update_draw_list_delta = 0.2f; v3f camera_direction = camera->getDirection(); + + // call only one of updateDrawList, touchMapBlocks, or updateShadow per frame + // (the else-ifs below are intentional) if (runData.update_draw_list_timer >= update_draw_list_delta || runData.update_draw_list_last_cam_dir.getDistanceFrom(camera_direction) > 0.2 || m_camera_offset_changed @@ -4087,15 +4088,10 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime, runData.update_draw_list_timer = 0; client->getEnv().getClientMap().updateDrawList(); runData.update_draw_list_last_cam_dir = camera_direction; - draw_list_updated = true; - } - - if (runData.touch_blocks_timer > update_draw_list_delta && !draw_list_updated) { + } else if (runData.touch_blocks_timer > update_draw_list_delta) { client->getEnv().getClientMap().touchMapBlocks(); runData.touch_blocks_timer = 0; - } - - if (RenderingEngine::get_shadow_renderer()) { + } else if (RenderingEngine::get_shadow_renderer()) { updateShadows(); } |