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

45 lines
1.2 KiB
C++
Raw Normal View History

#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_GETTILESPOSITIONS_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_GETTILESPOSITIONS_H
2022-01-25 14:06:53 +00:00
#include "tilebounds.hpp"
#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
{
class Vec3f;
}
namespace DetourNavigator
{
2022-01-25 14:06:53 +00:00
struct RecastSettings;
2022-01-25 14:06:53 +00:00
struct TilesPositionsRange
{
TilePosition mMin;
TilePosition mMax;
};
2022-01-25 14:06:53 +00:00
TilesPositionsRange makeTilesPositionsRange(const osg::Vec3f& aabbMin,
const osg::Vec3f& aabbMax, const RecastSettings& settings);
2022-01-25 14:06:53 +00:00
TilesPositionsRange makeTilesPositionsRange(const btCollisionShape& shape,
const btTransform& transform, const TileBounds& bounds, 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>
2022-01-25 14:06:53 +00:00
void getTilesPositions(const TilesPositionsRange& range, Callback&& callback)
{
2022-01-25 14:06:53 +00:00
for (int tileX = range.mMin.x(); tileX <= range.mMax.x(); ++tileX)
for (int tileY = range.mMin.y(); tileY <= range.mMax.y(); ++tileY)
callback(TilePosition {tileX, tileY});
2018-07-20 19:11:34 +00:00
}
}
#endif