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); } } } diff --git a/HSDRawViewer/Rendering/Camera.cs b/HSDRawViewer/Rendering/Camera.cs index 6175bf69..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(fovRadians, 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); } ///