Components/Camera/CameraPose.cs

A simple immutable struct representing a camera pose with position, rotation and field of view. Provides a constructor and a Lerp method that interpolates position with Vector3.Lerp, rotation with Rotation.Slerp and FOV with MathX.Lerp.

namespace Machines.Components;

/// <summary>
/// A camera viewpoint (position, rotation, FOV) - what behaviours produce and the director blends.
/// </summary>
public readonly struct CameraPose
{
	public Vector3 Position { get; }
	public Rotation Rotation { get; }
	public float FieldOfView { get; }

	public CameraPose( Vector3 position, Rotation rotation, float fieldOfView )
	{
		Position = position;
		Rotation = rotation;
		FieldOfView = fieldOfView;
	}

	/// <summary>
	/// Blend two poses: lerp position, slerp rotation, lerp FOV.
	/// </summary>
	public static CameraPose Lerp( CameraPose a, CameraPose b, float t )
	{
		return new CameraPose(
			Vector3.Lerp( a.Position, b.Position, t ),
			Rotation.Slerp( a.Rotation, b.Rotation, t ),
			MathX.Lerp( a.FieldOfView, b.FieldOfView, t )
		);
	}
}