From 63c9e3ec8b51a9d96872a054a0d35e8591b3535d Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:46:44 +1000 Subject: only round vertices if AA is on [skip ci] --- source/rendering/StarWorldCamera.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/rendering/StarWorldCamera.cpp') 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; } } -- cgit v1.2.3