mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 12:35:46 +00:00
639bdd5801
The virtual function does the same thing. * Change return type to osg::Vec2i to avoid dependency on ESM3. * Rename to positionToCellIndex to make it clear what is the index.
22 lines
430 B
C++
22 lines
430 B
C++
#ifndef OPENMW_MWWORLD_CELLUTILS_H
|
|
#define OPENMW_MWWORLD_CELLUTILS_H
|
|
|
|
#include <components/misc/constants.hpp>
|
|
|
|
#include <osg/Vec2i>
|
|
|
|
#include <cmath>
|
|
|
|
namespace MWWorld
|
|
{
|
|
inline osg::Vec2i positionToCellIndex(float x, float y)
|
|
{
|
|
return {
|
|
static_cast<int>(std::floor(x / Constants::CellSizeInUnits)),
|
|
static_cast<int>(std::floor(y / Constants::CellSizeInUnits))
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif
|