2022-05-06 20:36:25 +02:00
|
|
|
#ifndef OPENMW_MWWORLD_CELLUTILS_H
|
|
|
|
#define OPENMW_MWWORLD_CELLUTILS_H
|
|
|
|
|
|
|
|
#include <components/misc/constants.hpp>
|
2022-05-23 19:21:44 +02:00
|
|
|
|
|
|
|
#include <osg/Vec2i>
|
2022-05-06 20:36:25 +02:00
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
namespace MWWorld
|
|
|
|
{
|
2022-05-23 19:21:44 +02:00
|
|
|
inline osg::Vec2i positionToCellIndex(float x, float y)
|
2022-05-06 20:36:25 +02:00
|
|
|
{
|
2022-09-22 21:26:05 +03:00
|
|
|
return { static_cast<int>(std::floor(x / Constants::CellSizeInUnits)),
|
|
|
|
static_cast<int>(std::floor(y / Constants::CellSizeInUnits)) };
|
2022-05-06 20:36:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|