using OpenTK;
namespace SM.Base.Scene
{
///
/// Controller for a camera
///
public abstract class GenericCamera
{
///
/// The matrix for the orthographic world.
///
public static Matrix4 OrthographicWorld { get; protected set; }
///
/// The matrix for the perspective world.
///
public static Matrix4 PerspectiveWorld { get; protected set; }
///
/// This defines what is up. (Normalized)
/// Default:
///
public static Vector3 UpVector { get; set; } = Vector3.UnitY;
///
/// Contains the view matrix of this camera.
/// Default:
///
public Matrix4 ViewMatrix { get; protected set; } = Matrix4.Identity;
///
/// Returns the world matrix that is connected to this camera.
///
public Matrix4 World => Orthographic ? OrthographicWorld : PerspectiveWorld;
///
/// Calculates the view matrix.
///
/// The calculated view matrix. Same as
internal Matrix4 CalculateViewMatrix()
{
ViewMatrix = ViewCalculation();
return ViewMatrix;
}
///
/// This calculates the view matrix.
///
/// The new view matrix. This is the returns for and the next value for .
protected abstract Matrix4 ViewCalculation();
///
/// Represents if the camera is orthographic.
///
public abstract bool Orthographic { get; }
///
/// This will calculate the world.
/// This is called on to calculate the world.
///
/// The world scale
/// The aspect ratio from the window.
public abstract void RecalculateWorld(Vector2 world, float aspect);
}
}