1
0
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:
elsid 2022-02-01 00:35:03 +01:00
parent 1b2954f2db
commit a5b078e9a7
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40
2 changed files with 6 additions and 6 deletions

View File

@ -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,

View File

@ -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});
}
}