From 5080deed02d9f8e78d6093647f481797ea897cfa Mon Sep 17 00:00:00 2001 From: Recrown Date: Sun, 10 Mar 2019 00:46:28 -0600 Subject: [PATCH] Added basic world scale variable. --- RecrownedAthenaeum/View/Camera2D.cs | 1 - RecrownedAthenaeum/View/Camera3D.cs | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/RecrownedAthenaeum/View/Camera2D.cs b/RecrownedAthenaeum/View/Camera2D.cs index 94fa626..227cdee 100644 --- a/RecrownedAthenaeum/View/Camera2D.cs +++ b/RecrownedAthenaeum/View/Camera2D.cs @@ -9,7 +9,6 @@ namespace RecrownedAthenaeum.Camera /// public class Camera2D : Camera3D { - /// /// The 2D position. /// diff --git a/RecrownedAthenaeum/View/Camera3D.cs b/RecrownedAthenaeum/View/Camera3D.cs index 88a740e..6681407 100644 --- a/RecrownedAthenaeum/View/Camera3D.cs +++ b/RecrownedAthenaeum/View/Camera3D.cs @@ -13,6 +13,11 @@ namespace RecrownedAthenaeum.Camera /// public class Camera3D { + /// + /// The zoom of the camera. + /// + public float worldScale = 1f; + /// /// Current position in the world. /// @@ -36,7 +41,7 @@ namespace RecrownedAthenaeum.Camera /// /// The view matrix that describes where the camera looks. /// - public Matrix ViewMatrix { get; private set; } + public Matrix ViewMatrix { get; protected set; } /// /// The projection matrix. @@ -51,7 +56,7 @@ namespace RecrownedAthenaeum.Camera /// /// The basic effect that contains the transformations. /// - public BasicEffect BasicEffect { get; private set; } + public BasicEffect BasicEffect { get; protected set; } /// /// Constructs 3D camera with an orthographic projection matrix with dimensions of graphics devices viewport. All changes to matrices should have apply called after changes. @@ -79,6 +84,7 @@ namespace RecrownedAthenaeum.Camera public virtual void Apply() { ViewMatrix = Matrix.CreateLookAt(position, lookAt, upDirection); + worldMatrix *= Matrix.CreateScale(worldScale); BasicEffect.World = worldMatrix; BasicEffect.View = ViewMatrix;