2023-05-09 22:20:05 +00:00
|
|
|
#include "util.hpp"
|
2024-05-02 01:09:13 +00:00
|
|
|
|
2023-05-18 09:56:45 +00:00
|
|
|
#include <components/esm3/loadland.hpp>
|
|
|
|
#include <components/esm4/loadland.hpp>
|
2023-05-09 22:20:05 +00:00
|
|
|
|
2024-05-02 01:09:13 +00:00
|
|
|
osg::Vec2f ESM::indexToPosition(const ESM::ExteriorCellLocation& cellIndex, bool centre)
|
2023-05-09 22:20:05 +00:00
|
|
|
{
|
2023-05-12 10:04:04 +00:00
|
|
|
const int cellSize = ESM::getCellSize(cellIndex.mWorldspace);
|
2023-05-09 22:20:05 +00:00
|
|
|
|
|
|
|
float x = static_cast<float>(cellSize * cellIndex.mX);
|
|
|
|
float y = static_cast<float>(cellSize * cellIndex.mY);
|
|
|
|
|
|
|
|
if (centre)
|
|
|
|
{
|
|
|
|
x += cellSize / 2;
|
|
|
|
y += cellSize / 2;
|
|
|
|
}
|
2024-05-02 01:09:13 +00:00
|
|
|
|
|
|
|
return osg::Vec2f(x, y);
|
2023-05-09 22:20:05 +00:00
|
|
|
}
|
2023-05-18 09:56:45 +00:00
|
|
|
|
|
|
|
int ESM::getLandSize(ESM::RefId worldspaceId)
|
|
|
|
{
|
2023-08-12 11:59:39 +00:00
|
|
|
return isEsm4Ext(worldspaceId) ? ESM4::Land::sVertsPerSide : ESM::Land::LAND_SIZE;
|
2023-05-18 09:56:45 +00:00
|
|
|
}
|