Tools/mmaps_generator: Mak percentage progress slightly more accurate
#18832
This commit is contained in:
1 parent
bbb5e23830
commit
9401fd3621
2 files changed
+12
-16
No files matched your search
@@ -64,6 +64,8 @@ namespace MMAP
|
|||||||
m_skipBattlegrounds (skipBattlegrounds),
|
m_skipBattlegrounds (skipBattlegrounds),
|
||||||
m_maxWalkableAngle (maxWalkableAngle),
|
m_maxWalkableAngle (maxWalkableAngle),
|
||||||
m_bigBaseUnit (bigBaseUnit),
|
m_bigBaseUnit (bigBaseUnit),
|
||||||
|
m_totalTiles (0u),
|
||||||
|
m_totalTilesProcessed(0u),
|
||||||
m_rcContext (NULL),
|
m_rcContext (NULL),
|
||||||
_cancelationToken (false)
|
_cancelationToken (false)
|
||||||
{
|
{
|
||||||
@@ -71,10 +73,6 @@ namespace MMAP
|
|||||||
|
|
||||||
m_rcContext = new rcContext(false);
|
m_rcContext = new rcContext(false);
|
||||||
|
|
||||||
// percentageDone - Initializing
|
|
||||||
m_totalTiles = 0;
|
|
||||||
m_totalTilesBuilt = 0;
|
|
||||||
|
|
||||||
discoverTiles();
|
discoverTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,8 +153,7 @@ namespace MMAP
|
|||||||
}
|
}
|
||||||
printf("found %u.\n\n", count);
|
printf("found %u.\n\n", count);
|
||||||
|
|
||||||
// percentageDone - total tiles to process
|
m_totalTiles.store(count, std::memory_order_relaxed);
|
||||||
m_totalTiles = count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
@@ -391,7 +388,8 @@ namespace MMAP
|
|||||||
// add all tiles within bounds to tile list.
|
// add all tiles within bounds to tile list.
|
||||||
for (uint32 i = minX; i <= maxX; ++i)
|
for (uint32 i = minX; i <= maxX; ++i)
|
||||||
for (uint32 j = minY; j <= maxY; ++j)
|
for (uint32 j = minY; j <= maxY; ++j)
|
||||||
tiles->insert(StaticMapTree::packTileID(i, j));
|
if (tiles->insert(StaticMapTree::packTileID(i, j)).second)
|
||||||
|
++m_totalTiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tiles->empty())
|
if (!tiles->empty())
|
||||||
@@ -402,6 +400,7 @@ namespace MMAP
|
|||||||
if (!navMesh)
|
if (!navMesh)
|
||||||
{
|
{
|
||||||
printf("[Map %03i] Failed creating navmesh!\n", mapID);
|
printf("[Map %03i] Failed creating navmesh!\n", mapID);
|
||||||
|
m_totalTilesProcessed += tiles->size();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,6 +413,7 @@ namespace MMAP
|
|||||||
// unpack tile coords
|
// unpack tile coords
|
||||||
StaticMapTree::unpackTileID((*it), tileX, tileY);
|
StaticMapTree::unpackTileID((*it), tileX, tileY);
|
||||||
|
|
||||||
|
++m_totalTilesProcessed;
|
||||||
if (shouldSkipTile(mapID, tileX, tileY))
|
if (shouldSkipTile(mapID, tileX, tileY))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -429,8 +429,7 @@ namespace MMAP
|
|||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
void MapBuilder::buildTile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh* navMesh)
|
void MapBuilder::buildTile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh* navMesh)
|
||||||
{
|
{
|
||||||
// percentageDone - added, now it will show addional reference percentage done of the overall process
|
printf("%u%% [Map %03i] Building tile [%02u,%02u]\n", percentageDone(m_totalTiles, m_totalTilesProcessed), mapID, tileX, tileY);
|
||||||
printf("%u%% [Map %03i] Building tile [%02u,%02u]\n", percentageDone(m_totalTiles, m_totalTilesBuilt), mapID, tileX, tileY);
|
|
||||||
|
|
||||||
MeshData meshData;
|
MeshData meshData;
|
||||||
|
|
||||||
@@ -464,9 +463,6 @@ namespace MMAP
|
|||||||
|
|
||||||
// build navmesh tile
|
// build navmesh tile
|
||||||
buildMoveMapTile(mapID, tileX, tileY, meshData, bmin, bmax, navMesh);
|
buildMoveMapTile(mapID, tileX, tileY, meshData, bmin, bmax, navMesh);
|
||||||
|
|
||||||
// percentageDone - increment tiles built
|
|
||||||
m_totalTilesBuilt++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ namespace MMAP
|
|||||||
bool shouldSkipMap(uint32 mapID);
|
bool shouldSkipMap(uint32 mapID);
|
||||||
bool isTransportMap(uint32 mapID);
|
bool isTransportMap(uint32 mapID);
|
||||||
bool shouldSkipTile(uint32 mapID, uint32 tileX, uint32 tileY);
|
bool shouldSkipTile(uint32 mapID, uint32 tileX, uint32 tileY);
|
||||||
// percentageDone - method to calculate percentage
|
|
||||||
uint32 percentageDone(uint32 totalTiles, uint32 totalTilesDone);
|
uint32 percentageDone(uint32 totalTiles, uint32 totalTilesDone);
|
||||||
|
|
||||||
TerrainBuilder* m_terrainBuilder;
|
TerrainBuilder* m_terrainBuilder;
|
||||||
@@ -138,9 +138,9 @@ namespace MMAP
|
|||||||
|
|
||||||
float m_maxWalkableAngle;
|
float m_maxWalkableAngle;
|
||||||
bool m_bigBaseUnit;
|
bool m_bigBaseUnit;
|
||||||
// percentageDone - variables to calculate percentage
|
|
||||||
uint32 m_totalTiles;
|
std::atomic<uint32> m_totalTiles;
|
||||||
std::atomic<uint32> m_totalTilesBuilt;
|
std::atomic<uint32> m_totalTilesProcessed;
|
||||||
|
|
||||||
// build performance - not really used for now
|
// build performance - not really used for now
|
||||||
rcContext* m_rcContext;
|
rcContext* m_rcContext;
|
||||||
|
|||||||
Reference in new issue
Block a user