TrinityCore
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 <G3D/Vector3.h>
22#include <G3D/Matrix3.h>
23#include <deque>
24#include <map>
25#include <set>
26
27#include "ModelInstance.h"
28#include "WorldModel.h"
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::map<uint32 /*packedTileId*/, std::set<uint32 /*Id*/>> TileEntries;
60 std::map<uint32 /*packedTileId*/, std::set<uint32 /*Id*/>> ParentTileEntries;
61 };
62
63 typedef std::deque<MapSpawns> MapData;
64 //===============================================
65
67 {
70
71 G3D::AABox bounds;
73 std::vector<MeshTriangle> triangles;
74 std::vector<G3D::Vector3> vertexArray;
76
78 liquid(nullptr) { }
80
81 bool Read(FILE* f);
82 };
83
85 {
88 std::vector<GroupModel_Raw> groupsArray;
89
90 bool Read(const char * path);
91 };
92
94 {
95 private:
96 std::string iDestDir;
97 std::string iSrcDir;
99 std::set<std::string> spawnedModelFiles;
100
101 public:
102 TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName);
103 virtual ~TileAssembler();
104
105 bool convertWorld2();
106 bool readMapSpawns();
109
110 bool convertRawFile(const std::string& pModelFilename);
111 };
112
113} // VMAP
114#endif /*_TILEASSEMBLER_H_*/
uint32_t uint32
Definition: Define.h:142
G3D::Vector3 iDir
Definition: TileAssembler.h:45
void moveToBasePos(const G3D::Vector3 &pBasePos)
Definition: TileAssembler.h:52
G3D::Vector3 iPos
Definition: TileAssembler.h:44
G3D::Vector3 transform(const G3D::Vector3 &pIn) const
G3D::Matrix3 iRotation
Definition: TileAssembler.h:41
bool convertRawFile(const std::string &pModelFilename)
std::string iSrcDir
Definition: TileAssembler.h:97
TileAssembler(const std::string &pSrcDirName, const std::string &pDestDirName)
std::set< std::string > spawnedModelFiles
Definition: TileAssembler.h:99
bool calculateTransformedBound(ModelSpawn &spawn)
std::string iDestDir
Definition: TileAssembler.h:96
std::deque< MapSpawns > MapData
Definition: TileAssembler.h:63
ModelFlags
Definition: WorldModel.h:38
class WmoLiquid * liquid
Definition: TileAssembler.h:75
std::vector< G3D::Vector3 > vertexArray
Definition: TileAssembler.h:74
std::vector< MeshTriangle > triangles
Definition: TileAssembler.h:73
std::map< uint32, ModelSpawn > UniqueEntries
Definition: TileAssembler.h:58
std::map< uint32, std::set< uint32 > > TileEntries
Definition: TileAssembler.h:59
std::map< uint32, std::set< uint32 > > ParentTileEntries
Definition: TileAssembler.h:60
bool Read(const char *path)
std::vector< GroupModel_Raw > groupsArray
Definition: TileAssembler.h:88