Add pixel scale factor values for ortho cam

This commit is contained in:
Georg Hagen
2024-11-24 23:32:01 +01:00
parent c1a51a063c
commit cce979037e
2 changed files with 4 additions and 0 deletions

View File

@@ -254,6 +254,8 @@ namespace OpenVulkano::Scene
{ {
const float scale = 0.5f * m_contentScaleFactor * m_zoom; const float scale = 0.5f * m_contentScaleFactor * m_zoom;
const float widthHalf = m_width * scale, heightHalf = m_height * scale; const float widthHalf = m_width * scale, heightHalf = m_height * scale;
m_perPixelScaleFactor = m_height / heightHalf;
m_scaleFactor = scale;
SetProjectionMatrix(Math::Utils::orthoRH_ZO(-widthHalf, widthHalf, -heightHalf, heightHalf, m_nearPlane, m_farPlane)); SetProjectionMatrix(Math::Utils::orthoRH_ZO(-widthHalf, widthHalf, -heightHalf, heightHalf, m_nearPlane, m_farPlane));
} }

View File

@@ -30,6 +30,8 @@ namespace OpenVulkano::Scene
Math::Matrix4f orthoMatrix = Math::Utils::orthoRH_ZO(-widthHalf, widthHalf, -heightHalf, heightHalf, m_nearPlane, m_farPlane); Math::Matrix4f orthoMatrix = Math::Utils::orthoRH_ZO(-widthHalf, widthHalf, -heightHalf, heightHalf, m_nearPlane, m_farPlane);
if (m_morphState == 1) if (m_morphState == 1)
{ {
m_perPixelScaleFactor = m_height / heightHalf;
m_scaleFactor = scale;
SetProjectionMatrix(orthoMatrix); SetProjectionMatrix(orthoMatrix);
} }
else else