mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-23 13:50:13 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
27 lines
666 B
C#
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 ) );
|
|
}
|
|
}
|
|
}
|