From b5d41a35c388db377edda60c01969fe0fa113ca4 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 5 Oct 2025 14:14:37 +0200 Subject: [PATCH] Keep track of decoded/rendered blocks and fix small oversight in previous commit --- src/TileGenerator.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/TileGenerator.cpp b/src/TileGenerator.cpp index d0f9c52..8cbd7ca 100644 --- a/src/TileGenerator.cpp +++ b/src/TileGenerator.cpp @@ -544,7 +544,7 @@ void TileGenerator::renderMap() BlockDecoder blk; const int16_t yMax = mod16(m_yMax) + 1; const int16_t yMin = mod16(m_yMin); - size_t count = 0; + size_t bTotal = 0, bRender = 0, bEmpty = 0; // returns true to skip auto decode = [&] (BlockPos pos, const ustring &buf) -> bool { @@ -560,6 +560,9 @@ void TileGenerator::renderMap() }; auto renderSingle = [&] (int16_t xPos, int16_t zPos, BlockList &blockStack) { + if (blockStack.empty()) + return; + m_readPixels.reset(); m_readInfo.reset(); for (int i = 0; i < 16; i++) { @@ -570,12 +573,17 @@ void TileGenerator::renderMap() } } + bTotal += blockStack.size(); for (const auto &it : blockStack) { const BlockPos pos = it.first; assert(pos.x == xPos && pos.z == zPos); assert(pos.y >= yMin && pos.y < yMax); - decode(pos, it.second); + if (decode(pos, it.second)) { + bEmpty++; + continue; + } + bRender++; renderMapBlock(blk, pos); // Exit out if all pixels for this MapBlock are covered @@ -591,6 +599,7 @@ void TileGenerator::renderMap() renderShading(zPos); }; + size_t count = 0; // fraction of m_progressMax if (m_exhaustiveSearch == EXH_NEVER) { for (auto it = m_positions.rbegin(); it != m_positions.rend(); ++it) { int16_t zPos = it->first; @@ -656,6 +665,8 @@ void TileGenerator::renderMap() } reportProgress(m_progressMax); + verbosestream << "Block stats: " << bTotal << " total, " << bRender + << " rendered, " << bEmpty << " empty" << std::endl; } void TileGenerator::renderMapBlock(const BlockDecoder &blk, const BlockPos &pos)