You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
924 B

using System.Drawing;
using gaemstone.ECS;
namespace gaemstone.Client.Components;
[Module]
public class CameraComponents
{
[Component]
public struct Camera
{
public static readonly Camera Default2D = Create2D();
public static readonly Camera Default3D = Create3D(80.0f);
public static Camera Create2D(float nearPlane = -100.0f, float farPlane = 100.0f)
=> new() { NearPlane = nearPlane, FarPlane = farPlane };
public static Camera Create3D(float fieldOfView, float nearPlane = 0.1f, float farPlane = 200.0f)
=> new() { FieldOfView = fieldOfView, NearPlane = nearPlane, FarPlane = farPlane };
public float FieldOfView { get; set; }
public float NearPlane { get; set; }
public float FarPlane { get; set; }
public bool IsOrthographic => (FieldOfView == 0.0f);
}
[Component]
public struct CameraViewport
{
public Color ClearColor { get; set; }
public Rectangle Viewport { get; set; }
}
}