smrendererv3/SMCode/SM2D/Scene/Camera.cs
Michel Fedde acccf5f0e7 19.09.2020
+ Vector-classes
+ Added Background
~ Changed OpenTK.Vector2 to SM.Base.Types.Vector2
2020-09-19 19:04:19 +02:00

23 lines
No EOL
674 B
C#

using OpenTK;
using SM.Base.Scene;
using Vector2 = SM.Base.Types.Vector2;
namespace SM2D.Scene
{
public class Camera : GenericCamera
{
public override bool Orthographic { get; } = true;
public Vector2 Position = new Vector2(0);
protected override Matrix4 ViewCalculation()
{
return Matrix4.LookAt(Position.X, Position.Y, -1, Position.X, Position.Y, 0, 0, 1, 0);
}
public override void RecalculateWorld(OpenTK.Vector2 world, float aspect)
{
OrthographicWorld = Matrix4.CreateOrthographicOffCenter(world.X / 2, -world.X / 2, world.Y / 2, -world.Y / 2, 0.1f, 100);
}
}
}