Tools/MeshExtractor:

* Added the capability of extracting DBCs.
* Fixed most compile warnings
* Some work on the navigation mesh generation process (still not ready)
This commit is contained in:
Subv committed 2012-10-03 18:02:18 -05:00
1 parent fa57ecddac
commit e32ddea96a
17 files changed
+264 -75

No files matched your search

+38
View File
@@ -5,6 +5,13 @@
#include "G3D/Matrix4.h"
#include "G3D/Quat.h"
#ifdef _WIN32
#include "direct.h"
#else
#include <sys/stat.h>
#include <unistd.h>
#endif
const float Constants::TileSize = 533.0f + (1/3.0f);
const float Constants::MaxXY = 32.0f * Constants::TileSize;
const float Constants::ChunkSize = Constants::TileSize / 16.0f;
@@ -13,6 +20,15 @@ const float Constants::Origin[] = { -Constants::MaxXY, 0.0f, -Constants::MaxXY }
const float Constants::PI = 3.1415926f;
const float Constants::MaxStandableHeight = 1.5f;
void Utils::CreateDir( const std::string& Path )
{
#ifdef _WIN32
_mkdir( Path.c_str());
#else
mkdir( Path.c_str(), 0777 );
#endif
}
void Utils::Reverse(char word[])
{
int len = strlen(word);
@@ -181,6 +197,28 @@ G3D::Matrix4 Utils::GetWmoDoodadTransformation( DoodadInstance inst, WorldModelD
return scale * rotation * quatRotation ** translation * rootTransformation;
}
void Utils::SaveToDisk( FILE* stream, std::string path )
{
FILE* disk = fopen(path.c_str(), "wb");
if (!disk)
{
printf("Could not save file %s to disk, please verify that you have write permissions on that directory\n", path.c_str());
return;
}
uint32 size = Utils::Size(stream);
uint8* data = new uint8[size];
// Read the data to an array
fread(data, 1, size, stream);
// And write it in the file
fwrite(data, 1, size, disk);
// Close the filestream
fclose(disk);
// Free the used memory
delete data;
}
void MapChunkHeader::Read(FILE* stream)
{
fread(&Flags, sizeof(uint32), 1, stream);