add docs for engine

This commit is contained in:
2025-01-07 06:25:09 +03:00
parent 0df34ef0ec
commit 926ce601d9
92 changed files with 3051 additions and 170 deletions

View File

@@ -4,22 +4,18 @@ using OpenTK.Mathematics;
namespace Engine.Scene.Component.BuiltIn;
public abstract class Camera(
float parNearPlane,
float parFarPlane
) : Component, ICamera
/// <summary>
/// Abstract base class for cameras that provide view and projection matrices.
/// </summary>
public abstract class Camera : 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);
/// <inheritdoc/>
public abstract Matrix4 View { get; }
/// <inheritdoc/>
public abstract Matrix4 Projection { get; }
/// <inheritdoc/>
public Vector2i ScreenSize
{
get => _screenSize;
@@ -30,6 +26,54 @@ public abstract class Camera(
}
}
/// <summary>
/// The aspect ratio of the camera, calculated as width divided by height.
/// </summary>
public float AspectRatio { get; private set; } = 1;
/// <summary>
/// The near clipping plane distance.
/// </summary>
public float NearPlane { get; set; }
/// <summary>
/// The far clipping plane distance.
/// </summary>
public float FarPlane { get; set; }
/// <summary>
/// The render layer for the camera.
/// </summary>
public RenderLayer RenderLayer { get; set; } = RenderLayer.DEFAULT;
/// <summary>
/// The screen size of the camera.
/// </summary>
private Vector2i _screenSize = new(1, 1);
/// <summary>
/// Initializes a new instance of the <see cref="Camera"/> class.
/// </summary>
/// <param name="parNearPlane">The near clipping plane distance.</param>
/// <param name="parFarPlane">The far clipping plane distance.</param>
protected Camera(float parNearPlane, float parFarPlane)
{
NearPlane = parNearPlane;
FarPlane = parFarPlane;
}
/// <summary>
/// Converts a screen position to a world position in 3D space.
/// </summary>
/// <param name="parScreenPosition">The screen position to convert.</param>
/// <returns>The corresponding world position.</returns>
public abstract Vector3 ScreenToWorld(Vector2 parScreenPosition);
/// <summary>
/// Converts a world position to a screen position in 2D space.
/// </summary>
/// <param name="parWorldPosition">The world position to convert.</param>
/// <returns>The corresponding screen position.</returns>
public abstract Vector2 WorldToScreen(Vector3 parWorldPosition);
}