Update camera projection matrix handling
This commit is contained in:
@@ -22,21 +22,21 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
void MorphableCamera::UpdateProjectionMatrix()
|
||||
{
|
||||
PerspectiveCamera::UpdateProjectionMatrix();
|
||||
if (m_morphState == 0) PerspectiveCamera::UpdateProjectionMatrix();
|
||||
if (m_morphState != 0)
|
||||
{
|
||||
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);
|
||||
Math::Matrix4f orthoMatrix = Math::Utils::orthoRH_ZO(-widthHalf, widthHalf, -heightHalf, heightHalf, m_nearPlane, m_farPlane);
|
||||
if (m_morphState == 1)
|
||||
{
|
||||
m_projection = m_orthoMatrix;
|
||||
SetProjectionMatrix(orthoMatrix);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_projection = BlendMatrices(m_projection, m_orthoMatrix, m_morphState);
|
||||
Math::Matrix4f projection = Math::Utils::perspectiveRH_ZO(m_fov, m_aspect, m_nearPlane, m_farPlane);
|
||||
SetProjectionMatrix(BlendMatrices(projection, orthoMatrix, m_morphState));
|
||||
}
|
||||
UpdateViewProjectionMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user