Advertisement
Azeranth

Camera

Nov 13th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1.     public class Camera : Actor
  2.     {
  3.         private float fieldOfView = MathHelper.ToRadians(60);
  4.         private float aspectRatio = 1;
  5.         private float nearPlane = 1;
  6.         private float farPlane = 1000;
  7.  
  8.         public Matrix ViewMatrix
  9.         {
  10.             get
  11.             {
  12.                 return Matrix.CreateLookAt(Transform.Position, Transform.Position + Transform.Forward, Vector3.UnitY);
  13.             }
  14.         }
  15.         public Matrix ProjectionMatrix
  16.         {
  17.             get
  18.             {
  19.                 return Matrix.CreatePerspectiveFieldOfView(fieldOfView, aspectRatio, nearPlane, farPlane);
  20.             }
  21.         }
  22.  
  23.         public float FieldOfView { get => fieldOfView; set => fieldOfView = value; }
  24.         public float AspectRatio { get => aspectRatio; set => aspectRatio = value; }
  25.         public float NearPlane { get => nearPlane; set => nearPlane = value; }
  26.         public float FarPlane { get => farPlane; set => farPlane = value; }
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement