Added basic world scale variable.

This commit is contained in:
Harrison Deng 2019-03-10 00:46:28 -06:00
parent c59252dbbf
commit 5080deed02
2 changed files with 8 additions and 3 deletions

View File

@ -9,7 +9,6 @@ namespace RecrownedAthenaeum.Camera
/// </summary> /// </summary>
public class Camera2D : Camera3D public class Camera2D : Camera3D
{ {
/// <summary> /// <summary>
/// The 2D position. /// The 2D position.
/// </summary> /// </summary>

View File

@ -13,6 +13,11 @@ namespace RecrownedAthenaeum.Camera
/// </summary> /// </summary>
public class Camera3D public class Camera3D
{ {
/// <summary>
/// The zoom of the camera.
/// </summary>
public float worldScale = 1f;
/// <summary> /// <summary>
/// Current position in the world. /// Current position in the world.
/// </summary> /// </summary>
@ -36,7 +41,7 @@ namespace RecrownedAthenaeum.Camera
/// <summary> /// <summary>
/// The view matrix that describes where the camera looks. /// The view matrix that describes where the camera looks.
/// </summary> /// </summary>
public Matrix ViewMatrix { get; private set; } public Matrix ViewMatrix { get; protected set; }
/// <summary> /// <summary>
/// The projection matrix. /// The projection matrix.
@ -51,7 +56,7 @@ namespace RecrownedAthenaeum.Camera
/// <summary> /// <summary>
/// The basic effect that contains the transformations. /// The basic effect that contains the transformations.
/// </summary> /// </summary>
public BasicEffect BasicEffect { get; private set; } public BasicEffect BasicEffect { get; protected set; }
/// <summary> /// <summary>
/// Constructs 3D camera with an orthographic projection matrix with dimensions of graphics devices viewport. All changes to matrices should have apply called after changes. /// 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() public virtual void Apply()
{ {
ViewMatrix = Matrix.CreateLookAt(position, lookAt, upDirection); ViewMatrix = Matrix.CreateLookAt(position, lookAt, upDirection);
worldMatrix *= Matrix.CreateScale(worldScale);
BasicEffect.World = worldMatrix; BasicEffect.World = worldMatrix;
BasicEffect.View = ViewMatrix; BasicEffect.View = ViewMatrix;