TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TileAssembler.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef _TILEASSEMBLER_H_
20 #define _TILEASSEMBLER_H_
21 
22 #include <G3D/Vector3.h>
23 #include <G3D/Matrix3.h>
24 #include <map>
25 #include <set>
26 
27 #include "ModelInstance.h"
28 #include "WorldModel.h"
29 
30 namespace VMAP
31 {
36  //===============================================
37 
39  {
40  private:
42  public:
43  ModelPosition(): iScale(0.0f) { }
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  typedef std::map<uint32, ModelSpawn> UniqueEntryMap;
56  typedef std::multimap<uint32, uint32> TileMap;
57 
59  {
60  UniqueEntryMap UniqueEntries;
61  TileMap TileEntries;
62  };
63 
64  typedef std::map<uint32, MapSpawns*> MapData;
65  //===============================================
66 
68  {
71 
74  std::vector<MeshTriangle> triangles;
75  std::vector<G3D::Vector3> vertexArray;
76  class WmoLiquid* liquid;
77 
78  GroupModel_Raw() : mogpflags(0), GroupWMOID(0), liquidflags(0),
79  liquid(NULL) { }
80  ~GroupModel_Raw();
81 
82  bool Read(FILE* f);
83  };
84 
86  {
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;
98  bool (*iFilterMethod)(char *pName);
100  unsigned int iCurrentUniqueNameId;
101  MapData mapData;
102  std::set<std::string> spawnedModelFiles;
103 
104  public:
105  TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName);
106  virtual ~TileAssembler();
107 
108  bool convertWorld2();
109  bool readMapSpawns();
110  bool calculateTransformedBound(ModelSpawn &spawn);
111  void exportGameobjectModels();
112 
113  bool convertRawFile(const std::string& pModelFilename);
114  void setModelNameFilterMethod(bool (*pFilterMethod)(char *pName)) { iFilterMethod = pFilterMethod; }
115  std::string getDirEntryNameFromModName(unsigned int pMapId, const std::string& pModPosName);
116  };
117 
118 } // VMAP
119 #endif /*_TILEASSEMBLER_H_*/
float x
Definition: Vector3.h:62
Definition: TileAssembler.h:67
std::map< uint32, MapSpawns * > MapData
Definition: TileAssembler.h:64
UniqueEntryMap UniqueEntries
Definition: TileAssembler.h:60
std::multimap< uint32, uint32 > TileMap
Definition: TileAssembler.h:56
G3D::AABox bounds
Definition: TileAssembler.h:72
uint32 RootWMOID
Definition: TileAssembler.h:87
std::set< std::string > spawnedModelFiles
Definition: TileAssembler.h:102
unsigned int iCurrentUniqueNameId
Definition: TileAssembler.h:100
uint32 GroupWMOID
Definition: TileAssembler.h:70
G3D::Vector3 iDir
Definition: TileAssembler.h:45
std::vector< GroupModel_Raw > groupsArray
Definition: TileAssembler.h:88
GroupModel_Raw()
Definition: TileAssembler.h:78
arena_t NULL
Definition: jemalloc_internal.h:624
G3D::Matrix3 iRotation
Definition: TileAssembler.h:41
Definition: IVMapManager.h:31
float y
Definition: Vector3.h:62
G3D::Vector3 iPos
Definition: TileAssembler.h:44
Definition: Vector3.h:58
#define bool
Definition: CascPort.h:16
std::string iDestDir
Definition: TileAssembler.h:96
Definition: TileAssembler.h:85
MapData mapData
Definition: TileAssembler.h:101
ModelPosition()
Definition: TileAssembler.h:43
Definition: TileAssembler.h:58
G3D::Table< std::string, unsigned int > iUniqueNameIds
Definition: TileAssembler.h:99
std::vector< G3D::Vector3 > vertexArray
Definition: TileAssembler.h:75
uint32_t uint32
Definition: Define.h:150
void setModelNameFilterMethod(bool(*pFilterMethod)(char *pName))
Definition: TileAssembler.h:114
class WmoLiquid * liquid
Definition: TileAssembler.h:76
Definition: AABox.h:32
#define TC_COMMON_API
Definition: Define.h:116
Definition: Matrix3.h:37
float iScale
Definition: TileAssembler.h:46
Definition: TileAssembler.h:93
Definition: WorldModel.h:47
float z
Definition: Vector3.h:62
std::vector< MeshTriangle > triangles
Definition: TileAssembler.h:74
Definition: TileAssembler.h:38
Definition: ModelInstance.h:42
uint32 mogpflags
Definition: TileAssembler.h:69
float pif()
Definition: g3dmath.h:151
std::map< uint32, ModelSpawn > UniqueEntryMap
Definition: TileAssembler.h:55
static Matrix3 fromEulerAnglesZYX(float fYAngle, float fPAngle, float fRAngle)
Definition: Matrix3.cpp:1664
TileMap TileEntries
Definition: TileAssembler.h:61
void init()
Definition: TileAssembler.h:47
void moveToBasePos(const G3D::Vector3 &pBasePos)
Definition: TileAssembler.h:52
uint32 liquidflags
Definition: TileAssembler.h:73
std::string iSrcDir
Definition: TileAssembler.h:97