aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-01-22 15:40:12 +0100
committerShauren <shauren.trinity@gmail.com>2013-01-22 15:40:12 +0100
commitfcd258a8a97098c4392c216f9bd6f99424b5b4b9 (patch)
treed746fabe8d89414730a181d1dfbe30b341113786 /src
parenta65caa6da2d6090ca23018706029f3a96a035b55 (diff)
Tools/MeshExtractor: Removed shared and MySQL dependencies.
Diffstat (limited to 'src')
-rw-r--r--src/tools/mesh_extractor/CMakeLists.txt65
-rw-r--r--src/tools/mesh_extractor/Cache.h5
-rw-r--r--src/tools/mesh_extractor/Chunk.h2
-rw-r--r--src/tools/mesh_extractor/Constants.h2
-rw-r--r--src/tools/mesh_extractor/ContinentBuilder.h4
-rw-r--r--src/tools/mesh_extractor/DBC.cpp2
-rw-r--r--src/tools/mesh_extractor/DBC.h3
-rw-r--r--src/tools/mesh_extractor/LiquidHandler.h2
-rw-r--r--src/tools/mesh_extractor/MPQ.h14
-rw-r--r--src/tools/mesh_extractor/MPQManager.cpp3
-rw-r--r--src/tools/mesh_extractor/MPQManager.h4
-rw-r--r--src/tools/mesh_extractor/MeshExtractor.cpp28
-rw-r--r--src/tools/mesh_extractor/TileBuilder.cpp30
-rw-r--r--src/tools/mesh_extractor/Utils.h6
-rw-r--r--src/tools/mesh_extractor/WorldModelHandler.cpp2
-rw-r--r--src/tools/mesh_extractor/WorldModelHandler.h2
16 files changed, 74 insertions, 100 deletions
diff --git a/src/tools/mesh_extractor/CMakeLists.txt b/src/tools/mesh_extractor/CMakeLists.txt
index b8bd9f54331..1b5d1564b71 100644
--- a/src/tools/mesh_extractor/CMakeLists.txt
+++ b/src/tools/mesh_extractor/CMakeLists.txt
@@ -11,69 +11,42 @@
file(GLOB_RECURSE sources *.cpp *.h)
-if( UNIX )
- include_directories (
- ${CMAKE_BINARY_DIR}
- ${CMAKE_SOURCE_DIR}/src/server/shared
- ${CMAKE_SOURCE_DIR}/src/server/shared/Database
- ${CMAKE_SOURCE_DIR}/src/server/shared/Database/Implementation
- ${CMAKE_SOURCE_DIR}/src/server/shared/Threading
- ${CMAKE_SOURCE_DIR}/src/server/shared/Logging
- ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities
- ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic
- ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/LinkedReference
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
- ${CMAKE_SOURCE_DIR}/dep/libmpq
- ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
- ${ACE_INCLUDE_DIR}
- ${MYSQL_INCLUDE_DIR}
- ${OPENSSL_INCLUDE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
- )
-elseif( WIN32 )
- include_directories (
- ${CMAKE_BINARY_DIR}
- ${CMAKE_SOURCE_DIR}/src/server/shared
- ${CMAKE_SOURCE_DIR}/src/server/shared/Database
- ${CMAKE_SOURCE_DIR}/src/server/shared/Database/Implementation
- ${CMAKE_SOURCE_DIR}/src/server/shared/Threading
- ${CMAKE_SOURCE_DIR}/src/server/shared/Logging
- ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities
- ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic
- ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/LinkedReference
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
- ${CMAKE_SOURCE_DIR}/dep/libmpq
+add_definitions(-DNO_CORE_FUNCS)
+
+set(include_Base
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/src/server/shared
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast
+ ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
+ ${CMAKE_SOURCE_DIR}/dep/libmpq
+ ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
+ ${ACE_INCLUDE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+if( WIN32 )
+ set(include_Base
+ ${include_Base}
${CMAKE_SOURCE_DIR}/dep/libmpq/win
- ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
- ${ACE_INCLUDE_DIR}
- ${MYSQL_INCLUDE_DIR}
- ${OPENSSL_INCLUDE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
- )
+ )
endif()
+include_directories(${include_Base})
+
add_executable(MeshExtractor
${sources}
)
target_link_libraries(MeshExtractor
- shared
g3dlib
mpq
Recast
Detour
- ${MYSQL_LIBRARY}
- ${OPENSSL_LIBRARIES}
- ${OPENSSL_EXTRA_LIBRARIES}
${BZIP2_LIBRARIES}
${ZLIB_LIBRARIES}
${ACE_LIBRARY}
)
-add_dependencies(MeshExtractor mpq Recast Detour)
-
if( UNIX )
install(TARGETS MeshExtractor DESTINATION bin)
elseif( WIN32 )
diff --git a/src/tools/mesh_extractor/Cache.h b/src/tools/mesh_extractor/Cache.h
index 34293b14b54..60e3d8434cf 100644
--- a/src/tools/mesh_extractor/Cache.h
+++ b/src/tools/mesh_extractor/Cache.h
@@ -2,8 +2,9 @@
#define CACHE_H
#include <string>
#include <map>
-#include "Common.h"
-#include "ace/Synch.h"
+#include "Define.h"
+#include <ace/Guard_T.h>
+#include <ace/Synch.h>
class WorldModelRoot;
class Model;
diff --git a/src/tools/mesh_extractor/Chunk.h b/src/tools/mesh_extractor/Chunk.h
index 2eea36f69b6..f3681a9f576 100644
--- a/src/tools/mesh_extractor/Chunk.h
+++ b/src/tools/mesh_extractor/Chunk.h
@@ -1,6 +1,6 @@
#ifndef CHUNK_H
#define CHUNK_H
-#include "Common.h"
+#include "Define.h"
#include <string>
class ChunkedData;
diff --git a/src/tools/mesh_extractor/Constants.h b/src/tools/mesh_extractor/Constants.h
index 54fa073fbef..02e2d25559f 100644
--- a/src/tools/mesh_extractor/Constants.h
+++ b/src/tools/mesh_extractor/Constants.h
@@ -1,8 +1,6 @@
#ifndef CONSTANTS_H
#define CONSTANTS_H
-#include "Common.h"
-
class Constants
{
public:
diff --git a/src/tools/mesh_extractor/ContinentBuilder.h b/src/tools/mesh_extractor/ContinentBuilder.h
index 3d7b879879e..b36ca125b9e 100644
--- a/src/tools/mesh_extractor/ContinentBuilder.h
+++ b/src/tools/mesh_extractor/ContinentBuilder.h
@@ -2,7 +2,7 @@
#define CONT_BUILDER_H
#include <string>
#include "WDT.h"
-#include "Common.h"
+#include "Define.h"
class ContinentBuilder
{
@@ -22,7 +22,7 @@ private:
WDT* TileMap;
uint32 MapId;
uint32 NumberOfThreads;
- int tileXMin;
+ int tileXMin;
int tileYMin;
int tileXMax;
int tileYMax;
diff --git a/src/tools/mesh_extractor/DBC.cpp b/src/tools/mesh_extractor/DBC.cpp
index 3c846363d06..9a55ff6d7ed 100644
--- a/src/tools/mesh_extractor/DBC.cpp
+++ b/src/tools/mesh_extractor/DBC.cpp
@@ -1,6 +1,6 @@
#include <cstdio>
#include "DBC.h"
-#include "Common.h"
+#include "Define.h"
DBC::DBC( FILE* stream ) : StringBlock(NULL), StringBlockSize(0), IsFaulty(true)
{
diff --git a/src/tools/mesh_extractor/DBC.h b/src/tools/mesh_extractor/DBC.h
index 0c857bd40ed..5ed57754e73 100644
--- a/src/tools/mesh_extractor/DBC.h
+++ b/src/tools/mesh_extractor/DBC.h
@@ -1,7 +1,8 @@
#ifndef DBC_H
#define DBC_H
#include <vector>
-#include "Common.h"
+#include <string>
+#include "Define.h"
class Record;
diff --git a/src/tools/mesh_extractor/LiquidHandler.h b/src/tools/mesh_extractor/LiquidHandler.h
index 6e8d0081adb..41e128ba20b 100644
--- a/src/tools/mesh_extractor/LiquidHandler.h
+++ b/src/tools/mesh_extractor/LiquidHandler.h
@@ -2,7 +2,7 @@
#define LIQUID_H
#include "ADT.h"
#include "Utils.h"
-#include "Common.h"
+#include "Define.h"
#include <vector>
diff --git a/src/tools/mesh_extractor/MPQ.h b/src/tools/mesh_extractor/MPQ.h
index 15fce452726..2f8b082f526 100644
--- a/src/tools/mesh_extractor/MPQ.h
+++ b/src/tools/mesh_extractor/MPQ.h
@@ -2,27 +2,25 @@
#define MPQ_H
#include "libmpq/mpq.h"
-#include "Common.h"
-#include <string.h>
+#include "Define.h"
+#include <string>
#include <ctype.h>
#include <vector>
#include <iostream>
#include <deque>
-using namespace std;
-
class MPQArchive
{
public:
mpq_archive_s *mpq_a;
-
- vector<string> Files;
+
+ std::vector<std::string> Files;
MPQArchive(const char* filename);
void close();
- void GetFileListTo(vector<string>& filelist) {
+ void GetFileListTo(std::vector<std::string>& filelist) {
uint32_t filenum;
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
libmpq__off_t size, transferred;
@@ -40,7 +38,7 @@ public:
while ((token != NULL) && (counter < size)) {
//cout << token << endl;
token[strlen(token) - 1] = 0;
- string s = token;
+ std::string s = token;
filelist.push_back(s);
counter += strlen(token) + 2;
token = strtok(NULL, seps);
diff --git a/src/tools/mesh_extractor/MPQManager.cpp b/src/tools/mesh_extractor/MPQManager.cpp
index 90491dfb945..0fe07cd8b85 100644
--- a/src/tools/mesh_extractor/MPQManager.cpp
+++ b/src/tools/mesh_extractor/MPQManager.cpp
@@ -2,8 +2,7 @@
#include "MPQ.h"
#include "DBC.h"
#include "Utils.h"
-
-#include "ace/Synch.h"
+#include <ace/Guard_T.h>
char* MPQManager::Files[] = {
"common.MPQ",
diff --git a/src/tools/mesh_extractor/MPQManager.h b/src/tools/mesh_extractor/MPQManager.h
index c23d7177825..788be7f5974 100644
--- a/src/tools/mesh_extractor/MPQManager.h
+++ b/src/tools/mesh_extractor/MPQManager.h
@@ -2,7 +2,9 @@
#define MPQ_MANAGER_H
#include "MPQ.h"
-#include "ace/Synch.h"
+#include <ace/Synch.h>
+#include <set>
+#include <map>
class DBC;
class MPQManager
diff --git a/src/tools/mesh_extractor/MeshExtractor.cpp b/src/tools/mesh_extractor/MeshExtractor.cpp
index b164ff5861d..e06f44c7125 100644
--- a/src/tools/mesh_extractor/MeshExtractor.cpp
+++ b/src/tools/mesh_extractor/MeshExtractor.cpp
@@ -12,11 +12,6 @@
#include <set>
-#include "Common.h"
-#include "LoginDatabase.h"
-#include "Util.h"
-LoginDatabaseWorkerPool LoginDatabase;
-
MPQManager* MPQHandler;
CacheClass* Cache;
@@ -64,7 +59,7 @@ void ExtractDBCs()
path += std::string(MPQManager::Languages[*itr]) + "/";
Utils::CreateDir(path);
}
-
+
std::string component = "component.wow-" + std::string(MPQManager::Languages[*itr]) + ".txt";
// Extract the component file
Utils::SaveToDisk(MPQHandler->GetFile(component), path + component);
@@ -104,7 +99,7 @@ void ExtractGameobjectModels()
{
fileName = Utils::FixModelPath(fileName);
Model model(path);
-
+
if (model.IsBad)
continue;
@@ -151,7 +146,7 @@ void ExtractGameobjectModels()
fwrite(indices, sizeof(uint16), numTris, output);
}
-
+
fwrite("VERT", 4, 1, output);
wsize = sizeof(int) + sizeof(float) * 3 * numVerts;
fwrite(&wsize, sizeof(int), 1, output);
@@ -170,7 +165,7 @@ void ExtractGameobjectModels()
fwrite(vertices, sizeof(float), numVerts * 3, output);
}
-
+
fclose(output);
delete[] indices;
delete[] vertices;
@@ -254,11 +249,14 @@ bool HandleArgs(int argc, char** argv, uint32& threads, std::set<uint32>& mapLis
param = argv[++i];
if (!param)
return false;
- std::string maps = std::string(param);
- Tokenizer tokens(maps, ',');
- for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
- mapList.insert(atoi(*itr));
+ char* copy = strdup(param);
+ char* token = strtok(copy, ",");
+ while (token)
+ {
+ mapList.insert(atoi(token));
+ token = strtok(NULL, ",");
+ }
printf("Extracting only provided list of maps (%u).\n", uint32(mapList.size()));
}
@@ -337,7 +335,7 @@ int main(int argc, char* argv[])
uint32 threads = 4, extractFlags = 0;
std::set<uint32> mapIds;
bool debug = false;
-
+
if (!HandleArgs(argc, argv, threads, mapIds, debug, extractFlags))
{
PrintUsage();
@@ -425,6 +423,6 @@ int main(int argc, char* argv[])
printf("Found!");
}
-
+
return 0;
}
diff --git a/src/tools/mesh_extractor/TileBuilder.cpp b/src/tools/mesh_extractor/TileBuilder.cpp
index 4a14cbbd51d..9bb9b11619f 100644
--- a/src/tools/mesh_extractor/TileBuilder.cpp
+++ b/src/tools/mesh_extractor/TileBuilder.cpp
@@ -10,7 +10,7 @@
#include "RecastAlloc.h"
#include "DetourNavMeshBuilder.h"
-#include "ace/Synch.h"
+#include <ace/Synch.h>
TileBuilder::TileBuilder(ContinentBuilder* _cBuilder, std::string world, int x, int y, uint32 mapId) :
World(world), X(x), Y(y), MapId(mapId), _Geometry(NULL), DataSize(0), cBuilder(_cBuilder)
@@ -118,7 +118,7 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
fprintf(debug, "f %i %i %i\n", _Geometry->Triangles[i].V0 + 1, _Geometry->Triangles[i].V1 + 1, _Geometry->Triangles[i].V2 + 1);
fclose(debug);
}
-
+
uint32 numVerts = _Geometry->Vertices.size();
uint32 numTris = _Geometry->Triangles.size();
float* vertices;
@@ -128,13 +128,13 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
_Geometry->Vertices.clear();
_Geometry->Triangles.clear();
-
+
rcVcopy(Config.bmin, cBuilder->bmin);
rcVcopy(Config.bmax, cBuilder->bmax);
-
+
// this sets the dimensions of the heightfield - should maybe happen before border padding
rcCalcGridSize(Config.bmin, Config.bmax, Config.cs, &Config.width, &Config.height);
-
+
// Initialize per tile config.
rcConfig tileCfg = Config;
tileCfg.width = Config.tileSize + Config.borderSize * 2;
@@ -154,8 +154,8 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
tileCfg.bmin[2] = Config.bmin[2] + float(y * Config.tileSize - Config.borderSize) * Config.cs;
tileCfg.bmax[0] = Config.bmin[0] + float((x + 1) * Config.tileSize + Config.borderSize) * Config.cs;
tileCfg.bmax[2] = Config.bmin[2] + float((y + 1) * Config.tileSize + Config.borderSize) * Config.cs;
-
-
+
+
rcHeightfield* hf = rcAllocHeightfield();
rcCreateHeightfield(Context, *hf, tileCfg.width, tileCfg.height, tileCfg.bmin, tileCfg.bmax, tileCfg.cs, tileCfg.ch);
rcClearUnwalkableTriangles(Context, tileCfg.walkableSlopeAngle, vertices, numVerts, triangles, numTris, areas);
@@ -198,7 +198,7 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
// Free memory
rcFreeCompactHeightfield(chf);
rcFreeContourSet(cset);
-
+
pmmerge[nmerge] = pmesh;
dmmerge[nmerge] = dmesh;
++nmerge;
@@ -207,15 +207,15 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
rcPolyMesh* pmesh = rcAllocPolyMesh();
rcMergePolyMeshes(Context, pmmerge, nmerge, *pmesh);
-
+
rcPolyMeshDetail* dmesh = rcAllocPolyMeshDetail();
rcMergePolyMeshDetails(Context, dmmerge, nmerge, *dmesh);
-
+
delete[] pmmerge;
delete[] dmmerge;
-
+
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)
{
@@ -262,10 +262,10 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
rcVcopy(params.bmin, cBuilder->bmin);
rcVcopy(params.bmax, cBuilder->bmax);
-
+
// Offmesh-connection settings
params.offMeshConCount = 0; // none for now
-
+
params.tileSize = Constants::VertexPerMap;
if (!params.polyCount || !params.polys || Constants::TilesPerMap * Constants::TilesPerMap == params.polyCount)
@@ -281,7 +281,7 @@ uint8* TileBuilder::Build(bool dbg, dtNavMeshParams& navMeshParams)
delete vertices;
return NULL;
}
-
+
int navDataSize;
uint8* navData;
printf("[%02i,%02i] Creating the navmesh with %i vertices, %i polys, %i triangles!\n", X, Y, pmesh->nverts, pmesh->npolys, dmesh->ntris);
diff --git a/src/tools/mesh_extractor/Utils.h b/src/tools/mesh_extractor/Utils.h
index e7380ed8142..41ea33e6157 100644
--- a/src/tools/mesh_extractor/Utils.h
+++ b/src/tools/mesh_extractor/Utils.h
@@ -7,12 +7,16 @@
#include "G3D/Matrix4.h"
#include "DetourNavMesh.h"
-#include "Common.h"
+#include "Define.h"
#include "Constants.h"
+#include <ace/Stack_Trace.h>
+
struct WorldModelDefinition;
class DoodadInstance;
+#define ASSERT(assertion) { if (!(assertion)) { ACE_Stack_Trace st; fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } }
+
struct Vector3
{
Vector3() {}
diff --git a/src/tools/mesh_extractor/WorldModelHandler.cpp b/src/tools/mesh_extractor/WorldModelHandler.cpp
index 6ce41807492..ecfff4e97d4 100644
--- a/src/tools/mesh_extractor/WorldModelHandler.cpp
+++ b/src/tools/mesh_extractor/WorldModelHandler.cpp
@@ -3,7 +3,7 @@
#include "Chunk.h"
#include "Cache.h"
#include "Model.h"
-#include "Common.h"
+#include "Define.h"
#include "G3D/Matrix4.h"
#include <cstdio>
diff --git a/src/tools/mesh_extractor/WorldModelHandler.h b/src/tools/mesh_extractor/WorldModelHandler.h
index cccedfa60fb..29715ded696 100644
--- a/src/tools/mesh_extractor/WorldModelHandler.h
+++ b/src/tools/mesh_extractor/WorldModelHandler.h
@@ -1,6 +1,6 @@
#ifndef WMODEL_HNDL_H
#define WMODEL_HNDL_H
-#include "Common.h"
+#include "Define.h"
#include "Utils.h"
#include "WorldModelRoot.h"
#include "ObjectDataHandler.h"