#region usings
using OpenTK;
using SM.Base.Windows;
#endregion
namespace SM.Base.Scene
{
///
/// Controller for a camera
///
public abstract class GenericCamera
{
///
/// This defines what is up. (Normalized)
/// Default:
///
public Vector3 UpVector { get; set; } = Vector3.UnitY;
///
/// Returns the world matrix that is connected to this camera.
///
public Matrix4 World { get; protected set; }
///
/// Contains the view matrix of this camera.
/// Default:
///
public Matrix4 View { get; protected set; } = Matrix4.Identity;
///
/// Represents if the camera is orthographic.
///
public abstract bool Orthographic { get; }
///
/// Exposure defines the exposure to the Scene.
///
public float Exposure = 1;
///
/// Calculates the view matrix.
///
/// The calculated view matrix. Same as
internal void CalculateViewMatrix(IGenericWindow window)
{
View = ViewCalculation(window);
if (WorldCalculation(window, out Matrix4 world))
{
World = world;
}
}
///
/// This calculates the view matrix.
///
///
/// The new view matrix. This is the returns for and the next value for
/// .
///
protected abstract Matrix4 ViewCalculation(IGenericWindow window);
protected abstract bool WorldCalculation(IGenericWindow window, out Matrix4 world);
}
}