aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/mesh_extractor/Cache.h5
-rw-r--r--src/tools/mesh_extractor/Constants.h1
-rw-r--r--src/tools/mesh_extractor/ContinentBuilder.cpp9
-rw-r--r--src/tools/mesh_extractor/ContinentBuilder.h2
-rw-r--r--src/tools/mesh_extractor/MeshExtractor.cpp15
-rw-r--r--src/tools/mesh_extractor/TileBuilder.cpp16
-rw-r--r--src/tools/mesh_extractor/TileBuilder.h2
-rw-r--r--src/tools/mesh_extractor/Utils.cpp1
8 files changed, 21 insertions, 30 deletions
diff --git a/src/tools/mesh_extractor/Cache.h b/src/tools/mesh_extractor/Cache.h
index 2be885fab9f..9b3e046fe1e 100644
--- a/src/tools/mesh_extractor/Cache.h
+++ b/src/tools/mesh_extractor/Cache.h
@@ -5,9 +5,8 @@
#include "Define.h"
#include <ace/Guard_T.h>
#include <ace/Synch.h>
-
-class WorldModelRoot;
-class Model;
+#include "WorldModelRoot.h"
+#include "Model.h"
template<class K, class T>
class GenericCache
diff --git a/src/tools/mesh_extractor/Constants.h b/src/tools/mesh_extractor/Constants.h
index 02e2d25559f..f2d9e8af8f5 100644
--- a/src/tools/mesh_extractor/Constants.h
+++ b/src/tools/mesh_extractor/Constants.h
@@ -47,6 +47,7 @@ public:
static const float PI;
static const float MaxStandableHeight;
static bool ToWoWCoords;
+ static bool Debug;
static const char* VMAPMagic;
static const float BaseUnitDim;
static const int VertexPerMap;
diff --git a/src/tools/mesh_extractor/ContinentBuilder.cpp b/src/tools/mesh_extractor/ContinentBuilder.cpp
index a6b4e3763a0..fd0202e36f9 100644
--- a/src/tools/mesh_extractor/ContinentBuilder.cpp
+++ b/src/tools/mesh_extractor/ContinentBuilder.cpp
@@ -12,11 +12,10 @@ class BuilderThread : public ACE_Task_Base
private:
int X, Y, MapId;
std::string Continent;
- bool debug;
dtNavMeshParams Params;
ContinentBuilder* cBuilder;
public:
- BuilderThread(ContinentBuilder* _cBuilder, bool deb, dtNavMeshParams& params) : debug(deb), Params(params), cBuilder(_cBuilder), Free(true) {}
+ BuilderThread(ContinentBuilder* _cBuilder, dtNavMeshParams& params) : Params(params), cBuilder(_cBuilder), Free(true) {}
void SetData(int x, int y, int map, const std::string& cont) { X = x; Y = y; MapId = map; Continent = cont; }
int svc()
@@ -34,7 +33,7 @@ public:
Free = true;
return 0;
}
- uint8* nav = builder.Build(debug, Params);
+ uint8* nav = builder.Build(Params);
if (nav)
{
f = fopen(buff, "wb");
@@ -89,7 +88,7 @@ void ContinentBuilder::CalculateTileBounds()
getTileBounds(tileXMax, tileYMax, NULL, 0, bmin, bmax);
}
-void ContinentBuilder::Build(bool debug)
+void ContinentBuilder::Build()
{
char buff[50];
sprintf(buff, "mmaps/%03u.mmap", MapId);
@@ -112,7 +111,7 @@ void ContinentBuilder::Build(bool debug)
fclose(mmap);
std::vector<BuilderThread*> Threads;
for (uint32 i = 0; i < NumberOfThreads; ++i)
- Threads.push_back(new BuilderThread(this, debug, params));
+ Threads.push_back(new BuilderThread(this, params));
printf("Map %s ( %u ) has %u tiles. Building them with %u threads\n", Continent.c_str(), MapId, uint32(TileMap->TileTable.size()), NumberOfThreads);
for (std::vector<TilePos>::iterator itr = TileMap->TileTable.begin(); itr != TileMap->TileTable.end(); ++itr)
{
diff --git a/src/tools/mesh_extractor/ContinentBuilder.h b/src/tools/mesh_extractor/ContinentBuilder.h
index b36ca125b9e..64d7be49aed 100644
--- a/src/tools/mesh_extractor/ContinentBuilder.h
+++ b/src/tools/mesh_extractor/ContinentBuilder.h
@@ -12,7 +12,7 @@ public:
NumberOfThreads(tn), tileXMin(64), tileYMin(64), tileXMax(0), tileYMax(0)
{}
- void Build(bool debug);
+ void Build();
void getTileBounds(uint32 tileX, uint32 tileY, float* verts, int vertCount, float* bmin, float* bmax);
void CalculateTileBounds();
float bmin[3];
diff --git a/src/tools/mesh_extractor/MeshExtractor.cpp b/src/tools/mesh_extractor/MeshExtractor.cpp
index e23437e368d..3d56bab5c23 100644
--- a/src/tools/mesh_extractor/MeshExtractor.cpp
+++ b/src/tools/mesh_extractor/MeshExtractor.cpp
@@ -17,7 +17,7 @@
MPQManager* MPQHandler;
CacheClass* Cache;
-void ExtractMMaps(std::set<uint32>& mapIds, uint32 threads, bool debug)
+void ExtractMMaps(std::set<uint32>& mapIds, uint32 threads)
{
DBC* dbc = MPQHandler->GetDBC("Map");
printf("Map.dbc contains %u rows.\n", dbc->Records.size());
@@ -28,7 +28,7 @@ void ExtractMMaps(std::set<uint32>& mapIds, uint32 threads, bool debug)
// Skip this map if a list of specific maps was provided and this one is not contained in it.
if (!mapIds.empty() && mapIds.find(mapId) == mapIds.end())
{
- if (debug)
+ if (Constants::Debug)
printf("Map %u will not be built.\n", mapId);
continue;
}
@@ -42,14 +42,14 @@ void ExtractMMaps(std::set<uint32>& mapIds, uint32 threads, bool debug)
}
printf("Building %s MapId %u\n", name.c_str(), mapId);
ContinentBuilder builder(name, mapId, &wdt, threads);
- builder.Build(debug);
+ builder.Build();
}
}
void ExtractDBCs()
{
printf("Extracting DBCs\n");
- // Create the filesystem structure
+ // Create the file system structure
std::string baseDBCPath = "dbc/";
Utils::CreateDir(baseDBCPath);
@@ -345,9 +345,8 @@ int main(int argc, char* argv[])
_setmaxstdio(2048);
uint32 threads = 4, extractFlags = 0;
std::set<uint32> mapIds;
- bool debug = false;
- if (!HandleArgs(argc, argv, threads, mapIds, debug, extractFlags))
+ if (!HandleArgs(argc, argv, threads, mapIds, Constants::Debug, extractFlags))
{
PrintUsage();
return -1;
@@ -355,7 +354,7 @@ int main(int argc, char* argv[])
if (extractFlags == 0)
{
- printf("You must provide a valid extractflag.\n");
+ printf("You must provide valid extract flags.\n");
PrintUsage();
return -1;
}
@@ -368,7 +367,7 @@ int main(int argc, char* argv[])
ExtractDBCs();
if (extractFlags & Constants::EXTRACT_FLAG_MMAPS)
- ExtractMMaps(mapIds, threads, debug);
+ ExtractMMaps(mapIds, threads);
if (extractFlags & Constants::EXTRACT_FLAG_GOB_MODELS)
ExtractGameobjectModels();
diff --git a/src/tools/mesh_extractor/TileBuilder.cpp b/src/tools/mesh_extractor/TileBuilder.cpp
index 04cf87e0b58..5de41c9eb84 100644
--- a/src/tools/mesh_extractor/TileBuilder.cpp
+++ b/src/tools/mesh_extractor/TileBuilder.cpp
@@ -73,7 +73,7 @@ void TileBuilder::CalculateTileBounds( float*& bmin, float*& bmax, dtNavMeshPara
bmax[2] = Constants::Origin[2] /*navMeshParams.orig[2]*/ + (Constants::TileSize * (Y + 1));
}
-uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
+uint8* TileBuilder::Build(dtNavMeshParams& navMeshParams)
{
_Geometry = new Geometry();
_Geometry->Transform = true;
@@ -95,7 +95,7 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
continue;
ADT* _adt = new ADT(Utils::GetAdtPath(World, tx, ty), tx, ty);
- // If this condition is met, it means that this wdt does not contain the ADT
+ // If this condition is met, it means that this WDT does not contain the ADT
if (!_adt->Data->Stream)
{
delete _adt;
@@ -107,7 +107,7 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
}
}
- if (dbg)
+ if (Constants::Debug)
{
char buff[100];
sprintf(buff, "mmaps/%s_%02u%02u.obj", World.c_str(), Y, X);
@@ -124,7 +124,7 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
}
fclose(debug);
}
- return NULL;
+
uint32 numVerts = _Geometry->Vertices.size();
uint32 numTris = _Geometry->Triangles.size();
float* vertices;
@@ -222,14 +222,6 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
printf("[%02i,%02i] Meshes merged!\n", X, Y);
- // Remove padding from the polymesh data. (Remove this odditity)
- for (int i = 0; i < pmesh->nverts; ++i)
- {
- unsigned short* v = &pmesh->verts[i * 3];
- v[0] -= (unsigned short)Config.borderSize;
- v[2] -= (unsigned short)Config.borderSize;
- }
-
// Set flags according to area types (e.g. Swim for Water)
for (int i = 0; i < pmesh->npolys; i++)
{
diff --git a/src/tools/mesh_extractor/TileBuilder.h b/src/tools/mesh_extractor/TileBuilder.h
index 40c96f6ec42..e0ff02cc599 100644
--- a/src/tools/mesh_extractor/TileBuilder.h
+++ b/src/tools/mesh_extractor/TileBuilder.h
@@ -15,7 +15,7 @@ public:
~TileBuilder();
void CalculateTileBounds(float*& bmin, float*& bmax, dtNavMeshParams& navMeshParams);
- uint8* Build(bool dbg, dtNavMeshParams& navMeshParams);
+ uint8* Build(dtNavMeshParams& navMeshParams);
std::string World;
int X;
diff --git a/src/tools/mesh_extractor/Utils.cpp b/src/tools/mesh_extractor/Utils.cpp
index f2881e9a770..10e0bdc0d04 100644
--- a/src/tools/mesh_extractor/Utils.cpp
+++ b/src/tools/mesh_extractor/Utils.cpp
@@ -21,6 +21,7 @@ const float Constants::PI = 3.1415926f;
const float Constants::MaxStandableHeight = 1.5f;
const char* Constants::VMAPMagic = "VMAP041";
bool Constants::ToWoWCoords = false;
+bool Constants::Debug = false;
const float Constants::BaseUnitDim = 0.533333f;
const int Constants::VertexPerMap = (Constants::TileSize / Constants::BaseUnitDim) + 0.5f;
const int Constants::VertexPerTile = 40;