diff options
| author | JMC47 <JMC4789@gmail.com> | 2021-10-09 12:18:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-09 12:18:41 -0400 |
| commit | 1beaa07793028da7225e979b2baf2e22df011573 (patch) | |
| tree | 0b3a39ed7c3569e2ea5ef877c10189c1c278be04 /Source/Core/VideoCommon/VertexShaderManager.cpp | |
| parent | ff1cb5a1c08d5a4a2a0449b8b23a4977ccc20f8a (diff) | |
| parent | 514475646df7c4c7aa3f8f394bced2a28a22b788 (diff) | |
Merge pull request #9670 from iwubcode/freelook-input-controller
Core / VideoCommon: refactor FreeLookCamera
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexShaderManager.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 88c6806326..1b0bf55de7 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -356,7 +356,7 @@ void VertexShaderManager::SetConstants() } } - if (bProjectionChanged || g_freelook_camera.IsDirty()) + if (bProjectionChanged || g_freelook_camera.GetController()->IsDirty()) { bProjectionChanged = false; @@ -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; @@ -435,7 +440,7 @@ void VertexShaderManager::SetConstants() memcpy(constants.projection.data(), corrected_matrix.data.data(), 4 * sizeof(float4)); - g_freelook_camera.SetClean(); + g_freelook_camera.GetController()->SetClean(); dirty = true; } |
