diff options
-rw-r--r-- | src/common/Collision/Management/VMapManager2.cpp | 5 | ||||
-rw-r--r-- | src/common/Collision/Management/VMapManager2.h | 2 | ||||
-rw-r--r-- | src/common/Collision/Maps/MapTree.cpp | 6 | ||||
-rw-r--r-- | src/common/Collision/Models/ModelInstance.h | 3 | ||||
-rw-r--r-- | src/common/Collision/Models/WorldModel.cpp | 19 | ||||
-rw-r--r-- | src/common/Collision/Models/WorldModel.h | 10 | ||||
-rw-r--r-- | src/tools/mmaps_generator/VMapExtensions.cpp | 70 |
7 files changed, 36 insertions, 79 deletions
diff --git a/src/common/Collision/Management/VMapManager2.cpp b/src/common/Collision/Management/VMapManager2.cpp index 9594951196f..a63eac1b935 100644 --- a/src/common/Collision/Management/VMapManager2.cpp +++ b/src/common/Collision/Management/VMapManager2.cpp @@ -326,4 +326,9 @@ namespace VMAP return StaticMapTree::CanLoadMap(std::string(basePath), mapId, x, y); } + void VMapManager2::getInstanceMapTree(InstanceTreeMap &instanceMapTree) + { + instanceMapTree = iInstanceMapTrees; + } + } // namespace VMAP diff --git a/src/common/Collision/Management/VMapManager2.h b/src/common/Collision/Management/VMapManager2.h index a5891e9642b..c2e1aee1ff7 100644 --- a/src/common/Collision/Management/VMapManager2.h +++ b/src/common/Collision/Management/VMapManager2.h @@ -128,7 +128,7 @@ namespace VMAP return getMapFileName(mapId); } virtual bool existsMap(const char* basePath, unsigned int mapId, int x, int y) override; - public: + void getInstanceMapTree(InstanceTreeMap &instanceMapTree); typedef uint32(*GetLiquidFlagsFn)(uint32 liquidType); diff --git a/src/common/Collision/Maps/MapTree.cpp b/src/common/Collision/Maps/MapTree.cpp index b493ec18f5f..e374da4f1b9 100644 --- a/src/common/Collision/Maps/MapTree.cpp +++ b/src/common/Collision/Maps/MapTree.cpp @@ -474,4 +474,10 @@ namespace VMAP } iLoadedTiles.erase(tile); } + + void StaticMapTree::getModelInstances(ModelInstance* &models, uint32 &count) + { + models = iTreeValues; + count = iNTreeValues; + } } diff --git a/src/common/Collision/Models/ModelInstance.h b/src/common/Collision/Models/ModelInstance.h index dfdb001db0a..f8bbfa4fa73 100644 --- a/src/common/Collision/Models/ModelInstance.h +++ b/src/common/Collision/Models/ModelInstance.h @@ -70,12 +70,11 @@ namespace VMAP void intersectPoint(const G3D::Vector3& p, AreaInfo &info) const; bool GetLocationInfo(const G3D::Vector3& p, LocationInfo &info) const; bool GetLiquidLevel(const G3D::Vector3& p, LocationInfo &info, float &liqHeight) const; + WorldModel* getWorldModel() { return iModel; } protected: G3D::Matrix3 iInvRot; float iInvScale; WorldModel* iModel; - public: - WorldModel* getWorldModel(); }; } // namespace VMAP diff --git a/src/common/Collision/Models/WorldModel.cpp b/src/common/Collision/Models/WorldModel.cpp index 86ab9366c71..087abfcd09d 100644 --- a/src/common/Collision/Models/WorldModel.cpp +++ b/src/common/Collision/Models/WorldModel.cpp @@ -249,6 +249,13 @@ namespace VMAP return result; } + void WmoLiquid::getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const + { + tilesX = iTilesX; + tilesY = iTilesY; + corner = iCorner; + } + // ===================== GroupModel ================================== GroupModel::GroupModel(const GroupModel &other): @@ -409,6 +416,13 @@ namespace VMAP return 0; } + void GroupModel::getMeshData(std::vector<G3D::Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid) + { + vertices = this->vertices; + triangles = this->triangles; + liquid = iLiquid; + } + // ===================== WorldModel ================================== void WorldModel::setGroupModels(std::vector<GroupModel> &models) @@ -582,4 +596,9 @@ namespace VMAP fclose(rf); return result; } + + void WorldModel::getGroupModels(std::vector<GroupModel> &groupModels) + { + groupModels = this->groupModels; + } } diff --git a/src/common/Collision/Models/WorldModel.h b/src/common/Collision/Models/WorldModel.h index 6a901a59fdf..4d46915678b 100644 --- a/src/common/Collision/Models/WorldModel.h +++ b/src/common/Collision/Models/WorldModel.h @@ -58,6 +58,7 @@ namespace VMAP uint32 GetFileSize(); bool writeToFile(FILE* wf); static bool readFromFile(FILE* rf, WmoLiquid* &liquid); + void getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const; private: WmoLiquid() : iTilesX(0), iTilesY(0), iCorner(), iType(0), iHeight(NULL), iFlags(NULL) { } uint32 iTilesX; //!< number of tiles in x direction, each @@ -66,8 +67,6 @@ namespace VMAP uint32 iType; //!< liquid type float *iHeight; //!< (tilesX + 1)*(tilesY + 1) height values uint8 *iFlags; //!< info if liquid tile is used - public: - void getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const; }; /*! holding additional info for WMO group files */ @@ -92,6 +91,7 @@ namespace VMAP const G3D::AABox& GetBound() const { return iBound; } uint32 GetMogpFlags() const { return iMogpFlags; } uint32 GetWmoID() const { return iGroupWMOID; } + void getMeshData(std::vector<G3D::Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid); protected: G3D::AABox iBound; uint32 iMogpFlags;// 0x8 outdor; 0x2000 indoor @@ -100,9 +100,8 @@ namespace VMAP std::vector<MeshTriangle> triangles; BIH meshTree; WmoLiquid* iLiquid; - public: - void getMeshData(std::vector<G3D::Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid); }; + /*! Holds a model (converted M2 or WMO) in its original coordinate space */ class WorldModel { @@ -117,12 +116,11 @@ namespace VMAP bool GetLocationInfo(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, LocationInfo &info) const; bool writeFile(const std::string &filename); bool readFile(const std::string &filename); + void getGroupModels(std::vector<GroupModel> &groupModels); protected: uint32 RootWMOID; std::vector<GroupModel> groupModels; BIH groupTree; - public: - void getGroupModels(std::vector<GroupModel> &groupModels); }; } // namespace VMAP diff --git a/src/tools/mmaps_generator/VMapExtensions.cpp b/src/tools/mmaps_generator/VMapExtensions.cpp deleted file mode 100644 index 63c8e524542..00000000000 --- a/src/tools/mmaps_generator/VMapExtensions.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <vector> -#include "MapTree.h" -#include "VMapManager2.h" -#include "WorldModel.h" -#include "ModelInstance.h" - -namespace VMAP -{ - // Need direct access to encapsulated VMAP data, so we add functions for MMAP generator - // maybe add MapBuilder as friend to all of the below classes would be better? - - // declared in src/shared/vmap/MapTree.h - void StaticMapTree::getModelInstances(ModelInstance* &models, uint32 &count) - { - models = iTreeValues; - count = iNTreeValues; - } - - // declared in src/shared/vmap/VMapManager2.h - void VMapManager2::getInstanceMapTree(InstanceTreeMap &instanceMapTree) - { - instanceMapTree = iInstanceMapTrees; - } - - // declared in src/shared/vmap/WorldModel.h - void WorldModel::getGroupModels(std::vector<GroupModel> &groupModels) - { - groupModels = this->groupModels; - } - - // declared in src/shared/vmap/WorldModel.h - void GroupModel::getMeshData(std::vector<G3D::Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid) - { - vertices = this->vertices; - triangles = this->triangles; - liquid = iLiquid; - } - - // declared in src/shared/vmap/ModelInstance.h - WorldModel* ModelInstance::getWorldModel() - { - return iModel; - } - - // declared in src/shared/vmap/WorldModel.h - void WmoLiquid::getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const - { - tilesX = iTilesX; - tilesY = iTilesY; - corner = iCorner; - } -} |