1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-30 07:21:12 +00:00

getLand taken out of loop where it's value would always be the same.

This commit is contained in:
florent.teppe 2023-05-18 17:08:42 +02:00
parent feb60f5ad8
commit c2e652b8a0
2 changed files with 7 additions and 6 deletions

View File

@ -337,7 +337,7 @@ namespace ESMTerrain
}
Storage::UniqueTextureId Storage::getVtexIndexAt(
ESM::ExteriorCellLocation cellLocation, int x, int y, LandCache& cache)
ESM::ExteriorCellLocation cellLocation, const LandObject* land, int x, int y, LandCache& cache)
{
// For the first/last row/column, we need to get the texture from the neighbour cell
// to get consistent blending at the borders
@ -362,8 +362,6 @@ namespace ESMTerrain
assert(x < ESM::Land::LAND_TEXTURE_SIZE);
assert(y < ESM::Land::LAND_TEXTURE_SIZE);
const LandObject* land = getLand(cellLocation, cache);
const ESM::LandData* data = land ? land->getData(ESM::Land::DATA_VTEX) : nullptr;
if (data)
{
@ -415,13 +413,15 @@ namespace ESMTerrain
LandCache cache;
std::map<UniqueTextureId, unsigned int> textureIndicesMap;
ESM::ExteriorCellLocation cellLocation(cellX, cellY, worldspace);
const LandObject* land = getLand(cellLocation, cache);
for (int y = 0; y < blendmapSize; y++)
{
for (int x = 0; x < blendmapSize; x++)
{
ESM::ExteriorCellLocation cellLocation(cellX, cellY, worldspace);
UniqueTextureId id = getVtexIndexAt(cellLocation, x + rowStart, y + colStart, cache);
UniqueTextureId id = getVtexIndexAt(cellLocation, land, x + rowStart, y + colStart, cache);
std::map<UniqueTextureId, unsigned int>::iterator found = textureIndicesMap.find(id);
if (found == textureIndicesMap.end())
{

View File

@ -148,7 +148,8 @@ namespace ESMTerrain
// pair <texture id, plugin id>
typedef std::pair<short, short> UniqueTextureId;
inline UniqueTextureId getVtexIndexAt(ESM::ExteriorCellLocation cellLocation, int x, int y, LandCache&);
inline UniqueTextureId getVtexIndexAt(
ESM::ExteriorCellLocation cellLocation, const LandObject* land, int x, int y, LandCache&);
std::string getTextureName(UniqueTextureId id);
std::map<std::string, Terrain::LayerInfo> mLayerInfoMap;