From 514475646df7c4c7aa3f8f394bced2a28a22b788 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sat, 8 May 2021 14:36:44 -0500 Subject: [PATCH] VideoCommon: update Free Look camera's 'FieldOfView' function to 'FieldOfViewMultiplier' to better reflect usage --- Source/Core/VideoCommon/FreeLookCamera.cpp | 6 +++--- Source/Core/VideoCommon/FreeLookCamera.h | 6 +++--- Source/Core/VideoCommon/VertexShaderManager.cpp | 17 +++++++++++------ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Source/Core/VideoCommon/FreeLookCamera.cpp b/Source/Core/VideoCommon/FreeLookCamera.cpp index a2566ffbd5..55d86d9d27 100644 --- a/Source/Core/VideoCommon/FreeLookCamera.cpp +++ b/Source/Core/VideoCommon/FreeLookCamera.cpp @@ -206,7 +206,7 @@ private: }; } // namespace -Common::Vec2 CameraControllerInput::GetFieldOfView() const +Common::Vec2 CameraControllerInput::GetFieldOfViewMultiplier() const { return Common::Vec2{m_fov_x_multiplier, m_fov_y_multiplier}; } @@ -291,9 +291,9 @@ Common::Matrix44 FreeLookCamera::GetView() const return m_camera_controller->GetView(); } -Common::Vec2 FreeLookCamera::GetFieldOfView() const +Common::Vec2 FreeLookCamera::GetFieldOfViewMultiplier() const { - return m_camera_controller->GetFieldOfView(); + return m_camera_controller->GetFieldOfViewMultiplier(); } void FreeLookCamera::DoState(PointerWrap& p) diff --git a/Source/Core/VideoCommon/FreeLookCamera.h b/Source/Core/VideoCommon/FreeLookCamera.h index 07353dc609..fa62742bd2 100644 --- a/Source/Core/VideoCommon/FreeLookCamera.h +++ b/Source/Core/VideoCommon/FreeLookCamera.h @@ -24,7 +24,7 @@ public: CameraController& operator=(CameraController&&) = delete; virtual Common::Matrix44 GetView() const = 0; - virtual Common::Vec2 GetFieldOfView() const = 0; + virtual Common::Vec2 GetFieldOfViewMultiplier() const = 0; virtual void DoState(PointerWrap& p) = 0; @@ -37,7 +37,7 @@ public: class CameraControllerInput : public CameraController { public: - Common::Vec2 GetFieldOfView() const final override; + Common::Vec2 GetFieldOfViewMultiplier() const final override; void DoState(PointerWrap& p) override; @@ -81,7 +81,7 @@ public: FreeLookCamera(); void SetControlType(FreeLook::ControlType type); Common::Matrix44 GetView() const; - Common::Vec2 GetFieldOfView() const; + Common::Vec2 GetFieldOfViewMultiplier() const; void DoState(PointerWrap& p); diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 15e7b8c853..1b0bf55de7 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -366,16 +366,21 @@ void VertexShaderManager::SetConstants() { case ProjectionType::Perspective: { - const Common::Vec2 fov = - g_freelook_camera.IsActive() ? g_freelook_camera.GetFieldOfView() : Common::Vec2{1, 1}; - g_fProjectionMatrix[0] = rawProjection[0] * g_ActiveConfig.fAspectRatioHackW * fov.x; + const Common::Vec2 fov_multiplier = g_freelook_camera.IsActive() ? + g_freelook_camera.GetFieldOfViewMultiplier() : + Common::Vec2{1, 1}; + g_fProjectionMatrix[0] = + rawProjection[0] * g_ActiveConfig.fAspectRatioHackW * fov_multiplier.x; g_fProjectionMatrix[1] = 0.0f; - g_fProjectionMatrix[2] = rawProjection[1] * g_ActiveConfig.fAspectRatioHackW * fov.x; + g_fProjectionMatrix[2] = + rawProjection[1] * g_ActiveConfig.fAspectRatioHackW * fov_multiplier.x; g_fProjectionMatrix[3] = 0.0f; g_fProjectionMatrix[4] = 0.0f; - g_fProjectionMatrix[5] = rawProjection[2] * g_ActiveConfig.fAspectRatioHackH * fov.y; - g_fProjectionMatrix[6] = rawProjection[3] * g_ActiveConfig.fAspectRatioHackH * fov.y; + g_fProjectionMatrix[5] = + rawProjection[2] * g_ActiveConfig.fAspectRatioHackH * fov_multiplier.y; + g_fProjectionMatrix[6] = + rawProjection[3] * g_ActiveConfig.fAspectRatioHackH * fov_multiplier.y; g_fProjectionMatrix[7] = 0.0f; g_fProjectionMatrix[8] = 0.0f;