mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-05 15:55:45 +00:00
Allow to represent empty range with TilesPositionsRange
This commit is contained in:
parent
1b2954f2db
commit
a5b078e9a7
@ -29,7 +29,7 @@ namespace DetourNavigator
|
||||
if (minTile.y() > maxTile.y())
|
||||
std::swap(minTile.y(), maxTile.y());
|
||||
|
||||
return {minTile, maxTile};
|
||||
return {minTile, maxTile + osg::Vec2i(1, 1)};
|
||||
}
|
||||
|
||||
TilesPositionsRange makeTilesPositionsRange(const btCollisionShape& shape, const btTransform& transform,
|
||||
|
@ -18,8 +18,8 @@ namespace DetourNavigator
|
||||
|
||||
struct TilesPositionsRange
|
||||
{
|
||||
TilePosition mMin;
|
||||
TilePosition mMax;
|
||||
TilePosition mBegin;
|
||||
TilePosition mEnd;
|
||||
};
|
||||
|
||||
TilesPositionsRange makeTilesPositionsRange(const osg::Vec2f& aabbMin,
|
||||
@ -32,10 +32,10 @@ namespace DetourNavigator
|
||||
const RecastSettings& settings);
|
||||
|
||||
template <class Callback>
|
||||
void getTilesPositions(const TilesPositionsRange& range, Callback&& callback)
|
||||
inline void getTilesPositions(const TilesPositionsRange& range, Callback&& callback)
|
||||
{
|
||||
for (int tileX = range.mMin.x(); tileX <= range.mMax.x(); ++tileX)
|
||||
for (int tileY = range.mMin.y(); tileY <= range.mMax.y(); ++tileY)
|
||||
for (int tileX = range.mBegin.x(); tileX < range.mEnd.x(); ++tileX)
|
||||
for (int tileY = range.mBegin.y(); tileY < range.mEnd.y(); ++tileY)
|
||||
callback(TilePosition {tileX, tileY});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user