mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-14 09:19:25 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
27 lines
628 B
C#
27 lines
628 B
C#
namespace Sandbox.Interpolation;
|
|
|
|
/// <summary>
|
|
/// State information about a <see cref="Vector3"/>. Used for interpolation buffer.
|
|
/// </summary>
|
|
struct Vector3State
|
|
{
|
|
public readonly Vector3 Value;
|
|
|
|
public Vector3State( Vector3 value )
|
|
{
|
|
Value = value;
|
|
}
|
|
|
|
public static IInterpolator<Vector3State> CreateInterpolator() => Interpolator.Instance;
|
|
|
|
private class Interpolator : IInterpolator<Vector3State>
|
|
{
|
|
public static readonly Interpolator Instance = new();
|
|
|
|
public Vector3State Interpolate( Vector3State a, Vector3State b, float delta )
|
|
{
|
|
return new( Vector3.Lerp( a.Value, b.Value, delta ) );
|
|
}
|
|
}
|
|
}
|