mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 12:19:12 +00:00
VideoCommon: Use freelook field of view to change the perspective of the camera
This commit is contained in:
parent
98de22a1e6
commit
3d7d4dfc8a
3 changed files with 39 additions and 6 deletions
|
@ -355,14 +355,17 @@ void VertexShaderManager::SetConstants()
|
|||
switch (xfmem.projection.type)
|
||||
{
|
||||
case GX_PERSPECTIVE:
|
||||
g_fProjectionMatrix[0] = rawProjection[0] * g_ActiveConfig.fAspectRatioHackW;
|
||||
{
|
||||
const Common::Vec2 fov =
|
||||
g_ActiveConfig.bFreeLook ? g_freelook_camera.GetFieldOfView() : Common::Vec2{1, 1};
|
||||
g_fProjectionMatrix[0] = rawProjection[0] * g_ActiveConfig.fAspectRatioHackW * fov.x;
|
||||
g_fProjectionMatrix[1] = 0.0f;
|
||||
g_fProjectionMatrix[2] = rawProjection[1] * g_ActiveConfig.fAspectRatioHackW;
|
||||
g_fProjectionMatrix[2] = rawProjection[1] * g_ActiveConfig.fAspectRatioHackW * fov.x;
|
||||
g_fProjectionMatrix[3] = 0.0f;
|
||||
|
||||
g_fProjectionMatrix[4] = 0.0f;
|
||||
g_fProjectionMatrix[5] = rawProjection[2] * g_ActiveConfig.fAspectRatioHackH;
|
||||
g_fProjectionMatrix[6] = rawProjection[3] * g_ActiveConfig.fAspectRatioHackH;
|
||||
g_fProjectionMatrix[5] = rawProjection[2] * g_ActiveConfig.fAspectRatioHackH * fov.y;
|
||||
g_fProjectionMatrix[6] = rawProjection[3] * g_ActiveConfig.fAspectRatioHackH * fov.y;
|
||||
g_fProjectionMatrix[7] = 0.0f;
|
||||
|
||||
g_fProjectionMatrix[8] = 0.0f;
|
||||
|
@ -377,9 +380,11 @@ void VertexShaderManager::SetConstants()
|
|||
g_fProjectionMatrix[15] = 0.0f;
|
||||
|
||||
g_stats.gproj = g_fProjectionMatrix;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case GX_ORTHOGRAPHIC:
|
||||
{
|
||||
g_fProjectionMatrix[0] = rawProjection[0];
|
||||
g_fProjectionMatrix[1] = 0.0f;
|
||||
g_fProjectionMatrix[2] = 0.0f;
|
||||
|
@ -403,7 +408,8 @@ void VertexShaderManager::SetConstants()
|
|||
|
||||
g_stats.g2proj = g_fProjectionMatrix;
|
||||
g_stats.proj = rawProjection;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ERROR_LOG(VIDEO, "Unknown projection type: %d", xfmem.projection.type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue