smrendererv3/SMCode/SM2D/Scene/Camera.cs
Michel Fedde 97e638d9d9 01.10.2020
+ Time controls (Stopwatch, Timers, Intervals)
+ Added smmeries to everything in SM.Base

~ Renamed Vectors to CVectors.
2020-10-01 15:39:03 +02:00

23 lines
No EOL
656 B
C#

using OpenTK;
using SM.Base.Scene;
using SM.Base.Types;
namespace SM2D.Scene
{
public class Camera : GenericCamera
{
public override bool Orthographic { get; } = true;
public CVector2 Position = new CVector2(0);
protected override Matrix4 ViewCalculation()
{
return Matrix4.LookAt(Position.X, Position.Y, 2, 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, 4f);
}
}
}