1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00
OpenMW/components/detournavigator/gettilespositions.hpp

44 lines
1.2 KiB
C++
Raw Normal View History

#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_GETTILESPOSITIONS_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_GETTILESPOSITIONS_H
#include "tileposition.hpp"
2022-01-25 14:06:53 +00:00
class btVector3;
class btTransform;
class btCollisionShape;
2022-01-25 14:06:53 +00:00
namespace osg
{
2022-01-31 23:22:53 +00:00
class Vec2f;
2022-01-25 14:06:53 +00:00
}
namespace DetourNavigator
{
2022-01-25 14:06:53 +00:00
struct RecastSettings;
2022-01-25 14:06:53 +00:00
struct TilesPositionsRange
{
TilePosition mBegin;
TilePosition mEnd;
2022-01-25 14:06:53 +00:00
};
2022-01-31 23:22:53 +00:00
TilesPositionsRange makeTilesPositionsRange(const osg::Vec2f& aabbMin,
const osg::Vec2f& aabbMax, const RecastSettings& settings);
2022-01-25 14:06:53 +00:00
TilesPositionsRange makeTilesPositionsRange(const btCollisionShape& shape,
const btTransform& transform, const RecastSettings& settings);
2022-01-25 14:06:53 +00:00
TilesPositionsRange makeTilesPositionsRange(const int cellSize, const btVector3& shift,
const RecastSettings& settings);
template <class Callback>
inline void getTilesPositions(const TilesPositionsRange& range, Callback&& callback)
{
for (int tileX = range.mBegin.x(); tileX < range.mEnd.x(); ++tileX)
for (int tileY = range.mBegin.y(); tileY < range.mEnd.y(); ++tileY)
2022-01-25 14:06:53 +00:00
callback(TilePosition {tileX, tileY});
2018-07-20 19:11:34 +00:00
}
}
#endif