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 
)
61 :
62
63 m_debugOutput (debugOutput),
64 m_offMeshFilePath (offMeshFilePath),
65 m_threads (threads),
66 m_skipContinents (skipContinents),
67 m_skipJunkMaps (skipJunkMaps),
68 m_skipBattlegrounds (skipBattlegrounds),
69 m_skipLiquid (skipLiquid),
70 m_maxWalkableAngle (maxWalkableAngle),
71 m_bigBaseUnit (bigBaseUnit),
72 m_mapid (mapid),
73 m_totalTiles (0u),
75
76 _cancelationToken (false)
77 {
78 m_terrainBuilder = new TerrainBuilder(skipLiquid);
79
80 m_rcContext = new rcContext(false);
81
82 // At least 1 thread is needed
83 m_threads = std::max(1u, m_threads);
84
86 }
const char * m_offMeshFilePath
Definition: MapBuilder.h:199
int32 m_mapid
Definition: MapBuilder.h:208
bool m_skipContinents
Definition: MapBuilder.h:201
void discoverTiles()
Definition: MapBuilder.cpp:102
bool m_skipLiquid
Definition: MapBuilder.h:204
std::atomic< uint32 > m_totalTiles
Definition: MapBuilder.h:210
bool m_bigBaseUnit
Definition: MapBuilder.h:207
rcContext * m_rcContext
Definition: MapBuilder.h:214
std::atomic< bool > _cancelationToken
Definition: MapBuilder.h:218
bool m_skipBattlegrounds
Definition: MapBuilder.h:203
float m_maxWalkableAngle
Definition: MapBuilder.h:206
bool m_skipJunkMaps
Definition: MapBuilder.h:202
std::atomic< uint32 > m_totalTilesProcessed
Definition: MapBuilder.h:211
bool m_debugOutput
Definition: MapBuilder.h:197
TerrainBuilder * m_terrainBuilder
Definition: MapBuilder.h:194
unsigned int m_threads
Definition: MapBuilder.h:200

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

◆ ~MapBuilder()

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

References m_rcContext, m_terrainBuilder, and m_tiles.

Member Function Documentation

◆ buildMap()

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

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

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

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 ***‍/

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

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
378 {
379 dtNavMesh* navMesh = nullptr;
380 buildNavMesh(mapID, navMesh);
381 if (!navMesh)
382 {
383 printf("Failed creating navmesh! \n");
384 return;
385 }
386
388
390 tileBuilder.buildTile(mapID, tileX, tileY, navMesh);
391 dtFreeNavMesh(navMesh);
392
393 _cancelationToken = true;
394
395 _queue.Cancel();
396 }

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
1108 {
1110 }
uint32 percentageDone(uint32 totalTiles, uint32 totalTilesDone) const
Definition: MapBuilder.cpp:1099

References m_totalTiles, m_totalTilesProcessed, and percentageDone().

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

◆ discoverTiles()

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

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

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

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
910 {
911 // this is for elevation
912 if (verts && vertCount)
913 rcCalcBounds(verts, vertCount, bmin, bmax);
914 else
915 {
916 bmin[1] = FLT_MIN;
917 bmax[1] = FLT_MAX;
918 }
919
920 // this is for width and depth
921 bmax[0] = (32 - int(tileX)) * GRID_SIZE;
922 bmax[2] = (32 - int(tileY)) * GRID_SIZE;
923 bmin[0] = bmax[0] - GRID_SIZE;
924 bmin[2] = bmax[2] - GRID_SIZE;
925 }

References MMAP::GRID_SIZE.

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

◆ getTileList()

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

References m_tiles.

Referenced by buildMap(), and buildNavMesh().

◆ isContinentMap()

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

Referenced by shouldSkipMap().

◆ isTransportMap()

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

Referenced by shouldSkipMap().

◆ percentageDone()

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

Referenced by currentPercentageDone().

◆ shouldSkipMap()

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

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