aboutsummaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2023-01-31 17:30:59 +0100
committerGitHub <noreply@github.com>2023-01-31 17:30:59 +0100
commit69fc20610947610b7829f3bfad82e23ed705b764 (patch)
tree775cb27a4875a071fccddee87b80730e39ed9b14 /src/map.cpp
parentcded6a3945206e51c35adbd063f1aec3a47e310f (diff)
downloadminetest-69fc20610947610b7829f3bfad82e23ed705b764.tar.xz
8x block meshes (#13133)
Reduce the number of drawcalls by generating a mesh per 8 blocks (2x2x2). Only blocks with even coordinates (lowest bit set to 0) will get a mesh. Note: This also removes the old 'loops' algorithm for building the draw list, because it produces visual artifacts and cannot be made compatible with the approach of having a mesh for every 8th block without hurting performance. Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com> Co-authored-by: Lars <larsh@apache.org> Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp
index cfe5f126d..59d1a925d 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -325,6 +325,7 @@ void Map::timerUpdate(float dtime, float unload_timeout, s32 max_loaded_blocks,
u32 deleted_blocks_count = 0;
u32 saved_blocks_count = 0;
u32 block_count_all = 0;
+ u32 locked_blocks = 0;
const auto start_time = porting::getTimeUs();
beginSave();
@@ -396,8 +397,10 @@ void Map::timerUpdate(float dtime, float unload_timeout, s32 max_loaded_blocks,
MapBlock *block = b.block;
- if (block->refGet() != 0)
+ if (block->refGet() != 0) {
+ locked_blocks++;
continue;
+ }
v3s16 p = block->getPos();
@@ -442,7 +445,7 @@ void Map::timerUpdate(float dtime, float unload_timeout, s32 max_loaded_blocks,
<<" blocks from memory";
if(save_before_unloading)
infostream<<", of which "<<saved_blocks_count<<" were written";
- infostream<<", "<<block_count_all<<" blocks in memory";
+ infostream<<", "<<block_count_all<<" blocks in memory, " << locked_blocks << " locked";
infostream<<"."<<std::endl;
if(saved_blocks_count != 0){
PrintInfo(infostream); // ServerMap/ClientMap: