From 4c4150620456c6625cf660d7a81571e4b1f7f9d5 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 5 Aug 2020 23:58:18 -0700 Subject: [PATCH] camera tweak + fix capitalization --- Camera.cs | 33 ++++++--------------------------- kav.csproj => Kav.csproj | 0 kav.sln => Kav.sln | 2 +- 3 files changed, 7 insertions(+), 28 deletions(-) rename kav.csproj => Kav.csproj (100%) rename kav.sln => Kav.sln (94%) diff --git a/Camera.cs b/Camera.cs index 64a82d2..c0729ee 100644 --- a/Camera.cs +++ b/Camera.cs @@ -2,43 +2,22 @@ using Microsoft.Xna.Framework; namespace Kav { - public class Camera + public struct Camera { - public Matrix Transform { get; set; } - public Matrix Projection { get; set; } + public Matrix Transform { get; } public Matrix View { get { - return Matrix.CreateLookAt(Transform.Translation, Transform.Forward, Transform.Up); + return Matrix.CreateLookAt(Transform.Translation, Transform.Translation + Transform.Forward, Transform.Up); } } + public Matrix Projection { get; } - public float FOV { get; set; } = MathHelper.PiOver4; - public float AspectRatio { get; set; } = 1920f / 1080f; - public float NearPlane { get; set; } = 0.1f; - public float FarPlane { get; set; } = 200f; - - public Camera(Vector3 position, Quaternion orientation) - { - Transform = Matrix.CreateFromQuaternion(orientation) * Matrix.CreateTranslation(position.X, position.Y, position.Z); - Projection = Matrix.CreatePerspectiveFieldOfView( - FOV, - AspectRatio, - NearPlane, - FarPlane - ); - } - - public Camera(Matrix transform) + public Camera(Matrix transform, Matrix projection) { Transform = transform; - Projection = Matrix.CreatePerspectiveFieldOfView( - FOV, - AspectRatio, - NearPlane, - FarPlane - ); + Projection = projection; } } } diff --git a/kav.csproj b/Kav.csproj similarity index 100% rename from kav.csproj rename to Kav.csproj diff --git a/kav.sln b/Kav.sln similarity index 94% rename from kav.sln rename to Kav.sln index ab8a5f8..68e4249 100644 --- a/kav.sln +++ b/Kav.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26124.0 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "kav", "kav.csproj", "{34C1B784-AE9C-4EBC-A03A-AC401CB1219A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kav", "Kav.csproj", "{34C1B784-AE9C-4EBC-A03A-AC401CB1219A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution