From 85188e859f18f46b0e4ac49e89f862b6b75f1418 Mon Sep 17 00:00:00 2001 From: Recrown Date: Wed, 6 Feb 2019 15:40:54 -0600 Subject: [PATCH] Center(); function of 3D camera now also sets Z position to 0. Changed order of multiplication for matrices. --- ConsoleApp1/ConsoleApp1.csproj | 12 ++++++++++++ ConsoleApp1/Program.cs | 13 +++++++++++++ RecrownedAthenaeum/Camera/Camera3D.cs | 4 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 ConsoleApp1/ConsoleApp1.csproj create mode 100644 ConsoleApp1/Program.cs diff --git a/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..30aa762 --- /dev/null +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp2.1 + + + + + + + diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs new file mode 100644 index 0000000..a5e2198 --- /dev/null +++ b/ConsoleApp1/Program.cs @@ -0,0 +1,13 @@ +using RecrownedAthenaeum.Camera; +using System; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { + Camera2D camera = new Camera2D(); + } + } +} diff --git a/RecrownedAthenaeum/Camera/Camera3D.cs b/RecrownedAthenaeum/Camera/Camera3D.cs index 143b5c1..4a3f615 100644 --- a/RecrownedAthenaeum/Camera/Camera3D.cs +++ b/RecrownedAthenaeum/Camera/Camera3D.cs @@ -61,7 +61,6 @@ namespace RecrownedAthenaeum.Camera { this.graphicsDevice = graphicsDevice ?? (Configuration.GraphicsDeviceManager.GraphicsDevice); - position.Z = 0; worldMatrix = Matrix.Identity; lookAt = Vector3.Forward; upDirection = Vector3.Up; @@ -76,7 +75,7 @@ namespace RecrownedAthenaeum.Camera public virtual void Apply() { ViewMatrix = Matrix.CreateLookAt(position, lookAt, upDirection); - TransformationMatrix = worldMatrix * ViewMatrix * projectionMatrix; + TransformationMatrix = projectionMatrix * ViewMatrix * worldMatrix; } /// @@ -84,6 +83,7 @@ namespace RecrownedAthenaeum.Camera /// public void Center() { + position.Z = 0; position.X = this.graphicsDevice.Viewport.Width * 0.5f; position.Y = this.graphicsDevice.Viewport.Height * 0.5f; }