parent
594433a0ad
commit
8c5c5260c2
4 changed files with 48 additions and 33 deletions
@ -0,0 +1,34 @@ |
||||
using gaemstone.ECS; |
||||
using Silk.NET.Maths; |
||||
|
||||
namespace gaemstone.Client; |
||||
|
||||
[Module] |
||||
[DependsOn(typeof(Input))] |
||||
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 Vector4D<byte> ClearColor { get; set; } |
||||
public Rectangle<int> Viewport { get; set; } |
||||
} |
||||
} |
Loading…
Reference in new issue