TrinityCore
Loading...
Searching...
No Matches
TileAssembler.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef _TILEASSEMBLER_H_
19#define _TILEASSEMBLER_H_
20
21#include "ModelInstance.h"
22#include "WorldModel.h"
23#include <G3D/Matrix3.h>
24#include <G3D/Vector3.h>
25#include <boost/filesystem/path.hpp>
26#include <deque>
27#include <map>
28#include <set>
29
30namespace VMAP
31{
36 //===============================================
37
39 {
40 private:
41 G3D::Matrix3 iRotation;
42 public:
43 ModelPosition(): iScale(0.0f) { }
44 G3D::Vector3 iPos;
45 G3D::Vector3 iDir;
46 float iScale;
47 void init()
48 {
49 iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pif()*iDir.y/180.f, G3D::pif()*iDir.x/180.f, G3D::pif()*iDir.z/180.f);
50 }
51 G3D::Vector3 transform(const G3D::Vector3& pIn) const;
52 void moveToBasePos(const G3D::Vector3& pBasePos) { iPos -= pBasePos; }
53 };
54
55 struct MapSpawns
56 {
58 std::map<uint32, ModelSpawn> UniqueEntries;
59 std::set<std::string> SpawnedModelFiles;
60 std::map<uint32 /*packedTileId*/, std::set<uint32 /*Id*/>> TileEntries;
61 std::map<uint32 /*packedTileId*/, std::set<uint32 /*Id*/>> ParentTileEntries;
62 };
63
64 typedef std::deque<MapSpawns> MapData;
65 //===============================================
66
68 {
71
72 G3D::AABox bounds;
74 std::vector<MeshTriangle> triangles;
75 std::vector<G3D::Vector3> vertexArray;
76 std::unique_ptr<WmoLiquid> liquid;
77
79 liquid(nullptr) { }
80
81 bool Read(FILE* f);
82 };
83
85 {
88 std::vector<GroupModel_Raw> groupsArray;
89
90 bool Read(boost::filesystem::path const& path);
91 };
92
94 {
95 private:
96 boost::filesystem::path iSrcDir;
97 boost::filesystem::path iDestDir;
99 std::set<std::string> spawnedModelFiles;
100
101 public:
102 TileAssembler(std::string const& srcDirName, std::string const& destDirName, uint32 threads);
103
104 bool convertWorld2();
105 bool convertMap(MapSpawns& data) const;
106 static bool readMapSpawns(FILE* dirf, MapSpawns* data);
107 bool calculateTransformedBound(ModelSpawn &spawn) const;
109
110 bool convertRawFile(const std::string& pModelFilename) const;
111 };
112
113} // VMAP
114#endif /*_TILEASSEMBLER_H_*/
uint32_t uint32
Definition Define.h:154
void moveToBasePos(const G3D::Vector3 &pBasePos)
G3D::Vector3 transform(const G3D::Vector3 &pIn) const
G3D::Matrix3 iRotation
boost::filesystem::path iSrcDir
bool calculateTransformedBound(ModelSpawn &spawn) const
boost::filesystem::path iDestDir
bool convertMap(MapSpawns &data) const
bool convertRawFile(const std::string &pModelFilename) const
std::set< std::string > spawnedModelFiles
static bool readMapSpawns(FILE *dirf, MapSpawns *data)
std::deque< MapSpawns > MapData
ModelFlags
Definition WorldModel.h:38
std::unique_ptr< WmoLiquid > liquid
std::vector< G3D::Vector3 > vertexArray
std::vector< MeshTriangle > triangles
std::map< uint32, ModelSpawn > UniqueEntries
std::map< uint32, std::set< uint32 > > TileEntries
std::set< std::string > SpawnedModelFiles
std::map< uint32, std::set< uint32 > > ParentTileEntries
bool Read(boost::filesystem::path const &path)
std::vector< GroupModel_Raw > groupsArray