2018-04-15 19:54:45 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_GETTILESPOSITIONS_H
|
|
|
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_GETTILESPOSITIONS_H
|
|
|
|
|
2022-02-01 00:21:47 +00:00
|
|
|
#include "tilebounds.hpp"
|
2018-04-20 23:57:01 +00:00
|
|
|
#include "tileposition.hpp"
|
2022-02-18 20:35:09 +00:00
|
|
|
#include "tilespositionsrange.hpp"
|
2018-04-15 19:54:45 +00:00
|
|
|
|
2022-01-25 14:06:53 +00:00
|
|
|
class btVector3;
|
|
|
|
class btTransform;
|
|
|
|
class btCollisionShape;
|
2019-02-28 20:03:42 +00:00
|
|
|
|
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
|
|
|
}
|
2018-04-15 19:54:45 +00:00
|
|
|
|
|
|
|
namespace DetourNavigator
|
|
|
|
{
|
2022-01-25 14:06:53 +00:00
|
|
|
struct RecastSettings;
|
2018-04-15 19:54:45 +00:00
|
|
|
|
2022-01-31 23:22:53 +00:00
|
|
|
TilesPositionsRange makeTilesPositionsRange(
|
|
|
|
const osg::Vec2f& aabbMin, const osg::Vec2f& aabbMax, const RecastSettings& settings);
|
2018-04-15 19:54:45 +00:00
|
|
|
|
2022-01-25 14:06:53 +00:00
|
|
|
TilesPositionsRange makeTilesPositionsRange(
|
2022-01-30 20:43:23 +00:00
|
|
|
const btCollisionShape& shape, const btTransform& transform, const RecastSettings& settings);
|
2018-04-15 19:54:45 +00:00
|
|
|
|
2022-02-01 00:21:47 +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);
|
2018-04-15 19:54:45 +00:00
|
|
|
|
|
|
|
template <class Callback>
|
2022-01-31 23:35:03 +00:00
|
|
|
inline void getTilesPositions(const TilesPositionsRange& range, Callback&& callback)
|
2018-04-15 19:54:45 +00:00
|
|
|
{
|
2022-01-31 23:35:03 +00:00
|
|
|
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
|
|
|
}
|
2022-02-01 00:21:47 +00:00
|
|
|
|
|
|
|
inline bool isInTilesPositionsRange(int begin, int end, int coordinate)
|
|
|
|
{
|
|
|
|
return begin <= coordinate && coordinate < end;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool isInTilesPositionsRange(const TilesPositionsRange& range, const TilePosition& position)
|
|
|
|
{
|
|
|
|
return isInTilesPositionsRange(range.mBegin.x(), range.mEnd.x(), position.x())
|
|
|
|
&& isInTilesPositionsRange(range.mBegin.y(), range.mEnd.y(), position.y());
|
|
|
|
}
|
|
|
|
|
|
|
|
TilesPositionsRange getIntersection(const TilesPositionsRange& a, const TilesPositionsRange& b) noexcept;
|
2024-01-08 21:17:02 +00:00
|
|
|
|
|
|
|
TilesPositionsRange getUnion(const TilesPositionsRange& a, const TilesPositionsRange& b) noexcept;
|
2018-04-15 19:54:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|