mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Tools/mmaps_generator: Namespace/include cleanup
This commit is contained in:
@@ -112,7 +112,7 @@ private:
|
||||
std::mutex _loadMutex;
|
||||
std::unique_ptr<GridMap> _gridMap[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
std::atomic<uint16> _referenceCountFromMap[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
std::array<uint64, (MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS + 63) / 64> _loadedGrids;
|
||||
std::array<uint64, MAX_NUMBER_OF_GRIDS> _loadedGrids;
|
||||
std::bitset<MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS> _gridFileExists; // cache what grids are available for this map (not including parent/child maps)
|
||||
|
||||
static constexpr Milliseconds CleanupInterval = 1min;
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace MMAP
|
||||
for (uint32 tileX = 0; tileX < 64; ++tileX)
|
||||
for (uint32 tileY = 0; tileY < 64; ++tileY)
|
||||
if (tilesData[tileX * 64 + tileY] == '1')
|
||||
if (tiles.insert(StaticMapTree::packTileID(tileX, tileY)).second)
|
||||
if (tiles.insert(VMAP::StaticMapTree::packTileID(tileX, tileY)).second)
|
||||
++m_totalTiles;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ namespace MMAP
|
||||
|
||||
uint32 tileX = Trinity::StringTo<uint32>(std::string_view(fileName).substr(8, 2)).value_or(0);
|
||||
uint32 tileY = Trinity::StringTo<uint32>(std::string_view(fileName).substr(5, 2)).value_or(0);
|
||||
uint32 tileID = StaticMapTree::packTileID(tileY, tileX);
|
||||
uint32 tileID = VMAP::StaticMapTree::packTileID(tileY, tileX);
|
||||
|
||||
if (tiles.insert(tileID).second)
|
||||
++m_totalTiles;
|
||||
@@ -429,7 +429,7 @@ namespace MMAP
|
||||
uint32 tileX, tileY;
|
||||
|
||||
// unpack tile coords
|
||||
StaticMapTree::unpackTileID(packedTile, tileX, tileY);
|
||||
VMAP::StaticMapTree::unpackTileID(packedTile, tileX, tileY);
|
||||
|
||||
TileInfo tileInfo;
|
||||
tileInfo.m_mapId = mapID;
|
||||
@@ -526,7 +526,7 @@ namespace MMAP
|
||||
uint32 tileXMin = 64, tileYMin = 64, tileXMax = 0, tileYMax = 0, tileX, tileY;
|
||||
for (uint32 packedTile : tiles)
|
||||
{
|
||||
StaticMapTree::unpackTileID(packedTile, tileX, tileY);
|
||||
VMAP::StaticMapTree::unpackTileID(packedTile, tileX, tileY);
|
||||
|
||||
if (tileX > tileXMax)
|
||||
tileXMax = tileX;
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
using namespace VMAP;
|
||||
|
||||
namespace MMAP
|
||||
{
|
||||
typedef std::unordered_map<uint32, Trinity::Containers::FlatSet<uint32>> TileList;
|
||||
|
||||
@@ -60,11 +60,9 @@ namespace MMAP
|
||||
}
|
||||
}
|
||||
|
||||
using namespace MMAP;
|
||||
|
||||
bool checkDirectories(bool debugOutput, std::vector<std::string>& dbcLocales)
|
||||
{
|
||||
if (getDirContents(dbcLocales, "dbc") == LISTFILE_DIRECTORY_NOT_FOUND || dbcLocales.empty())
|
||||
if (MMAP::getDirContents(dbcLocales, "dbc") == MMAP::LISTFILE_DIRECTORY_NOT_FOUND || dbcLocales.empty())
|
||||
{
|
||||
printf("'dbc' directory is empty or does not exist\n");
|
||||
return false;
|
||||
@@ -72,21 +70,21 @@ bool checkDirectories(bool debugOutput, std::vector<std::string>& dbcLocales)
|
||||
|
||||
std::vector<std::string> dirFiles;
|
||||
|
||||
if (getDirContents(dirFiles, "maps") == LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty())
|
||||
if (MMAP::getDirContents(dirFiles, "maps") == MMAP::LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty())
|
||||
{
|
||||
printf("'maps' directory is empty or does not exist\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
dirFiles.clear();
|
||||
if (getDirContents(dirFiles, "vmaps/0000", "*.vmtree") == LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty())
|
||||
if (MMAP::getDirContents(dirFiles, "vmaps/0000", "*.vmtree") == MMAP::LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty())
|
||||
{
|
||||
printf("'vmaps' directory is empty or does not exist\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
dirFiles.clear();
|
||||
if (getDirContents(dirFiles, "mmaps") == LISTFILE_DIRECTORY_NOT_FOUND)
|
||||
if (MMAP::getDirContents(dirFiles, "mmaps") == MMAP::LISTFILE_DIRECTORY_NOT_FOUND)
|
||||
{
|
||||
if (!boost::filesystem::create_directory("mmaps"))
|
||||
{
|
||||
@@ -98,7 +96,7 @@ bool checkDirectories(bool debugOutput, std::vector<std::string>& dbcLocales)
|
||||
dirFiles.clear();
|
||||
if (debugOutput)
|
||||
{
|
||||
if (getDirContents(dirFiles, "meshes") == LISTFILE_DIRECTORY_NOT_FOUND)
|
||||
if (MMAP::getDirContents(dirFiles, "meshes") == MMAP::LISTFILE_DIRECTORY_NOT_FOUND)
|
||||
{
|
||||
if (!boost::filesystem::create_directory("meshes"))
|
||||
{
|
||||
@@ -373,7 +371,7 @@ std::unordered_map<uint32, std::vector<uint32>> LoadMap(std::string const& local
|
||||
if (parentMapId != -1)
|
||||
mapData[parentMapId].push_back(record.GetId());
|
||||
|
||||
MapEntry& map = sMapStore[record.GetId()];
|
||||
MMAP::MapEntry& map = MMAP::sMapStore[record.GetId()];
|
||||
map.MapType = record.GetUInt8("MapType");
|
||||
map.InstanceType = record.GetUInt8("InstanceType");
|
||||
map.ParentMapID = parentMapId;
|
||||
@@ -441,7 +439,7 @@ int main(int argc, char** argv)
|
||||
|
||||
_mapDataForVmapInitialization = LoadMap(dbcLocales[0], silent, -4);
|
||||
|
||||
MapBuilder builder(maxAngle, maxAngleNotSteep, skipLiquid, skipContinents, skipJunkMaps,
|
||||
MMAP::MapBuilder builder(maxAngle, maxAngleNotSteep, skipLiquid, skipContinents, skipJunkMaps,
|
||||
skipBattlegrounds, debugOutput, bigBaseUnit, mapnum, offMeshInputPath, threads);
|
||||
|
||||
uint32 start = getMSTime();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include "TerrainBuilder.h"
|
||||
#include "MapBuilder.h"
|
||||
#include "MapDefines.h"
|
||||
#include "MapTree.h"
|
||||
#include "MMapDefines.h"
|
||||
@@ -585,22 +584,22 @@ namespace MMAP
|
||||
/**************************************************************************/
|
||||
bool TerrainBuilder::loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData)
|
||||
{
|
||||
std::unique_ptr<VMapManager2> vmapManager = VMapFactory::CreateVMapManager();
|
||||
LoadResult result = vmapManager->loadMap("vmaps", mapID, tileX, tileY);
|
||||
std::unique_ptr<VMAP::VMapManager2> vmapManager = VMapFactory::CreateVMapManager();
|
||||
VMAP::LoadResult result = vmapManager->loadMap("vmaps", mapID, tileX, tileY);
|
||||
bool retval = false;
|
||||
|
||||
do
|
||||
{
|
||||
if (result != LoadResult::Success)
|
||||
if (result != VMAP::LoadResult::Success)
|
||||
break;
|
||||
|
||||
InstanceTreeMap instanceTrees;
|
||||
VMAP::InstanceTreeMap instanceTrees;
|
||||
vmapManager->getInstanceMapTree(instanceTrees);
|
||||
|
||||
if (!instanceTrees[mapID])
|
||||
break;
|
||||
|
||||
ModelInstance* models = nullptr;
|
||||
VMAP::ModelInstance* models = nullptr;
|
||||
uint32 count = 0;
|
||||
instanceTrees[mapID]->getModelInstances(models, count);
|
||||
|
||||
@@ -609,17 +608,17 @@ namespace MMAP
|
||||
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
ModelInstance const& instance = models[i];
|
||||
VMAP::ModelInstance const& instance = models[i];
|
||||
|
||||
// model instances exist in tree even though there are instances of that model in this tile
|
||||
WorldModel const* worldModel = instance.getWorldModel();
|
||||
VMAP::WorldModel const* worldModel = instance.getWorldModel();
|
||||
if (!worldModel)
|
||||
continue;
|
||||
|
||||
// now we have a model to add to the meshdata
|
||||
retval = true;
|
||||
|
||||
std::vector<GroupModel> const& groupModels = worldModel->getGroupModels();
|
||||
std::vector<VMAP::GroupModel> const& groupModels = worldModel->getGroupModels();
|
||||
|
||||
// all M2s need to have triangle indices reversed
|
||||
bool isM2 = worldModel->IsM2();
|
||||
@@ -631,12 +630,12 @@ namespace MMAP
|
||||
position.x -= 32 * GRID_SIZE;
|
||||
position.y -= 32 * GRID_SIZE;
|
||||
|
||||
for (std::vector<GroupModel>::const_iterator it = groupModels.begin(); it != groupModels.end(); ++it)
|
||||
for (std::vector<VMAP::GroupModel>::const_iterator it = groupModels.begin(); it != groupModels.end(); ++it)
|
||||
{
|
||||
std::vector<G3D::Vector3> const& tempVertices = it->GetVertices();
|
||||
std::vector<G3D::Vector3> transformedVertices;
|
||||
std::vector<MeshTriangle> const& tempTriangles = it->GetTriangles();
|
||||
WmoLiquid const* liquid = it->GetLiquid();
|
||||
std::vector<VMAP::MeshTriangle> const& tempTriangles = it->GetTriangles();
|
||||
VMAP::WmoLiquid const* liquid = it->GetLiquid();
|
||||
|
||||
// first handle collision mesh
|
||||
transform(tempVertices, transformedVertices, scale, rotation, position);
|
||||
@@ -759,12 +758,12 @@ namespace MMAP
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::copyIndices(std::vector<MeshTriangle> const& source, G3D::Array<int>& dest, int offset, bool flip)
|
||||
void TerrainBuilder::copyIndices(std::vector<VMAP::MeshTriangle> const& source, G3D::Array<int>& dest, int offset, bool flip)
|
||||
{
|
||||
dest.reserve(dest.size() + source.size() * 3);
|
||||
if (flip)
|
||||
{
|
||||
for (MeshTriangle const& triangle : source)
|
||||
for (VMAP::MeshTriangle const& triangle : source)
|
||||
{
|
||||
dest.push_back(triangle.idx2 + offset);
|
||||
dest.push_back(triangle.idx1 + offset);
|
||||
@@ -773,7 +772,7 @@ namespace MMAP
|
||||
}
|
||||
else
|
||||
{
|
||||
for (MeshTriangle const& triangle : source)
|
||||
for (VMAP::MeshTriangle const& triangle : source)
|
||||
{
|
||||
dest.push_back(triangle.idx0 + offset);
|
||||
dest.push_back(triangle.idx1 + offset);
|
||||
|
||||
Reference in New Issue
Block a user