mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Reorganize ClientMap rendering code for a bit more performance
- Don't select blocks for drawing in every frame - Sort meshbuffers by material before drawing
This commit is contained in:
parent
0e6f7a21c6
commit
ee2d9d973a
6 changed files with 281 additions and 101 deletions
17
src/game.cpp
17
src/game.cpp
|
@ -1235,6 +1235,9 @@ void the_game(
|
|||
float object_hit_delay_timer = 0.0;
|
||||
float time_from_last_punch = 10;
|
||||
|
||||
float update_draw_list_timer = 0.0;
|
||||
v3f update_draw_list_last_cam_dir;
|
||||
|
||||
bool invert_mouse = g_settings->getBool("invert_mouse");
|
||||
|
||||
bool respawn_menu_active = false;
|
||||
|
@ -2697,7 +2700,19 @@ void the_game(
|
|||
item = mlist->getItem(client.getPlayerItem());
|
||||
camera.wield(item);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Update block draw list every 200ms or when camera direction has
|
||||
changed much
|
||||
*/
|
||||
update_draw_list_timer += dtime;
|
||||
if(update_draw_list_timer >= 0.2 ||
|
||||
update_draw_list_last_cam_dir.getDistanceFrom(camera_direction) > 0.2){
|
||||
update_draw_list_timer = 0;
|
||||
client.getEnv().getClientMap().updateDrawList(driver);
|
||||
update_draw_list_last_cam_dir = camera_direction;
|
||||
}
|
||||
|
||||
/*
|
||||
Drawing begins
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue