35 lines
889 B
C#
35 lines
889 B
C#
using Engine.Graphics.Camera;
|
|
using Engine.Graphics.Pipeline;
|
|
using OpenTK.Mathematics;
|
|
|
|
namespace Engine.Scene.Component.BuiltIn;
|
|
|
|
public abstract class Camera(
|
|
float parNearPlane,
|
|
float parFarPlane
|
|
) : Component, ICamera
|
|
{
|
|
public float AspectRatio { get; private set; } = 1;
|
|
public float NearPlane { get; set; } = parNearPlane;
|
|
public float FarPlane { get; set; } = parFarPlane;
|
|
|
|
public RenderLayer RenderLayer { get; set; } = RenderLayer.DEFAULT;
|
|
|
|
private Vector2i _screenSize = new(1, 1);
|
|
|
|
public abstract Matrix4 View { get; }
|
|
public abstract Matrix4 Projection { get; }
|
|
|
|
public Vector2i ScreenSize
|
|
{
|
|
get => _screenSize;
|
|
set
|
|
{
|
|
_screenSize = value;
|
|
AspectRatio = (float)value.X / value.Y;
|
|
}
|
|
}
|
|
|
|
public abstract Vector3 ScreenToWorld(Vector2 parScreenPosition);
|
|
public abstract Vector2 WorldToScreen(Vector3 parWorldPosition);
|
|
} |