VideoCommon: update Free Look camera's 'FieldOfView' function to 'FieldOfViewMultiplier' to better reflect usage

This commit is contained in:
iwubcode 2021-05-08 14:36:44 -05:00
parent aa07fde8a0
commit 514475646d
3 changed files with 17 additions and 12 deletions

View File

@ -206,7 +206,7 @@ private:
}; };
} // namespace } // namespace
Common::Vec2 CameraControllerInput::GetFieldOfView() const Common::Vec2 CameraControllerInput::GetFieldOfViewMultiplier() const
{ {
return Common::Vec2{m_fov_x_multiplier, m_fov_y_multiplier}; 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(); 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) void FreeLookCamera::DoState(PointerWrap& p)

View File

@ -24,7 +24,7 @@ public:
CameraController& operator=(CameraController&&) = delete; CameraController& operator=(CameraController&&) = delete;
virtual Common::Matrix44 GetView() const = 0; virtual Common::Matrix44 GetView() const = 0;
virtual Common::Vec2 GetFieldOfView() const = 0; virtual Common::Vec2 GetFieldOfViewMultiplier() const = 0;
virtual void DoState(PointerWrap& p) = 0; virtual void DoState(PointerWrap& p) = 0;
@ -37,7 +37,7 @@ public:
class CameraControllerInput : public CameraController class CameraControllerInput : public CameraController
{ {
public: public:
Common::Vec2 GetFieldOfView() const final override; Common::Vec2 GetFieldOfViewMultiplier() const final override;
void DoState(PointerWrap& p) override; void DoState(PointerWrap& p) override;
@ -81,7 +81,7 @@ public:
FreeLookCamera(); FreeLookCamera();
void SetControlType(FreeLook::ControlType type); void SetControlType(FreeLook::ControlType type);
Common::Matrix44 GetView() const; Common::Matrix44 GetView() const;
Common::Vec2 GetFieldOfView() const; Common::Vec2 GetFieldOfViewMultiplier() const;
void DoState(PointerWrap& p); void DoState(PointerWrap& p);

View File

@ -366,16 +366,21 @@ void VertexShaderManager::SetConstants()
{ {
case ProjectionType::Perspective: case ProjectionType::Perspective:
{ {
const Common::Vec2 fov = const Common::Vec2 fov_multiplier = g_freelook_camera.IsActive() ?
g_freelook_camera.IsActive() ? g_freelook_camera.GetFieldOfView() : Common::Vec2{1, 1}; g_freelook_camera.GetFieldOfViewMultiplier() :
g_fProjectionMatrix[0] = rawProjection[0] * g_ActiveConfig.fAspectRatioHackW * fov.x; Common::Vec2{1, 1};
g_fProjectionMatrix[0] =
rawProjection[0] * g_ActiveConfig.fAspectRatioHackW * fov_multiplier.x;
g_fProjectionMatrix[1] = 0.0f; 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[3] = 0.0f;
g_fProjectionMatrix[4] = 0.0f; g_fProjectionMatrix[4] = 0.0f;
g_fProjectionMatrix[5] = rawProjection[2] * g_ActiveConfig.fAspectRatioHackH * fov.y; g_fProjectionMatrix[5] =
g_fProjectionMatrix[6] = rawProjection[3] * g_ActiveConfig.fAspectRatioHackH * fov.y; 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[7] = 0.0f;
g_fProjectionMatrix[8] = 0.0f; g_fProjectionMatrix[8] = 0.0f;