AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
MMAP::MapBuilder Class Reference

#include "MapBuilder.h"

Public Member Functions

 MapBuilder (float maxWalkableAngle, bool skipLiquid, bool skipContinents, bool skipJunkMaps, bool skipBattlegrounds, bool debugOutput, bool bigBaseUnit, int mapid, char const *offMeshFilePath, unsigned int threads)
 
 ~MapBuilder ()
 
void buildMeshFromFile (char *name)
 
void buildSingleTile (uint32 mapID, uint32 tileX, uint32 tileY)
 
void buildMaps (Optional< uint32 > mapID)
 

Private Member Functions

void buildMap (uint32 mapID)
 
void discoverTiles ()
 
std::set< uint32 > * getTileList (uint32 mapID)
 
void buildNavMesh (uint32 mapID, dtNavMesh *&navMesh)
 
void getTileBounds (uint32 tileX, uint32 tileY, float *verts, int vertCount, float *bmin, float *bmax) const
 
void getGridBounds (uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY) const
 
bool shouldSkipMap (uint32 mapID) const
 
bool isTransportMap (uint32 mapID) const
 
bool isContinentMap (uint32 mapID) const
 
rcConfig GetMapSpecificConfig (uint32 mapID, float bmin[3], float bmax[3], const TileConfig &tileConfig) const
 
uint32 percentageDone (uint32 totalTiles, uint32 totalTilesDone) const
 
uint32 currentPercentageDone () const
 

Private Attributes

TerrainBuilderm_terrainBuilder {nullptr}
 
TileList m_tiles
 
bool m_debugOutput
 
const char * m_offMeshFilePath
 
unsigned int m_threads
 
bool m_skipContinents
 
bool m_skipJunkMaps
 
bool m_skipBattlegrounds
 
bool m_skipLiquid
 
float m_maxWalkableAngle
 
bool m_bigBaseUnit
 
int32 m_mapid
 
std::atomic< uint32m_totalTiles
 
std::atomic< uint32m_totalTilesProcessed
 
rcContext * m_rcContext {nullptr}
 
std::vector< TileBuilder * > m_tileBuilders
 
ProducerConsumerQueue< TileInfo_queue
 
std::atomic< bool > _cancelationToken
 

Friends

class TileBuilder
 

Detailed Description

Constructor & Destructor Documentation

◆ MapBuilder()

MMAP::MapBuilder::MapBuilder ( float  maxWalkableAngle,
bool  skipLiquid,
bool  skipContinents,
bool  skipJunkMaps,
bool  skipBattlegrounds,
bool  debugOutput,
bool  bigBaseUnit,
int  mapid,
char const *  offMeshFilePath,
unsigned int  threads 
)
60 :
61
62 m_debugOutput (debugOutput),
63 m_offMeshFilePath (offMeshFilePath),
64 m_threads (threads),
65 m_skipContinents (skipContinents),
66 m_skipJunkMaps (skipJunkMaps),
67 m_skipBattlegrounds (skipBattlegrounds),
68 m_skipLiquid (skipLiquid),
69 m_maxWalkableAngle (maxWalkableAngle),
70 m_bigBaseUnit (bigBaseUnit),
71 m_mapid (mapid),
72 m_totalTiles (0u),
74
75 _cancelationToken (false)
76 {
77 m_terrainBuilder = new TerrainBuilder(skipLiquid);
78
79 m_rcContext = new rcContext(false);
80
81 // At least 1 thread is needed
82 m_threads = std::max(1u, m_threads);
83
85 }
const char * m_offMeshFilePath
Definition: MapBuilder.h:197
int32 m_mapid
Definition: MapBuilder.h:206
bool m_skipContinents
Definition: MapBuilder.h:199
void discoverTiles()
Definition: MapBuilder.cpp:101
bool m_skipLiquid
Definition: MapBuilder.h:202
std::atomic< uint32 > m_totalTiles
Definition: MapBuilder.h:208
bool m_bigBaseUnit
Definition: MapBuilder.h:205
rcContext * m_rcContext
Definition: MapBuilder.h:212
std::atomic< bool > _cancelationToken
Definition: MapBuilder.h:216
bool m_skipBattlegrounds
Definition: MapBuilder.h:201
float m_maxWalkableAngle
Definition: MapBuilder.h:204
bool m_skipJunkMaps
Definition: MapBuilder.h:200
std::atomic< uint32 > m_totalTilesProcessed
Definition: MapBuilder.h:209
bool m_debugOutput
Definition: MapBuilder.h:195
TerrainBuilder * m_terrainBuilder
Definition: MapBuilder.h:192
unsigned int m_threads
Definition: MapBuilder.h:198

References discoverTiles(), m_rcContext, m_terrainBuilder, and m_threads.

◆ ~MapBuilder()

MMAP::MapBuilder::~MapBuilder ( )
89 {
90 for (auto & m_tile : m_tiles)
91 {
92 m_tile.m_tiles->clear();
93 delete m_tile.m_tiles;
94 }
95
96 delete m_terrainBuilder;
97 delete m_rcContext;
98 }
TileList m_tiles
Definition: MapBuilder.h:193

References m_rcContext, m_terrainBuilder, and m_tiles.

Member Function Documentation

◆ buildMap()

void MMAP::MapBuilder::buildMap ( uint32  mapID)
private
424 {
425 std::set<uint32>* tiles = getTileList(mapID);
426
427 if (!tiles->empty())
428 {
429 // build navMesh
430 dtNavMesh* navMesh = nullptr;
431 buildNavMesh(mapID, navMesh);
432 if (!navMesh)
433 {
434 printf("[Map %03i] Failed creating navmesh!\n", mapID);
435 m_totalTilesProcessed += tiles->size();
436 return;
437 }
438
439 // now start building mmtiles for each tile
440 printf("[Map %03i] We have %u tiles. \n", mapID, (unsigned int)tiles->size());
441 for (unsigned int tile : *tiles)
442 {
443 uint32 tileX, tileY;
444
445 // unpack tile coords
446 StaticMapTree::unpackTileID(tile, tileX, tileY);
447
448 TileInfo tileInfo;
449 tileInfo.m_mapId = mapID;
450 tileInfo.m_tileX = tileX;
451 tileInfo.m_tileY = tileY;
452 memcpy(&tileInfo.m_navMeshParams, navMesh->getParams(), sizeof(dtNavMeshParams));
453 _queue.Push(tileInfo);
454 }
455
456 dtFreeNavMesh(navMesh);
457 }
458 }
std::uint32_t uint32
Definition: Define.h:107
static void unpackTileID(uint32 ID, uint32 &tileX, uint32 &tileY)
Definition: MapTree.h:67
ProducerConsumerQueue< TileInfo > _queue
Definition: MapBuilder.h:215
std::set< uint32 > * getTileList(uint32 mapID)
Definition: MapBuilder.cpp:194
void buildNavMesh(uint32 mapID, dtNavMesh *&navMesh)
Definition: MapBuilder.cpp:514

References _queue, buildNavMesh(), getTileList(), MMAP::TileInfo::m_mapId, MMAP::TileInfo::m_navMeshParams, MMAP::TileInfo::m_tileX, MMAP::TileInfo::m_tileY, m_totalTilesProcessed, and VMAP::StaticMapTree::unpackTileID().

Referenced by buildMaps().

◆ buildMaps()

void MMAP::MapBuilder::buildMaps ( Optional< uint32 mapID)
207 {
208 printf("Using %u threads to generate mmaps\n", m_threads);
209
210 for (unsigned int i = 0; i < m_threads; ++i)
211 {
213 }
214
215 if (mapID)
216 {
217 buildMap(*mapID);
218 }
219 else
220 {
221 // Build all maps if no map id has been specified
222 for (TileList::iterator it = m_tiles.begin(); it != m_tiles.end(); ++it)
223 {
224 if (!shouldSkipMap(it->m_mapId))
225 buildMap(it->m_mapId);
226 }
227 }
228
229 while (!_queue.Empty())
230 {
231 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
232 }
233
234 _cancelationToken = true;
235
236 _queue.Cancel();
237
238 for (auto& builder : m_tileBuilders)
239 delete builder;
240
241 m_tileBuilders.clear();
242 }
std::vector< TileBuilder * > m_tileBuilders
Definition: MapBuilder.h:214
bool shouldSkipMap(uint32 mapID) const
Definition: MapBuilder.cpp:927
friend class TileBuilder
Definition: MapBuilder.h:146
void buildMap(uint32 mapID)
Definition: MapBuilder.cpp:423

References _cancelationToken, _queue, buildMap(), m_bigBaseUnit, m_debugOutput, m_skipLiquid, m_threads, m_tileBuilders, m_tiles, shouldSkipMap(), and TileBuilder.

Referenced by main().

◆ buildMeshFromFile()

void MMAP::MapBuilder::buildMeshFromFile ( char *  name)
290 {
291 FILE* file = fopen(name, "rb");
292 if (!file)
293 return;
294
295 printf("Building mesh from file\n");
296 int tileX, tileY, mapId;
297 if (fread(&mapId, sizeof(int), 1, file) != 1)
298 {
299 fclose(file);
300 return;
301 }
302 if (fread(&tileX, sizeof(int), 1, file) != 1)
303 {
304 fclose(file);
305 return;
306 }
307 if (fread(&tileY, sizeof(int), 1, file) != 1)
308 {
309 fclose(file);
310 return;
311 }
312
313 dtNavMesh* navMesh = nullptr;
314 buildNavMesh(mapId, navMesh);
315 if (!navMesh)
316 {
317 printf("Failed creating navmesh! \n");
318 fclose(file);
319 return;
320 }
321
322 uint32 verticesCount, indicesCount;
323 if (fread(&verticesCount, sizeof(uint32), 1, file) != 1)
324 {
325 fclose(file);
326 return;
327 }
328
329 if (fread(&indicesCount, sizeof(uint32), 1, file) != 1)
330 {
331 fclose(file);
332 return;
333 }
334
335 float* verts = new float[verticesCount];
336 int* inds = new int[indicesCount];
337
338 if (fread(verts, sizeof(float), verticesCount, file) != verticesCount)
339 {
340 fclose(file);
341 delete[] verts;
342 delete[] inds; // cppcheck-suppress uninitdata
343 return;
344 }
345
346 if (fread(inds, sizeof(int), indicesCount, file) != indicesCount)
347 {
348 fclose(file);
349 delete[] verts;
350 delete[] inds;
351 return;
352 }
353
354 MeshData data;
355
356 for (uint32 i = 0; i < verticesCount; ++i)
357 data.solidVerts.append(verts[i]);
358 delete[] verts;
359
360 for (uint32 i = 0; i < indicesCount; ++i)
361 data.solidTris.append(inds[i]);
362 delete[] inds;
363
364 TerrainBuilder::cleanVertices(data.solidVerts, data.solidTris);
365 // get bounds of current tile
366 float bmin[3], bmax[3];
367 getTileBounds(tileX, tileY, data.solidVerts.getCArray(), data.solidVerts.size() / 3, bmin, bmax);
368
369 // build navmesh tile
371 tileBuilder.buildMoveMapTile(mapId, tileX, tileY, data, bmin, bmax, navMesh);
372 fclose(file);
373 }
void getTileBounds(uint32 tileX, uint32 tileY, float *verts, int vertCount, float *bmin, float *bmax) const
Definition: MapBuilder.cpp:908
static void cleanVertices(G3D::Array< float > &verts, G3D::Array< int > &tris)
Definition: TerrainBuilder.cpp:882

References MMAP::TileBuilder::buildMoveMapTile(), buildNavMesh(), MMAP::TerrainBuilder::cleanVertices(), getTileBounds(), m_bigBaseUnit, m_debugOutput, m_skipLiquid, MMAP::MeshData::solidTris, MMAP::MeshData::solidVerts, and TileBuilder.

Referenced by main().

◆ buildNavMesh()

void MMAP::MapBuilder::buildNavMesh ( uint32  mapID,
dtNavMesh *&  navMesh 
)
private

‍*** calculate number of bits needed to store tiles & polys ***‍/

515 {
516 std::set<uint32>* tiles = getTileList(mapID);
517
518 // old code for non-statically assigned bitmask sizes:
520 //int tileBits = dtIlog2(dtNextPow2(tiles->size()));
521 //if (tileBits < 1) tileBits = 1; // need at least one bit!
522 //int polyBits = sizeof(dtPolyRef)*8 - SALT_MIN_BITS - tileBits;
523
524 int polyBits = DT_POLY_BITS;
525
526 int maxTiles = tiles->size();
527 int maxPolysPerTile = 1 << polyBits;
528
529 /*** calculate bounds of map ***/
530
531 uint32 tileXMin = 64, tileYMin = 64, tileXMax = 0, tileYMax = 0, tileX, tileY;
532 for (unsigned int tile : *tiles)
533 {
534 StaticMapTree::unpackTileID(tile, tileX, tileY);
535
536 if (tileX > tileXMax)
537 tileXMax = tileX;
538 else if (tileX < tileXMin)
539 tileXMin = tileX;
540
541 if (tileY > tileYMax)
542 tileYMax = tileY;
543 else if (tileY < tileYMin)
544 tileYMin = tileY;
545 }
546
547 // use Max because '32 - tileX' is negative for values over 32
548 float bmin[3], bmax[3];
549 getTileBounds(tileXMax, tileYMax, nullptr, 0, bmin, bmax);
550
551 /*** now create the navmesh ***/
552
553 // navmesh creation params
554 dtNavMeshParams navMeshParams;
555 memset(&navMeshParams, 0, sizeof(dtNavMeshParams));
556 navMeshParams.tileWidth = GRID_SIZE;
557 navMeshParams.tileHeight = GRID_SIZE;
558 rcVcopy(navMeshParams.orig, bmin);
559 navMeshParams.maxTiles = maxTiles;
560 navMeshParams.maxPolys = maxPolysPerTile;
561
562 navMesh = dtAllocNavMesh();
563 printf("[Map %03i] Creating navMesh...\n", mapID);
564 if (!navMesh->init(&navMeshParams))
565 {
566 printf("[Map %03i] Failed creating navmesh! \n", mapID);
567 return;
568 }
569
570 char fileName[25];
571 sprintf(fileName, "mmaps/%03u.mmap", mapID);
572
573 FILE* file = fopen(fileName, "wb");
574 if (!file)
575 {
576 dtFreeNavMesh(navMesh);
577 char message[1024];
578 sprintf(message, "[Map %03i] Failed to open %s for writing!\n", mapID, fileName);
579 perror(message);
580 return;
581 }
582
583 // now that we know navMesh params are valid, we can write them to file
584 fwrite(&navMeshParams, sizeof(dtNavMeshParams), 1, file);
585 fclose(file);
586 }
static const float GRID_SIZE
Definition: TerrainBuilder.h:48

References getTileBounds(), getTileList(), MMAP::GRID_SIZE, and VMAP::StaticMapTree::unpackTileID().

Referenced by buildMap(), buildMeshFromFile(), and buildSingleTile().

◆ buildSingleTile()

void MMAP::MapBuilder::buildSingleTile ( uint32  mapID,
uint32  tileX,
uint32  tileY 
)
Todo:
: delete the old tile as the user clearly wants to rebuild it
377 {
378 dtNavMesh* navMesh = nullptr;
379 buildNavMesh(mapID, navMesh);
380 if (!navMesh)
381 {
382 printf("Failed creating navmesh! \n");
383 return;
384 }
385
387
389 tileBuilder.buildTile(mapID, tileX, tileY, navMesh);
390 dtFreeNavMesh(navMesh);
391
392 _cancelationToken = true;
393
394 _queue.Cancel();
395 }

References _cancelationToken, _queue, buildNavMesh(), MMAP::TileBuilder::buildTile(), m_bigBaseUnit, m_debugOutput, m_skipLiquid, and TileBuilder.

Referenced by main().

◆ currentPercentageDone()

uint32 MMAP::MapBuilder::currentPercentageDone ( ) const
private
1107 {
1109 }
uint32 percentageDone(uint32 totalTiles, uint32 totalTilesDone) const
Definition: MapBuilder.cpp:1098

References m_totalTiles, m_totalTilesProcessed, and percentageDone().

Referenced by MMAP::TileBuilder::buildTile().

◆ discoverTiles()

void MMAP::MapBuilder::discoverTiles ( )
private
102 {
103 std::vector<std::string> files;
104 uint32 mapID, tileX, tileY, tileID, count = 0, fsize = 0;
105 char filter[12];
106
107 printf("Discovering maps... ");
108 getDirContents(files, "maps");
109 for (auto & file : files)
110 {
111 mapID = uint32(atoi(file.substr(0, file.size() - 8).c_str()));
112 if (std::find(m_tiles.begin(), m_tiles.end(), mapID) == m_tiles.end())
113 {
114 m_tiles.emplace_back(mapID, new std::set<uint32>);
115 count++;
116 }
117 }
118
119 files.clear();
120 getDirContents(files, "vmaps", "*.vmtree");
121 for (auto & file : files)
122 {
123 mapID = uint32(atoi(file.substr(0, file.size() - 7).c_str()));
124 if (std::find(m_tiles.begin(), m_tiles.end(), mapID) == m_tiles.end())
125 {
126 m_tiles.emplace_back(mapID, new std::set<uint32>);
127 count++;
128 }
129 }
130 printf("found %u.\n", count);
131
132 count = 0;
133 printf("Discovering tiles... ");
134 for (auto & m_tile : m_tiles)
135 {
136 std::set<uint32>* tiles = m_tile.m_tiles;
137 mapID = m_tile.m_mapId;
138
139 sprintf(filter, "%03u*.vmtile", mapID);
140 files.clear();
141 getDirContents(files, "vmaps", filter);
142 for (auto & file : files)
143 {
144 fsize = file.size();
145
146 tileY = uint32(atoi(file.substr(fsize - 12, 2).c_str()));
147 tileX = uint32(atoi(file.substr(fsize - 9, 2).c_str()));
148 tileID = StaticMapTree::packTileID(tileY, tileX);
149
150 tiles->insert(tileID);
151 count++;
152 }
153
154 sprintf(filter, "%03u*", mapID);
155 files.clear();
156 getDirContents(files, "maps", filter);
157 for (auto & file : files)
158 {
159 fsize = file.size();
160
161 tileY = uint32(atoi(file.substr(fsize - 8, 2).c_str()));
162 tileX = uint32(atoi(file.substr(fsize - 6, 2).c_str()));
163 tileID = StaticMapTree::packTileID(tileX, tileY);
164
165 if (tiles->insert(tileID).second)
166 count++;
167 }
168
169 // make sure we process maps which don't have tiles
170 if (tiles->empty())
171 {
172 // convert coord bounds to grid bounds
173 uint32 minX, minY, maxX, maxY;
174 getGridBounds(mapID, minX, minY, maxX, maxY);
175
176 // add all tiles within bounds to tile list.
177 for (uint32 i = minX; i <= maxX; ++i)
178 for (uint32 j = minY; j <= maxY; ++j)
179 if (tiles->insert(StaticMapTree::packTileID(i, j)).second)
180 count++;
181 }
182 }
183 printf("found %u.\n\n", count);
184
185 // Calculate tiles to process in total
186 for (auto & m_tile : m_tiles)
187 {
188 if (!shouldSkipMap(m_tile.m_mapId))
189 m_totalTiles += m_tile.m_tiles->size();
190 }
191 }
ListFilesResult getDirContents(std::vector< std::string > &fileList, std::string dirpath=".", std::string filter="*")
Definition: PathCommon.h:76
static uint32 packTileID(uint32 tileX, uint32 tileY)
Definition: MapTree.h:66
void getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY) const
Definition: MapBuilder.cpp:245

References MMAP::getDirContents(), getGridBounds(), m_tiles, m_totalTiles, VMAP::StaticMapTree::packTileID(), and shouldSkipMap().

Referenced by MapBuilder().

◆ getGridBounds()

void MMAP::MapBuilder::getGridBounds ( uint32  mapID,
uint32 minX,
uint32 minY,
uint32 maxX,
uint32 maxY 
) const
private
246 {
247 // min and max are initialized to invalid values so the caller iterating the [min, max] range
248 // will never enter the loop unless valid min/max values are found
249 maxX = 0;
250 maxY = 0;
251 minX = std::numeric_limits<uint32>::max();
252 minY = std::numeric_limits<uint32>::max();
253
254 float bmin[3] = { 0, 0, 0 };
255 float bmax[3] = { 0, 0, 0 };
256 float lmin[3] = { 0, 0, 0 };
257 float lmax[3] = { 0, 0, 0 };
258 MeshData meshData;
259
260 // make sure we process maps which don't have tiles
261 // initialize the static tree, which loads WDT models
262 if (!m_terrainBuilder->loadVMap(mapID, 64, 64, meshData))
263 return;
264
265 // get the coord bounds of the model data
266 if (meshData.solidVerts.size() + meshData.liquidVerts.size() == 0)
267 return;
268
269 // get the coord bounds of the model data
270 if (meshData.solidVerts.size() && meshData.liquidVerts.size())
271 {
272 rcCalcBounds(meshData.solidVerts.getCArray(), meshData.solidVerts.size() / 3, bmin, bmax);
273 rcCalcBounds(meshData.liquidVerts.getCArray(), meshData.liquidVerts.size() / 3, lmin, lmax);
274 rcVmin(bmin, lmin);
275 rcVmax(bmax, lmax);
276 }
277 else if (meshData.solidVerts.size())
278 rcCalcBounds(meshData.solidVerts.getCArray(), meshData.solidVerts.size() / 3, bmin, bmax);
279 else
280 rcCalcBounds(meshData.liquidVerts.getCArray(), meshData.liquidVerts.size() / 3, lmin, lmax);
281
282 // convert coord bounds to grid bounds
283 maxX = 32 - bmin[0] / GRID_SIZE;
284 maxY = 32 - bmin[2] / GRID_SIZE;
285 minX = 32 - bmax[0] / GRID_SIZE;
286 minY = 32 - bmax[2] / GRID_SIZE;
287 }
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData)
Definition: TerrainBuilder.cpp:665

References MMAP::GRID_SIZE, MMAP::MeshData::liquidVerts, MMAP::TerrainBuilder::loadVMap(), m_terrainBuilder, and MMAP::MeshData::solidVerts.

Referenced by discoverTiles().

◆ GetMapSpecificConfig()

rcConfig MMAP::MapBuilder::GetMapSpecificConfig ( uint32  mapID,
float  bmin[3],
float  bmax[3],
const TileConfig tileConfig 
) const
private
1053 {
1054 rcConfig config;
1055 memset(&config, 0, sizeof(rcConfig));
1056
1057 rcVcopy(config.bmin, bmin);
1058 rcVcopy(config.bmax, bmax);
1059
1060 config.maxVertsPerPoly = DT_VERTS_PER_POLYGON;
1061 config.cs = tileConfig.BASE_UNIT_DIM;
1062 config.ch = tileConfig.BASE_UNIT_DIM;
1063 config.walkableSlopeAngle = m_maxWalkableAngle;
1064 config.tileSize = tileConfig.VERTEX_PER_TILE;
1065 config.walkableRadius = m_bigBaseUnit ? 1 : 2;
1066 config.borderSize = config.walkableRadius + 3;
1067 config.maxEdgeLen = tileConfig.VERTEX_PER_TILE + 1; // anything bigger than tileSize
1068 config.walkableHeight = m_bigBaseUnit ? 3 : 6;
1069 // a value >= 3|6 allows npcs to walk over some fences
1070 // a value >= 4|8 allows npcs to walk over all fences
1071 config.walkableClimb = m_bigBaseUnit ? 3 : 6;
1072 config.minRegionArea = rcSqr(60);
1073 config.mergeRegionArea = rcSqr(50);
1074 config.maxSimplificationError = 1.8f; // eliminates most jagged edges (tiny polygons)
1075 config.detailSampleDist = config.cs * 16;
1076 config.detailSampleMaxError = config.ch * 1;
1077
1078 switch (mapID)
1079 {
1080 // Blade's Edge Arena
1081 case 562:
1082 // This allows to walk on the ropes to the pillars
1083 config.walkableRadius = 0;
1084 break;
1085 // Blackfathom Deeps
1086 case 48:
1087 // Reduce the chance to have underground levels
1088 config.ch *= 2;
1089 break;
1090 default:
1091 break;
1092 }
1093
1094 return config;
1095 }

References MMAP::TileConfig::BASE_UNIT_DIM, m_bigBaseUnit, m_maxWalkableAngle, and MMAP::TileConfig::VERTEX_PER_TILE.

Referenced by MMAP::TileBuilder::buildMoveMapTile().

◆ getTileBounds()

void MMAP::MapBuilder::getTileBounds ( uint32  tileX,
uint32  tileY,
float *  verts,
int  vertCount,
float *  bmin,
float *  bmax 
) const
private
909 {
910 // this is for elevation
911 if (verts && vertCount)
912 rcCalcBounds(verts, vertCount, bmin, bmax);
913 else
914 {
915 bmin[1] = FLT_MIN;
916 bmax[1] = FLT_MAX;
917 }
918
919 // this is for width and depth
920 bmax[0] = (32 - int(tileX)) * GRID_SIZE;
921 bmax[2] = (32 - int(tileY)) * GRID_SIZE;
922 bmin[0] = bmax[0] - GRID_SIZE;
923 bmin[2] = bmax[2] - GRID_SIZE;
924 }

References MMAP::GRID_SIZE.

Referenced by buildMeshFromFile(), buildNavMesh(), and MMAP::TileBuilder::buildTile().

◆ getTileList()

std::set< uint32 > * MMAP::MapBuilder::getTileList ( uint32  mapID)
private
195 {
196 TileList::iterator itr = std::find(m_tiles.begin(), m_tiles.end(), mapID);
197 if (itr != m_tiles.end())
198 return (*itr).m_tiles;
199
200 std::set<uint32>* tiles = new std::set<uint32>();
201 m_tiles.emplace_back(mapID, tiles);
202 return tiles;
203 }

References m_tiles.

Referenced by buildMap(), and buildNavMesh().

◆ isContinentMap()

bool MMAP::MapBuilder::isContinentMap ( uint32  mapID) const
private
1015 {
1016 switch (mapID)
1017 {
1018 case 0:
1019 case 1:
1020 case 530:
1021 case 571:
1022 return true;
1023 default:
1024 return false;
1025 }
1026 }

Referenced by shouldSkipMap().

◆ isTransportMap()

bool MMAP::MapBuilder::isTransportMap ( uint32  mapID) const
private
976 {
977 switch (mapID)
978 {
979 // transport maps
980 case 582:
981 case 584:
982 case 586:
983 case 587:
984 case 588:
985 case 589:
986 case 590:
987 case 591:
988 case 592:
989 case 593:
990 case 594:
991 case 596:
992 case 610:
993 case 612:
994 case 613:
995 case 614:
996 case 620:
997 case 621:
998 case 622:
999 case 623:
1000 case 641:
1001 case 642:
1002 case 647:
1003 case 672:
1004 case 673:
1005 case 712:
1006 case 713:
1007 case 718:
1008 return true;
1009 default:
1010 return false;
1011 }
1012 }

Referenced by shouldSkipMap().

◆ percentageDone()

uint32 MMAP::MapBuilder::percentageDone ( uint32  totalTiles,
uint32  totalTilesDone 
) const
private
1099 {
1100 if (totalTiles)
1101 return totalTilesBuilt * 100 / totalTiles;
1102
1103 return 0;
1104 }

Referenced by currentPercentageDone().

◆ shouldSkipMap()

bool MMAP::MapBuilder::shouldSkipMap ( uint32  mapID) const
private
928 {
929 if (m_mapid >= 0)
930 return static_cast<uint32>(m_mapid) != mapID;
931
933 if (isContinentMap(mapID))
934 return true;
935
936 if (m_skipJunkMaps)
937 switch (mapID)
938 {
939 case 13: // test.wdt
940 case 25: // ScottTest.wdt
941 case 29: // Test.wdt
942 case 42: // Colin.wdt
943 case 169: // EmeraldDream.wdt (unused, and very large)
944 case 451: // development.wdt
945 case 573: // ExteriorTest.wdt
946 case 597: // CraigTest.wdt
947 case 605: // development_nonweighted.wdt
948 case 606: // QA_DVD.wdt
949 return true;
950 default:
951 if (isTransportMap(mapID))
952 return true;
953 break;
954 }
955
957 switch (mapID)
958 {
959 case 30: // AV
960 case 37: // ?
961 case 489: // WSG
962 case 529: // AB
963 case 566: // EotS
964 case 607: // SotA
965 case 628: // IoC
966 return true;
967 default:
968 break;
969 }
970
971 return false;
972 }
bool isTransportMap(uint32 mapID) const
Definition: MapBuilder.cpp:975
bool isContinentMap(uint32 mapID) const
Definition: MapBuilder.cpp:1014

References isContinentMap(), isTransportMap(), m_mapid, m_skipBattlegrounds, m_skipContinents, and m_skipJunkMaps.

Referenced by buildMaps(), and discoverTiles().

Friends And Related Function Documentation

◆ TileBuilder

friend class TileBuilder
friend

Member Data Documentation

◆ _cancelationToken

std::atomic<bool> MMAP::MapBuilder::_cancelationToken
private

◆ _queue

◆ m_bigBaseUnit

bool MMAP::MapBuilder::m_bigBaseUnit
private

◆ m_debugOutput

bool MMAP::MapBuilder::m_debugOutput
private

◆ m_mapid

int32 MMAP::MapBuilder::m_mapid
private

Referenced by shouldSkipMap().

◆ m_maxWalkableAngle

float MMAP::MapBuilder::m_maxWalkableAngle
private

Referenced by GetMapSpecificConfig().

◆ m_offMeshFilePath

const char* MMAP::MapBuilder::m_offMeshFilePath
private

◆ m_rcContext

rcContext* MMAP::MapBuilder::m_rcContext {nullptr}
private

Referenced by MapBuilder(), and ~MapBuilder().

◆ m_skipBattlegrounds

bool MMAP::MapBuilder::m_skipBattlegrounds
private

Referenced by shouldSkipMap().

◆ m_skipContinents

bool MMAP::MapBuilder::m_skipContinents
private

Referenced by shouldSkipMap().

◆ m_skipJunkMaps

bool MMAP::MapBuilder::m_skipJunkMaps
private

Referenced by shouldSkipMap().

◆ m_skipLiquid

bool MMAP::MapBuilder::m_skipLiquid
private

◆ m_terrainBuilder

TerrainBuilder* MMAP::MapBuilder::m_terrainBuilder {nullptr}
private

◆ m_threads

unsigned int MMAP::MapBuilder::m_threads
private

Referenced by buildMaps(), and MapBuilder().

◆ m_tileBuilders

std::vector<TileBuilder*> MMAP::MapBuilder::m_tileBuilders
private

Referenced by buildMaps().

◆ m_tiles

TileList MMAP::MapBuilder::m_tiles
private

◆ m_totalTiles

std::atomic<uint32> MMAP::MapBuilder::m_totalTiles
private

◆ m_totalTilesProcessed

std::atomic<uint32> MMAP::MapBuilder::m_totalTilesProcessed
private