Files
sbox-public/engine/Sandbox.System/Math/Interpolation/TransformState.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

27 lines
666 B
C#

namespace Sandbox.Interpolation;
/// <summary>
/// State information about a transform. Used for interpolation buffer.
/// </summary>
struct TransformState
{
public readonly Transform Transform;
public TransformState( Transform transform )
{
Transform = transform;
}
public static IInterpolator<TransformState> CreateInterpolator() => Interpolator.Instance;
private class Interpolator : IInterpolator<TransformState>
{
public static readonly Interpolator Instance = new();
public TransformState Interpolate( TransformState a, TransformState b, float delta )
{
return new( Transform.Lerp( a.Transform, b.Transform, delta, true ) );
}
}
}