Extend ortho camera

This commit is contained in:
2024-06-28 09:34:50 +02:00
parent ebd12cfd2b
commit 475c72e505
4 changed files with 23 additions and 9 deletions

View File

@@ -25,15 +25,15 @@ namespace OpenVulkano::Scene
PerspectiveCamera::UpdateProjectionMatrix();
if (m_morphState != 0)
{
float aspectH = m_aspect;
float aspectV = 1;
const float scale = 0.5f * m_contentScaleFactor * m_zoom;
const float widthHalf = m_width * scale, heightHalf = m_height * scale;
m_orthoMatrix = Math::Utils::orthoRH_ZO(-widthHalf, widthHalf, -heightHalf, heightHalf, m_nearPlane, m_farPlane);
if (m_morphState == 1)
{
m_projection = Math::Utils::orthoRH_ZO(-aspectH, aspectH, -aspectV, aspectV, m_nearPlane, m_farPlane);
m_projection = m_orthoMatrix;
}
else
{
m_orthoMatrix = Math::Utils::orthoRH_ZO(-aspectH, aspectH, -aspectV, aspectV, m_nearPlane, m_farPlane);
m_projection = BlendMatrices(m_projection, m_orthoMatrix, m_morphState);
}
UpdateViewProjectionMatrix();