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 <G3D/Vector3.h>
22#include <G3D/Matrix3.h>
23#include <map>
24#include <set>
25
26#include "ModelInstance.h"
27#include "WorldModel.h"
28
29namespace VMAP
30{
35 //===============================================
36
38 {
39 private:
40 G3D::Matrix3 iRotation;
41 public:
42 ModelPosition(): iScale(0.0f) { }
43 G3D::Vector3 iPos;
44 G3D::Vector3 iDir;
45 float iScale;
46 void init()
47 {
48 iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pif()*iDir.y/180.f, G3D::pif()*iDir.x/180.f, G3D::pif()*iDir.z/180.f);
49 }
50 G3D::Vector3 transform(const G3D::Vector3& pIn) const;
51 void moveToBasePos(const G3D::Vector3& pBasePos) { iPos -= pBasePos; }
52 };
53
54 typedef std::map<uint32, ModelSpawn> UniqueEntryMap;
55 typedef std::multimap<uint32, uint32> TileMap;
56
62
63 typedef std::map<uint32, MapSpawns*> MapData;
64 //===============================================
65
67 {
70
71 G3D::AABox bounds;
73 std::vector<MeshTriangle> triangles;
74 std::vector<G3D::Vector3> vertexArray;
76
77 GroupModel_Raw() : mogpflags(0), GroupWMOID(0), liquidflags(0),
78 liquid(nullptr) { }
80
81 bool Read(FILE* f);
82 };
83
85 {
87 std::vector<GroupModel_Raw> groupsArray;
88
89 bool Read(const char * path);
90 };
91
93 {
94 private:
95 std::string iDestDir;
96 std::string iSrcDir;
98 std::set<std::string> spawnedModelFiles;
99
100 public:
101 TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName);
102 virtual ~TileAssembler();
103
104 bool convertWorld2();
105 bool readMapSpawns();
106 bool calculateTransformedBound(ModelSpawn &spawn);
107 void exportGameobjectModels();
108
109 bool convertRawFile(const std::string& pModelFilename);
110 };
111
112} // VMAP
113#endif /*_TILEASSEMBLER_H_*/
#define TC_COMMON_API
Definition Define.h:96
uint32_t uint32
Definition Define.h:133
void moveToBasePos(const G3D::Vector3 &pBasePos)
G3D::Matrix3 iRotation
std::set< std::string > spawnedModelFiles
std::map< uint32, MapSpawns * > MapData
std::map< uint32, ModelSpawn > UniqueEntryMap
std::multimap< uint32, uint32 > TileMap
class WmoLiquid * liquid
std::vector< G3D::Vector3 > vertexArray
std::vector< MeshTriangle > triangles
UniqueEntryMap UniqueEntries
std::vector< GroupModel_Raw > groupsArray