Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/rendering/StarWorldCamera.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-04-15 17:46:44 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-04-15 17:46:44 +1000
commit63c9e3ec8b51a9d96872a054a0d35e8591b3535d (patch)
tree7d5cfaea0e13eb34cc6db25df6054cae1a04677c /source/rendering/StarWorldCamera.cpp
parent2a4bd826052102a0bb8858355e42b9cba06f2991 (diff)
only round vertices if AA is on
[skip ci]
Diffstat (limited to 'source/rendering/StarWorldCamera.cpp')
-rw-r--r--source/rendering/StarWorldCamera.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/rendering/StarWorldCamera.cpp b/source/rendering/StarWorldCamera.cpp
index c0bc645..de23f3e 100644
--- a/source/rendering/StarWorldCamera.cpp
+++ b/source/rendering/StarWorldCamera.cpp
@@ -26,15 +26,17 @@ void WorldCamera::setCenterWorldPosition(Vec2F const& position, bool force) {
// elements drawn in world space that are aligned with TilePixels will
// eventually also be aligned to real screen pixels.
+ float ratio = TilePixels * m_pixelRatio;
+
if (m_screenSize[0] % 2 == 0)
- m_worldCenter[0] = round(m_worldCenter[0] * (TilePixels * m_pixelRatio)) / (TilePixels * m_pixelRatio);
+ m_worldCenter[0] = round(m_worldCenter[0] * ratio) / ratio;
else
- m_worldCenter[0] = (round(m_worldCenter[0] * (TilePixels * m_pixelRatio) + 0.5f) - 0.5f) / (TilePixels * m_pixelRatio);
+ m_worldCenter[0] = (round(m_worldCenter[0] * ratio + 0.5f) - 0.5f) / ratio;
if (m_screenSize[1] % 2 == 0)
- m_worldCenter[1] = round(m_worldCenter[1] * (TilePixels * m_pixelRatio)) / (TilePixels * m_pixelRatio);
+ m_worldCenter[1] = round(m_worldCenter[1] * ratio) / ratio;
else
- m_worldCenter[1] = (round(m_worldCenter[1] * (TilePixels * m_pixelRatio) + 0.5f) - 0.5f) / (TilePixels * m_pixelRatio);
+ m_worldCenter[1] = (round(m_worldCenter[1] * ratio + 0.5f) - 0.5f) / ratio;
}
}