mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-19 15:39:49 +00:00
Fix double precision bound issues in std::max/std::clamp
This commit is contained in:
parent
aaea2bc0f6
commit
142b6fdf2f
2 changed files with 6 additions and 3 deletions
|
@ -460,8 +460,10 @@ void LocalMap::requestInteriorMap(const MWWorld::CellStore* cell)
|
|||
yOffset++;
|
||||
mBounds.yMin() = fog->mBounds.mMinY - yOffset * mMapWorldSize;
|
||||
}
|
||||
mBounds.xMax() = std::max(mBounds.xMax(), fog->mBounds.mMaxX);
|
||||
mBounds.yMax() = std::max(mBounds.yMax(), fog->mBounds.mMaxY);
|
||||
if (fog->mBounds.mMaxX > mBounds.xMax())
|
||||
mBounds.xMax() = fog->mBounds.mMaxX;
|
||||
if (fog->mBounds.mMaxY > mBounds.yMax())
|
||||
mBounds.yMax() = fog->mBounds.mMaxY;
|
||||
|
||||
if(xOffset != 0 || yOffset != 0)
|
||||
Log(Debug::Warning) << "Warning: expanding fog by " << xOffset << ", " << yOffset;
|
||||
|
|
|
@ -1109,7 +1109,8 @@ namespace SceneUtil
|
|||
if (transform.mLightSource->getLastAppliedFrame() != frameNum && mPointLightFadeEnd != 0.f)
|
||||
{
|
||||
const float fadeDelta = mPointLightFadeEnd - mPointLightFadeStart;
|
||||
float fade = 1 - std::clamp((viewBound.center().length() - mPointLightFadeStart) / fadeDelta, 0.f, 1.f);
|
||||
const float viewDelta = viewBound.center().length() - mPointLightFadeStart;
|
||||
float fade = 1 - std::clamp(viewDelta / fadeDelta, 0.f, 1.f);
|
||||
if (fade == 0.f)
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in a new issue