From ecd47419a27db4e809d1ee4b4af007f42f02275e Mon Sep 17 00:00:00 2001 From: Muzzarino Date: Tue, 5 Jan 2021 03:13:05 -0800 Subject: [PATCH 1/3] Camera property corrections --- HSDRaw/Common/HSD_COBJ.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HSDRaw/Common/HSD_COBJ.cs b/HSDRaw/Common/HSD_COBJ.cs index 7d3e8759..5d383ebf 100644 --- a/HSDRaw/Common/HSD_COBJ.cs +++ b/HSDRaw/Common/HSD_COBJ.cs @@ -22,8 +22,8 @@ public class HSD_Camera : HSDAccessor public int Unknown3 { get => _s.GetInt32(0x24); set => _s.SetInt32(0x24, value); } public float NearClip { get => _s.GetFloat(0x28); set => _s.SetFloat(0x28, value); } public float FarClip { get => _s.GetFloat(0x2C); set => _s.SetFloat(0x2C, value); } - public HSD_Camera SelfReference { get => _s.GetReference(0x30); set => _s.SetReference(0x30, value); } - public float FieldOfView { get => _s.GetFloat(0x34); set => _s.SetFloat(0x34, value); } + public float FieldOfView { get => _s.GetFloat(0x30); set => _s.SetFloat(0x30, value); } + public float AspectRatio { get => _s.GetFloat(0x34); set => _s.SetFloat(0x34, value); } } } From 09feacbffb5f3d066f31ef582539bbc82572d5f5 Mon Sep 17 00:00:00 2001 From: Muzzarino Date: Tue, 5 Jan 2021 03:17:10 -0800 Subject: [PATCH 2/3] Update Camera.cs --- HSDRawViewer/Rendering/Camera.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HSDRawViewer/Rendering/Camera.cs b/HSDRawViewer/Rendering/Camera.cs index 6175bf69..8eea6181 100644 --- a/HSDRawViewer/Rendering/Camera.cs +++ b/HSDRawViewer/Rendering/Camera.cs @@ -409,7 +409,7 @@ protected virtual void UpdateRotationMatrix() /// protected virtual void UpdatePerspectiveMatrix() { - perspectiveMatrix = Matrix4.CreatePerspectiveFieldOfView(fovRadians, RenderWidth / (float)RenderHeight, nearClipPlane, farClipPlane); + perspectiveMatrix = Matrix4.CreatePerspectiveFieldOfView((float)(2 * Math.Atan(Math.Tan(fovRadians / 2) / Math.Max(AspectRatio,1))), RenderWidth / (float)RenderHeight, nearClipPlane, farClipPlane); } /// From 61c1b7087b4beaaf1d56f6a1e4e4f77709d0cee4 Mon Sep 17 00:00:00 2001 From: Muzzarino Date: Tue, 5 Jan 2021 03:19:53 -0800 Subject: [PATCH 3/3] Update Camera.cs --- HSDRawViewer/Rendering/Camera.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HSDRawViewer/Rendering/Camera.cs b/HSDRawViewer/Rendering/Camera.cs index 8eea6181..fa76b67a 100644 --- a/HSDRawViewer/Rendering/Camera.cs +++ b/HSDRawViewer/Rendering/Camera.cs @@ -409,7 +409,7 @@ protected virtual void UpdateRotationMatrix() /// protected virtual void UpdatePerspectiveMatrix() { - perspectiveMatrix = Matrix4.CreatePerspectiveFieldOfView((float)(2 * Math.Atan(Math.Tan(fovRadians / 2) / Math.Max(AspectRatio,1))), RenderWidth / (float)RenderHeight, nearClipPlane, farClipPlane); + perspectiveMatrix = Matrix4.CreatePerspectiveFieldOfView((float)(2 * Math.Atan(Math.Tan(fovRadians / 2) / Math.Min(AspectRatio,1))), RenderWidth / (float)RenderHeight, nearClipPlane, farClipPlane); } ///