Fixed a graphical glitch caused by inaccurate rounding.

This commit is contained in:
Leon Styhre 2021-01-19 21:50:14 +01:00
parent 96c742dee4
commit e4f440ca9a
5 changed files with 19 additions and 12 deletions

View file

@ -117,6 +117,7 @@ Many bugs have been fixed, and numerous features that were only partially implem
* Deleting a game from the metadata editor did not delete the game media files or its entry in the gamelist.xml file
* Hidden files still showed up if they had a gamelist.xml entry
* Fixed multiple instances of misaligned GUI elements on high-resolution displays due to the use of fixed-pixel constants
* Fixed a rounding issue which caused one pixel wide lines to sometimes be shown along the upper and left screen edges
* The VRAM statistics overlay was somewhat broken and incorrectly displayed numbers in megabytes instead of mebibytes
* Long game names would sometimes not scroll in the gamelist view
* Game media was not rendered when moving between gamelists using the slide transition style

View file

@ -315,9 +315,9 @@ Transform4x4f& Transform4x4f::round()
{
float* tm = reinterpret_cast<float*>(this);
tm[12] = static_cast<float>(static_cast<int>(tm[12] + 0.5f));
tm[13] = static_cast<float>(static_cast<int>(tm[13] + 0.5f));
tm[14] = static_cast<float>(static_cast<int>(tm[14] + 0.5f));
tm[12] = std::round(tm[12]);
tm[13] = std::round(tm[13]);
tm[14] = std::round(tm[14]);
return *this;
}

View file

@ -8,10 +8,12 @@
#include "math/Vector2f.h"
#include <cmath>
Vector2f& Vector2f::round()
{
mX = static_cast<float>(static_cast<int>(mX + 0.5f));
mY = static_cast<float>(static_cast<int>(mY + 0.5f));
mX = std::round(mX);
mY = std::round(mY);
return *this;
}

View file

@ -8,11 +8,13 @@
#include "math/Vector3f.h"
#include <cmath>
Vector3f& Vector3f::round()
{
mX = static_cast<float>(static_cast<int>(mX + 0.5f));
mY = static_cast<float>(static_cast<int>(mY + 0.5f));
mZ = static_cast<float>(static_cast<int>(mZ + 0.5f));
mX = std::round(mX);
mY = std::round(mY);
mZ = std::round(mZ);
return *this;
}

View file

@ -8,12 +8,14 @@
#include "math/Vector4f.h"
#include <cmath>
Vector4f& Vector4f::round()
{
mX = static_cast<float>(static_cast<int>(mX + 0.5f));
mY = static_cast<float>(static_cast<int>(mY + 0.5f));
mZ = static_cast<float>(static_cast<int>(mZ + 0.5f));
mW = static_cast<float>(static_cast<int>(mW + 0.5f));
mX = std::round(mX);
mY = std::round(mY);
mZ = std::round(mZ);
mW = std::round(mW);
return *this;
}