|
|
|
@ -34,7 +34,7 @@ namespace MWRender
|
|
|
|
|
return land != nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TerrainStorage::getBounds(float& minX, float& maxX, float& minY, float& maxY)
|
|
|
|
|
void TerrainStorage::getBounds(float& minX, float& maxX, float& minY, float& maxY, ESM::RefId worldspace)
|
|
|
|
|
{
|
|
|
|
|
minX = 0;
|
|
|
|
|
minY = 0;
|
|
|
|
@ -43,6 +43,28 @@ namespace MWRender
|
|
|
|
|
|
|
|
|
|
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
|
|
|
|
|
|
|
|
|
|
if (ESM::isEsm4Ext(worldspace))
|
|
|
|
|
{
|
|
|
|
|
const auto& lands = esmStore.get<ESM4::Land>().getLands();
|
|
|
|
|
for (const auto& it : lands)
|
|
|
|
|
{
|
|
|
|
|
if (it.first.mWorldspace == worldspace)
|
|
|
|
|
{
|
|
|
|
|
int x = it.first.mX;
|
|
|
|
|
int y = it.first.mY;
|
|
|
|
|
if (x < minX)
|
|
|
|
|
minX = static_cast<float>(x);
|
|
|
|
|
if (x > maxX)
|
|
|
|
|
maxX = static_cast<float>(x);
|
|
|
|
|
if (y < minY)
|
|
|
|
|
minY = static_cast<float>(y);
|
|
|
|
|
if (y > maxY)
|
|
|
|
|
maxY = static_cast<float>(y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MWWorld::Store<ESM::Land>::iterator it = esmStore.get<ESM::Land>().begin();
|
|
|
|
|
for (; it != esmStore.get<ESM::Land>().end(); ++it)
|
|
|
|
|
{
|
|
|
|
@ -55,7 +77,7 @@ namespace MWRender
|
|
|
|
|
if (it->mY > maxY)
|
|
|
|
|
maxY = static_cast<float>(it->mY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// since grid coords are at cell origin, we need to add 1 cell
|
|
|
|
|
maxX += 1;
|
|
|
|
|
maxY += 1;
|
|
|
|
|