mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-22 14:11:35 +00:00
Allow to represent empty range with TilesPositionsRange
This commit is contained in:
parent
1b2954f2db
commit
a5b078e9a7
2 changed files with 6 additions and 6 deletions
|
@ -29,7 +29,7 @@ namespace DetourNavigator
|
||||||
if (minTile.y() > maxTile.y())
|
if (minTile.y() > maxTile.y())
|
||||||
std::swap(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,
|
TilesPositionsRange makeTilesPositionsRange(const btCollisionShape& shape, const btTransform& transform,
|
||||||
|
|
|
@ -18,8 +18,8 @@ namespace DetourNavigator
|
||||||
|
|
||||||
struct TilesPositionsRange
|
struct TilesPositionsRange
|
||||||
{
|
{
|
||||||
TilePosition mMin;
|
TilePosition mBegin;
|
||||||
TilePosition mMax;
|
TilePosition mEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
TilesPositionsRange makeTilesPositionsRange(const osg::Vec2f& aabbMin,
|
TilesPositionsRange makeTilesPositionsRange(const osg::Vec2f& aabbMin,
|
||||||
|
@ -32,10 +32,10 @@ namespace DetourNavigator
|
||||||
const RecastSettings& settings);
|
const RecastSettings& settings);
|
||||||
|
|
||||||
template <class Callback>
|
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 tileX = range.mBegin.x(); tileX < range.mEnd.x(); ++tileX)
|
||||||
for (int tileY = range.mMin.y(); tileY <= range.mMax.y(); ++tileY)
|
for (int tileY = range.mBegin.y(); tileY < range.mEnd.y(); ++tileY)
|
||||||
callback(TilePosition {tileX, tileY});
|
callback(TilePosition {tileX, tileY});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue