Skip to content

Commit 556505d

Browse files
committed
Core/Vmaps: Expose loaded gameobject collision models in RegularGrid2D
1 parent a9c752a commit 556505d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/common/Collision/BoundingIntervalHierarchyWrapper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define TRINITYCORE_BOUNDING_INTERVAL_HIERARCHY_WRAPPER_H
2020

2121
#include "BoundingIntervalHierarchy.h"
22+
#include <span>
2223
#include <unordered_map>
2324

2425
template<class T, class BoundsFunc = BoundsTrait<T> >
@@ -115,6 +116,8 @@ class BIHWrap
115116
MDLCallback<IsectCallback> callback(intersectCallback, m_objects.data(), m_objects.size());
116117
m_tree.intersectPoint(point, callback);
117118
}
119+
120+
std::span<T const* const> getObjects() const { return m_objects; }
118121
};
119122

120123
#endif // TRINITYCORE_BOUNDING_INTERVAL_HIERARCHY_WRAPPER_H

src/common/Collision/DynamicTree.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,9 @@ bool DynamicMapTree::getAreaAndLiquidData(float x, float y, float z, PhaseShift
280280
}
281281
return false;
282282
}
283+
284+
std::span<GameObjectModel const* const> DynamicMapTree::getModelsInGrid(uint32 gx, uint32 gy) const
285+
{
286+
// convert from map tile X/Y to RegularGrid internal representation
287+
return impl->getObjects(63 - int32(gx), 63 - int32(gy));
288+
}

src/common/Collision/DynamicTree.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "Define.h"
2222
#include "Optional.h"
2323
#include <memory>
24+
#include <span>
2425

2526
namespace G3D
2627
{
@@ -59,6 +60,8 @@ class TC_COMMON_API DynamicMapTree
5960

6061
void balance();
6162
void update(uint32 diff);
63+
64+
std::span<GameObjectModel const* const> getModelsInGrid(uint32 gx, uint32 gy) const;
6265
};
6366

6467
#endif // _DYNTREE_H

0 commit comments

Comments
 (0)