Files
XCEngine/managed/XCEngine.ScriptCore/Rendering/Data/CameraData.cs

113 lines
3.2 KiB
C#

using XCEngine;
namespace XCEngine.Rendering
{
public sealed class CameraData
{
internal static readonly CameraData Default =
new CameraData(
Matrix4x4.Identity,
Matrix4x4.Identity,
Matrix4x4.Identity,
new Vector3(0.0f, 0.0f, 0.0f),
new Vector3(1.0f, 0.0f, 0.0f),
new Vector3(0.0f, 1.0f, 0.0f),
new Vector3(0.0f, 0.0f, 1.0f),
new Color(0.0f, 0.0f, 0.0f, 1.0f),
RenderClearFlags.All,
true,
60.0f * 0.017453292519943295f,
5.0f,
1.0f,
0.1f,
1000.0f,
0,
0);
internal CameraData(
Matrix4x4 view,
Matrix4x4 projection,
Matrix4x4 viewProjection,
Vector3 worldPosition,
Vector3 worldRight,
Vector3 worldUp,
Vector3 worldForward,
Color clearColor,
RenderClearFlags clearFlags,
bool perspectiveProjection,
float verticalFovRadians,
float orthographicSize,
float aspectRatio,
float nearClipPlane,
float farClipPlane,
int viewportWidth,
int viewportHeight)
{
this.view = view;
this.projection = projection;
this.viewProjection = viewProjection;
this.worldPosition = worldPosition;
this.worldRight = worldRight;
this.worldUp = worldUp;
this.worldForward = worldForward;
this.clearColor = clearColor;
this.clearFlags = clearFlags;
this.perspectiveProjection = perspectiveProjection;
this.verticalFovRadians = verticalFovRadians;
this.orthographicSize = orthographicSize;
this.aspectRatio = aspectRatio;
this.nearClipPlane = nearClipPlane;
this.farClipPlane = farClipPlane;
this.viewportWidth = viewportWidth;
this.viewportHeight = viewportHeight;
}
public Matrix4x4 view { get; }
public Matrix4x4 projection { get; }
public Matrix4x4 viewProjection { get; }
public Vector3 worldPosition { get; }
public Vector3 worldRight { get; }
public Vector3 worldUp { get; }
public Vector3 worldForward { get; }
public Color clearColor { get; }
public RenderClearFlags clearFlags { get; }
public bool perspectiveProjection { get; }
public bool isPerspectiveProjection =>
perspectiveProjection;
public bool isOrthographicProjection =>
!perspectiveProjection;
public bool clearsColor =>
(clearFlags & RenderClearFlags.Color) != 0;
public bool clearsDepth =>
(clearFlags & RenderClearFlags.Depth) != 0;
public float verticalFovRadians { get; }
public float orthographicSize { get; }
public float aspectRatio { get; }
public float nearClipPlane { get; }
public float farClipPlane { get; }
public int viewportWidth { get; }
public int viewportHeight { get; }
}
}