mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 18:09:39 +00:00
Do not update map texture if it did not change
This commit is contained in:
parent
231e629e66
commit
1143985bc7
1 changed files with 14 additions and 5 deletions
|
@ -613,7 +613,8 @@ void LocalMap::updatePlayer (const osg::Vec3f& position, const osg::Quat& orient
|
||||||
if (!segment.mFogOfWarImage || !segment.mMapTexture)
|
if (!segment.mFogOfWarImage || !segment.mMapTexture)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
unsigned char* data = segment.mFogOfWarImage->data();
|
uint32_t* data = (uint32_t*)segment.mFogOfWarImage->data();
|
||||||
|
bool changed = false;
|
||||||
for (int texV = 0; texV<sFogOfWarResolution; ++texV)
|
for (int texV = 0; texV<sFogOfWarResolution; ++texV)
|
||||||
{
|
{
|
||||||
for (int texU = 0; texU<sFogOfWarResolution; ++texU)
|
for (int texU = 0; texU<sFogOfWarResolution; ++texU)
|
||||||
|
@ -625,14 +626,22 @@ void LocalMap::updatePlayer (const osg::Vec3f& position, const osg::Quat& orient
|
||||||
uint8_t alpha = (clr >> 24);
|
uint8_t alpha = (clr >> 24);
|
||||||
|
|
||||||
alpha = std::min( alpha, (uint8_t) (std::max(0.f, std::min(1.f, (sqrDist/sqrExploreRadius)))*255) );
|
alpha = std::min( alpha, (uint8_t) (std::max(0.f, std::min(1.f, (sqrDist/sqrExploreRadius)))*255) );
|
||||||
*(uint32_t*)data = (uint32_t) (alpha << 24);
|
uint32_t val = (uint32_t) (alpha << 24);
|
||||||
|
if ( *data != val)
|
||||||
|
{
|
||||||
|
*data = val;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
data += 4;
|
++data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
segment.mHasFogState = true;
|
if (changed)
|
||||||
segment.mFogOfWarImage->dirty();
|
{
|
||||||
|
segment.mHasFogState = true;
|
||||||
|
segment.mFogOfWarImage->dirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue