Fix issues with camera
This commit is contained in:
@@ -245,7 +245,7 @@ namespace OpenVulkano::Scene
|
||||
return 2.0f * atanf(tanf(m_fov * 0.5f) * m_aspect);
|
||||
}
|
||||
|
||||
void UpdateProjectionMatrix()
|
||||
void UpdateProjectionMatrix() override
|
||||
{
|
||||
m_projection = Math::Utils::perspectiveRH_ZO(m_fov, m_aspect, m_nearPlane, m_farPlane);
|
||||
UpdateViewProjectionMatrix();
|
||||
@@ -255,7 +255,7 @@ namespace OpenVulkano::Scene
|
||||
class OrthographicCamera : public Camera
|
||||
{
|
||||
public:
|
||||
void UpdateProjectionMatrix() final
|
||||
void UpdateProjectionMatrix() override
|
||||
{
|
||||
const float scale = 0.5f * m_contentScaleFactor * m_zoom;
|
||||
const float widthHalf = m_width * scale, heightHalf = m_height * scale;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenVulkano::Scene
|
||||
, m_animationDuration(1.0f)
|
||||
, m_currentTime(0.0f)
|
||||
, m_isMorphing(false)
|
||||
, m_targetMorphStatePerspective(false)
|
||||
, m_targetMorphStatePerspective(true)
|
||||
{
|
||||
auto input = OpenVulkano::Input::InputManager::GetInstance();
|
||||
m_actionMorph = input->GetAction("morph");
|
||||
@@ -52,13 +52,14 @@ namespace OpenVulkano::Scene
|
||||
t = 1.0f;
|
||||
m_isMorphing = false;
|
||||
}
|
||||
float newState = m_targetMorphStatePerspective ? t : (1.0f - t);
|
||||
float newState = m_targetMorphStatePerspective ? (1.0f - t) : t;
|
||||
static_cast<MorphableCamera*>(GetCamera())->SetMorphState(newState);
|
||||
}
|
||||
}
|
||||
|
||||
void MorphableCameraController::SetTargetState(bool toPerspective)
|
||||
{
|
||||
if (toPerspective == m_targetMorphStatePerspective) return;
|
||||
m_targetMorphStatePerspective = toPerspective;
|
||||
m_isMorphing = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user