diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/Collision/DynamicTree.cpp | 46 | ||||
-rw-r--r-- | src/common/Collision/DynamicTree.h | 4 | ||||
-rw-r--r-- | src/common/Collision/Management/IVMapManager.h | 24 | ||||
-rw-r--r-- | src/common/Collision/Management/VMapManager2.cpp | 76 | ||||
-rw-r--r-- | src/common/Collision/Management/VMapManager2.h | 4 | ||||
-rw-r--r-- | src/common/Collision/Maps/MapDefines.h | 23 | ||||
-rw-r--r-- | src/common/Collision/Maps/MapTree.cpp | 32 | ||||
-rw-r--r-- | src/common/Collision/Maps/MapTree.h | 1 | ||||
-rw-r--r-- | src/common/Collision/Models/GameObjectModel.cpp | 27 | ||||
-rw-r--r-- | src/common/Collision/Models/GameObjectModel.h | 1 | ||||
-rw-r--r-- | src/common/Collision/Models/ModelInstance.cpp | 34 | ||||
-rw-r--r-- | src/common/Collision/Models/ModelInstance.h | 1 | ||||
-rw-r--r-- | src/common/Collision/Models/WorldModel.cpp | 21 | ||||
-rw-r--r-- | src/common/Collision/Models/WorldModel.h | 1 |
14 files changed, 52 insertions, 243 deletions
diff --git a/src/common/Collision/DynamicTree.cpp b/src/common/Collision/DynamicTree.cpp index 8d46455b16b..c2d84e06864 100644 --- a/src/common/Collision/DynamicTree.cpp +++ b/src/common/Collision/DynamicTree.cpp @@ -154,22 +154,6 @@ private: PhaseShift const& _phaseShift; }; -struct DynamicTreeAreaInfoCallback -{ - DynamicTreeAreaInfoCallback(PhaseShift const& phaseShift) : _phaseShift(phaseShift) {} - - void operator()(G3D::Vector3 const& p, GameObjectModel const& obj) - { - obj.intersectPoint(p, _areaInfo, _phaseShift); - } - - VMAP::AreaInfo const& GetAreaInfo() const { return _areaInfo; } - -private: - PhaseShift const& _phaseShift; - VMAP::AreaInfo _areaInfo; -}; - struct DynamicTreeLocationInfoCallback { DynamicTreeLocationInfoCallback(PhaseShift const& phaseShift) : _phaseShift(phaseShift), _hitModel(nullptr) {} @@ -264,24 +248,7 @@ float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, return -G3D::finf(); } -bool DynamicMapTree::getAreaInfo(float x, float y, float& z, PhaseShift const& phaseShift, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const -{ - G3D::Vector3 v(x, y, z + 0.5f); - DynamicTreeAreaInfoCallback intersectionCallBack(phaseShift); - impl->intersectPoint(v, intersectionCallBack); - if (intersectionCallBack.GetAreaInfo().result) - { - flags = intersectionCallBack.GetAreaInfo().flags; - adtId = intersectionCallBack.GetAreaInfo().adtId; - rootId = intersectionCallBack.GetAreaInfo().rootId; - groupId = intersectionCallBack.GetAreaInfo().groupId; - z = intersectionCallBack.GetAreaInfo().ground_Z; - return true; - } - return false; -} - -void DynamicMapTree::getAreaAndLiquidData(float x, float y, float z, PhaseShift const& phaseShift, uint8 reqLiquidType, VMAP::AreaAndLiquidData& data) const +bool DynamicMapTree::getAreaAndLiquidData(float x, float y, float z, PhaseShift const& phaseShift, Optional<uint8> reqLiquidType, VMAP::AreaAndLiquidData& data) const { G3D::Vector3 v(x, y, z + 0.5f); DynamicTreeLocationInfoCallback intersectionCallBack(phaseShift); @@ -291,13 +258,16 @@ void DynamicMapTree::getAreaAndLiquidData(float x, float y, float z, PhaseShift data.floorZ = intersectionCallBack.GetLocationInfo().ground_Z; uint32 liquidType = intersectionCallBack.GetLocationInfo().hitModel->GetLiquidType(); float liquidLevel; - if (!reqLiquidType || VMAP::VMapFactory::createOrGetVMapManager()->GetLiquidFlagsPtr(liquidType) & reqLiquidType) + if (!reqLiquidType || VMAP::VMapFactory::createOrGetVMapManager()->GetLiquidFlagsPtr(liquidType) & *reqLiquidType) if (intersectionCallBack.GetHitModel()->GetLiquidLevel(v, intersectionCallBack.GetLocationInfo(), liquidLevel)) data.liquidInfo.emplace(liquidType, liquidLevel); - data.areaInfo.emplace(intersectionCallBack.GetHitModel()->GetNameSetId(), + data.areaInfo.emplace(intersectionCallBack.GetLocationInfo().hitModel->GetWmoID(), + intersectionCallBack.GetHitModel()->GetNameSetId(), intersectionCallBack.GetLocationInfo().rootId, - intersectionCallBack.GetLocationInfo().hitModel->GetWmoID(), - intersectionCallBack.GetLocationInfo().hitModel->GetMogpFlags()); + intersectionCallBack.GetLocationInfo().hitModel->GetMogpFlags(), + 0); + return true; } + return false; } diff --git a/src/common/Collision/DynamicTree.h b/src/common/Collision/DynamicTree.h index 9b64c00d09b..50dc3d92993 100644 --- a/src/common/Collision/DynamicTree.h +++ b/src/common/Collision/DynamicTree.h @@ -19,6 +19,7 @@ #define _DYNTREE_H #include "Define.h" +#include "Optional.h" namespace G3D { @@ -49,8 +50,7 @@ public: bool getObjectHitPos(G3D::Vector3 const& startPos, G3D::Vector3 const& endPos, G3D::Vector3& resultHitPos, float modifyDist, PhaseShift const& phaseShift) const; float getHeight(float x, float y, float z, float maxSearchDist, PhaseShift const& phaseShift) const; - bool getAreaInfo(float x, float y, float& z, PhaseShift const& phaseShift, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const; - void getAreaAndLiquidData(float x, float y, float z, PhaseShift const& phaseShift, uint8 reqLiquidType, VMAP::AreaAndLiquidData& data) const; + bool getAreaAndLiquidData(float x, float y, float z, PhaseShift const& phaseShift, Optional<uint8> reqLiquidType, VMAP::AreaAndLiquidData& data) const; void insert(GameObjectModel const&); void remove(GameObjectModel const&); diff --git a/src/common/Collision/Management/IVMapManager.h b/src/common/Collision/Management/IVMapManager.h index 59cb8409f46..baece194fb9 100644 --- a/src/common/Collision/Management/IVMapManager.h +++ b/src/common/Collision/Management/IVMapManager.h @@ -47,17 +47,21 @@ namespace VMAP { struct AreaInfo { - AreaInfo(int32 _adtId, int32 _rootId, int32 _groupId, uint32 _flags) : adtId(_adtId), rootId(_rootId), groupId(_groupId), mogpFlags(_flags) { } - int32 const adtId; - int32 const rootId; - int32 const groupId; - uint32 const mogpFlags; + AreaInfo() = default; + AreaInfo(int32 _groupId, int32 _adtId, int32 _rootId, uint32 _mogpFlags, uint32 _uniqueId) + : groupId(_groupId), adtId(_adtId), rootId(_rootId), mogpFlags(_mogpFlags), uniqueId(_uniqueId) { } + int32 groupId = 0; + int32 adtId = 0; + int32 rootId = 0; + uint32 mogpFlags = 0; + uint32 uniqueId = 0; }; struct LiquidInfo { + LiquidInfo() = default; LiquidInfo(uint32 _type, float _level) : type(_type), level(_level) { } - uint32 const type; - float const level; + uint32 type = 0; + float level = 0.0f; }; float floorZ = VMAP_INVALID_HEIGHT; @@ -111,14 +115,12 @@ namespace VMAP bool isMapLoadingEnabled() const { return(iEnableLineOfSightCalc || iEnableHeightCalc ); } virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const =0; + /** Query world model area info. \param z gets adjusted to the ground height for which this are info is valid */ - virtual bool getAreaInfo(uint32 mapId, float x, float y, float &z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const=0; - virtual bool GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type, uint32& mogpFlags) const=0; - // get both area + liquid data in a single vmap lookup - virtual void getAreaAndLiquidData(unsigned int mapId, float x, float y, float z, uint8 reqLiquidType, AreaAndLiquidData& data) const=0; + virtual bool getAreaAndLiquidData(unsigned int mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const = 0; }; } diff --git a/src/common/Collision/Management/VMapManager2.cpp b/src/common/Collision/Management/VMapManager2.cpp index 78d5be2b79c..3885d3f40df 100644 --- a/src/common/Collision/Management/VMapManager2.cpp +++ b/src/common/Collision/Management/VMapManager2.cpp @@ -238,63 +238,8 @@ namespace VMAP return VMAP_INVALID_HEIGHT_VALUE; } - bool VMapManager2::getAreaInfo(uint32 mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const + bool VMapManager2::getAreaAndLiquidData(unsigned int mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const { - if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG)) - { - auto instanceTree = GetMapTree(mapId); - if (instanceTree != iInstanceMapTrees.end()) - { - Vector3 pos = convertPositionToInternalRep(x, y, z); - bool result = instanceTree->second->getAreaInfo(pos, flags, adtId, rootId, groupId); - // z is not touched by convertPositionToInternalRep(), so just copy - z = pos.z; - return result; - } - } - - return false; - } - - bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type, uint32& mogpFlags) const - { - if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LIQUIDSTATUS)) - { - auto instanceTree = GetMapTree(mapId); - if (instanceTree != iInstanceMapTrees.end()) - { - LocationInfo info; - Vector3 pos = convertPositionToInternalRep(x, y, z); - if (instanceTree->second->GetLocationInfo(pos, info)) - { - floor = info.ground_Z; - ASSERT(floor < std::numeric_limits<float>::max()); - ASSERT(info.hitModel); - type = info.hitModel->GetLiquidType(); // entry from LiquidType.dbc - mogpFlags = info.hitModel->GetMogpFlags(); - if (reqLiquidType && !(GetLiquidFlagsPtr(type) & reqLiquidType)) - return false; - ASSERT(info.hitInstance); - if (info.hitInstance->GetLiquidLevel(pos, info, level)) - return true; - } - } - } - - return false; - } - - void VMapManager2::getAreaAndLiquidData(unsigned int mapId, float x, float y, float z, uint8 reqLiquidType, AreaAndLiquidData& data) const - { - if (IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LIQUIDSTATUS)) - { - data.floorZ = z; - int32 adtId, rootId, groupId; - uint32 flags; - if (getAreaInfo(mapId, x, y, data.floorZ, flags, adtId, rootId, groupId)) - data.areaInfo.emplace(adtId, rootId, groupId, flags); - return; - } InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId); if (instanceTree != iInstanceMapTrees.end()) { @@ -303,16 +248,23 @@ namespace VMAP if (instanceTree->second->GetLocationInfo(pos, info)) { data.floorZ = info.ground_Z; - uint32 liquidType = info.hitModel->GetLiquidType(); - float liquidLevel; - if (!reqLiquidType || (GetLiquidFlagsPtr(liquidType) & reqLiquidType)) - if (info.hitInstance->GetLiquidLevel(pos, info, liquidLevel)) - data.liquidInfo.emplace(liquidType, liquidLevel); + if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LIQUIDSTATUS)) + { + uint32 liquidType = info.hitModel->GetLiquidType(); // entry from LiquidType.dbc + float liquidLevel; + if (!reqLiquidType || (GetLiquidFlagsPtr(liquidType) & *reqLiquidType)) + if (info.hitInstance->GetLiquidLevel(pos, info, liquidLevel)) + data.liquidInfo.emplace(liquidType, liquidLevel); + } if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG)) - data.areaInfo.emplace(info.hitInstance->adtId, info.rootId, info.hitModel->GetWmoID(), info.hitModel->GetMogpFlags()); + data.areaInfo.emplace(info.hitModel->GetWmoID(), info.hitInstance->adtId, info.rootId, info.hitModel->GetMogpFlags(), info.hitInstance->ID); + + return true; } } + + return false; } WorldModel* VMapManager2::acquireModelInstance(std::string const& basepath, std::string const& filename) diff --git a/src/common/Collision/Management/VMapManager2.h b/src/common/Collision/Management/VMapManager2.h index 3dda9c54cd2..57fca55d5f6 100644 --- a/src/common/Collision/Management/VMapManager2.h +++ b/src/common/Collision/Management/VMapManager2.h @@ -103,9 +103,7 @@ namespace VMAP bool processCommand(char* /*command*/) override { return false; } // for debug and extensions - bool getAreaInfo(uint32 mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const override; - bool GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type, uint32& mogpFlags) const override; - void getAreaAndLiquidData(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, AreaAndLiquidData& data) const override; + bool getAreaAndLiquidData(uint32 mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const override; WorldModel* acquireModelInstance(std::string const& basepath, std::string const& filename); void releaseModelInstance(std::string const& filename); diff --git a/src/common/Collision/Maps/MapDefines.h b/src/common/Collision/Maps/MapDefines.h index 0aa187617df..468d9cee9a6 100644 --- a/src/common/Collision/Maps/MapDefines.h +++ b/src/common/Collision/Maps/MapDefines.h @@ -142,23 +142,26 @@ struct LiquidData float depth_level; }; -struct PositionFullTerrainStatus +struct WmoLocation { - struct AreaInfo - { - AreaInfo(int32 _adtId, int32 _rootId, int32 _groupId, uint32 _flags) : adtId(_adtId), rootId(_rootId), groupId(_groupId), mogpFlags(_flags) { } - int32 const adtId; - int32 const rootId; - int32 const groupId; - uint32 const mogpFlags; - }; + WmoLocation() = default; + WmoLocation(int32 groupId, int32 nameSetId, int32 rootId, uint32 uniqueId) + : GroupId(groupId), NameSetId(nameSetId), RootId(rootId), UniqueId(uniqueId) { } + + int32 GroupId = 0; + int32 NameSetId = 0; + int32 RootId = 0; + uint32 UniqueId = 0; +}; +struct PositionFullTerrainStatus +{ PositionFullTerrainStatus() : areaId(0), floorZ(0.0f), outdoors(true), liquidStatus(LIQUID_MAP_NO_WATER) { } uint32 areaId; float floorZ; bool outdoors; ZLiquidStatus liquidStatus; - Optional<AreaInfo> areaInfo; + Optional<WmoLocation> wmoLocation; Optional<LiquidData> liquidInfo; }; diff --git a/src/common/Collision/Maps/MapTree.cpp b/src/common/Collision/Maps/MapTree.cpp index 88eb9d2c6df..61eb7e3fab0 100644 --- a/src/common/Collision/Maps/MapTree.cpp +++ b/src/common/Collision/Maps/MapTree.cpp @@ -50,22 +50,6 @@ namespace VMAP ModelIgnoreFlags flags; }; - class AreaInfoCallback - { - public: - AreaInfoCallback(ModelInstance* val) : prims(val) { } - void operator()(Vector3 const& point, uint32 entry) - { -#ifdef VMAP_DEBUG - TC_LOG_DEBUG("maps", "AreaInfoCallback: trying to intersect '{}'", prims[entry].name); -#endif - prims[entry].intersectPoint(point, aInfo); - } - - ModelInstance* prims; - AreaInfo aInfo; - }; - class LocationInfoCallback { public: @@ -96,22 +80,6 @@ namespace VMAP return tilefilename.str(); } - bool StaticMapTree::getAreaInfo(Vector3& pos, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const - { - AreaInfoCallback intersectionCallBack(iTreeValues); - iTree.intersectPoint(pos, intersectionCallBack); - if (intersectionCallBack.aInfo.result) - { - flags = intersectionCallBack.aInfo.flags; - adtId = intersectionCallBack.aInfo.adtId; - rootId = intersectionCallBack.aInfo.rootId; - groupId = intersectionCallBack.aInfo.groupId; - pos.z = intersectionCallBack.aInfo.ground_Z; - return true; - } - return false; - } - bool StaticMapTree::GetLocationInfo(Vector3 const& pos, LocationInfo& info) const { LocationInfoCallback intersectionCallBack(iTreeValues, info); diff --git a/src/common/Collision/Maps/MapTree.h b/src/common/Collision/Maps/MapTree.h index c111cbc4422..4a5e60d6fe2 100644 --- a/src/common/Collision/Maps/MapTree.h +++ b/src/common/Collision/Maps/MapTree.h @@ -88,7 +88,6 @@ namespace VMAP bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2, ModelIgnoreFlags ignoreFlags) const; bool getObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const; float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const; - bool getAreaInfo(G3D::Vector3 &pos, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const; bool GetLocationInfo(const G3D::Vector3 &pos, LocationInfo &info) const; LoadResult InitMap(std::string const& fname); diff --git a/src/common/Collision/Models/GameObjectModel.cpp b/src/common/Collision/Models/GameObjectModel.cpp index 363863f5759..f2b19e038fa 100644 --- a/src/common/Collision/Models/GameObjectModel.cpp +++ b/src/common/Collision/Models/GameObjectModel.cpp @@ -186,33 +186,6 @@ bool GameObjectModel::intersectRay(G3D::Ray const& ray, float& maxDist, bool sto return hit; } -void GameObjectModel::intersectPoint(G3D::Vector3 const& point, VMAP::AreaInfo& info, PhaseShift const& phaseShift) const -{ - if (!isCollisionEnabled() || !owner->IsSpawned() || !isMapObject()) - return; - - if (!owner->IsInPhase(phaseShift)) - return; - - if (!iBound.contains(point)) - return; - - // child bounds are defined in object space: - Vector3 pModel = iInvRot * (point - iPos) * iInvScale; - Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f); - float zDist; - if (iModel->IntersectPoint(pModel, zDirModel, zDist, info)) - { - Vector3 modelGround = pModel + zDist * zDirModel; - float world_Z = ((modelGround * iInvRot) * iScale + iPos).z; - if (info.ground_Z < world_Z) - { - info.ground_Z = world_Z; - info.adtId = owner->GetNameSetId(); - } - } -} - bool GameObjectModel::GetLocationInfo(G3D::Vector3 const& point, VMAP::LocationInfo& info, PhaseShift const& phaseShift) const { if (!isCollisionEnabled() || !owner->IsSpawned() || !isMapObject()) diff --git a/src/common/Collision/Models/GameObjectModel.h b/src/common/Collision/Models/GameObjectModel.h index fd11e5c1909..f875d9e3197 100644 --- a/src/common/Collision/Models/GameObjectModel.h +++ b/src/common/Collision/Models/GameObjectModel.h @@ -75,7 +75,6 @@ public: uint8 GetNameSetId() const { return owner->GetNameSetId(); } bool intersectRay(G3D::Ray const& ray, float& maxDist, bool stopAtFirstHit, PhaseShift const& phaseShift, VMAP::ModelIgnoreFlags ignoreFlags) const; - void intersectPoint(G3D::Vector3 const& point, VMAP::AreaInfo& info, PhaseShift const& phaseShift) const; bool GetLocationInfo(G3D::Vector3 const& point, VMAP::LocationInfo& info, PhaseShift const& phaseShift) const; bool GetLiquidLevel(G3D::Vector3 const& point, VMAP::LocationInfo& info, float& liqHeight) const; diff --git a/src/common/Collision/Models/ModelInstance.cpp b/src/common/Collision/Models/ModelInstance.cpp index 989a5710afe..6838babcbe2 100644 --- a/src/common/Collision/Models/ModelInstance.cpp +++ b/src/common/Collision/Models/ModelInstance.cpp @@ -63,40 +63,6 @@ namespace VMAP return hit; } - void ModelInstance::intersectPoint(const G3D::Vector3& p, AreaInfo& info) const - { - if (!iModel) - { -#ifdef VMAP_DEBUG - std::cout << "<object not loaded>\n"; -#endif - return; - } - - // M2 files don't contain area info, only WMO files - if (iModel->IsM2()) - return; - if (!iBound.contains(p)) - return; - // child bounds are defined in object space: - Vector3 pModel = iInvRot * (p - iPos) * iInvScale; - Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f); - float zDist; - if (iModel->IntersectPoint(pModel, zDirModel, zDist, info)) - { - Vector3 modelGround = pModel + zDist * zDirModel; - // Transform back to world space. Note that: - // Mat * vec == vec * Mat.transpose() - // and for rotation matrices: Mat.inverse() == Mat.transpose() - float world_Z = ((modelGround * iInvRot) * iScale + iPos).z; - if (info.ground_Z < world_Z) - { - info.ground_Z = world_Z; - info.adtId = adtId; - } - } - } - bool ModelInstance::GetLocationInfo(const G3D::Vector3& p, LocationInfo& info) const { if (!iModel) diff --git a/src/common/Collision/Models/ModelInstance.h b/src/common/Collision/Models/ModelInstance.h index d44a867ae3c..7361fbb9335 100644 --- a/src/common/Collision/Models/ModelInstance.h +++ b/src/common/Collision/Models/ModelInstance.h @@ -73,7 +73,6 @@ namespace VMAP ModelInstance(ModelSpawn const& spawn, WorldModel* model); void setUnloaded() { iModel = nullptr; } bool intersectRay(G3D::Ray const& pRay, float& pMaxDist, bool pStopAtFirstHit, ModelIgnoreFlags ignoreFlags) const; - void intersectPoint(G3D::Vector3 const& p, AreaInfo& info) const; bool GetLocationInfo(G3D::Vector3 const& p, LocationInfo& info) const; bool GetLiquidLevel(G3D::Vector3 const& p, LocationInfo& info, float& liqHeight) const; G3D::Matrix3 const& GetInvRot() const { return iInvRot; } diff --git a/src/common/Collision/Models/WorldModel.cpp b/src/common/Collision/Models/WorldModel.cpp index 1e9b2e44ddb..27e724af69c 100644 --- a/src/common/Collision/Models/WorldModel.cpp +++ b/src/common/Collision/Models/WorldModel.cpp @@ -471,7 +471,7 @@ namespace VMAP if ((ignoreFlags & ModelIgnoreFlags::M2) != ModelIgnoreFlags::Nothing) { // M2 models are not taken into account for LoS calculation if caller requested their ignoring. - if (Flags.HasFlag(ModelFlags::None)) + if (IsM2()) return false; } @@ -522,25 +522,6 @@ namespace VMAP } }; - bool WorldModel::IntersectPoint(const G3D::Vector3& p, const G3D::Vector3& down, float& dist, AreaInfo& info) const - { - if (groupModels.empty()) - return false; - - WModelAreaCallback callback(groupModels, down); - groupTree.intersectPoint(p, callback); - if (callback.hit != groupModels.end()) - { - info.rootId = RootWMOID; - info.groupId = callback.hit->GetWmoID(); - info.flags = callback.hit->GetMogpFlags(); - info.result = true; - dist = callback.zDist; - return true; - } - return false; - } - bool WorldModel::GetLocationInfo(const G3D::Vector3& p, const G3D::Vector3& down, float& dist, GroupLocationInfo& info) const { if (groupModels.empty()) diff --git a/src/common/Collision/Models/WorldModel.h b/src/common/Collision/Models/WorldModel.h index 35ffa57b4d2..52bce830ef1 100644 --- a/src/common/Collision/Models/WorldModel.h +++ b/src/common/Collision/Models/WorldModel.h @@ -122,7 +122,6 @@ namespace VMAP void setFlags(ModelFlags flags) { Flags = flags; } void setRootWmoID(uint32 id) { RootWMOID = id; } bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) const; - bool IntersectPoint(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, AreaInfo &info) const; bool GetLocationInfo(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, GroupLocationInfo& info) const; bool writeFile(const std::string &filename); bool readFile(const std::string &filename); |