-
Notifications
You must be signed in to change notification settings - Fork 459
Expand file tree
/
Copy pathBufferedLinearInterpolatorFloat.cs
More file actions
40 lines (36 loc) · 1.44 KB
/
BufferedLinearInterpolatorFloat.cs
File metadata and controls
40 lines (36 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Runtime.CompilerServices;
using UnityEngine;
namespace Unity.Netcode
{
/// <inheritdoc />
/// <remarks>
/// This is a buffered linear interpolator for a <see cref="float"/> type value
/// </remarks>
public class BufferedLinearInterpolatorFloat : BufferedLinearInterpolator<float>
{
/// <inheritdoc />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected override float InterpolateUnclamped(float start, float end, float time)
{
return Mathf.LerpUnclamped(start, end, time);
}
/// <inheritdoc />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected override float Interpolate(float start, float end, float time)
{
return Mathf.Lerp(start, end, time);
}
/// <inheritdoc />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private protected override bool IsApproximately(float first, float second, float precision = 1E-06F)
{
return Mathf.Approximately(first, second);
}
/// <inheritdoc />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private protected override float SmoothDamp(float current, float target, ref float rateOfChange, float duration, float deltaTime, float maxSpeed = float.PositiveInfinity)
{
return Mathf.SmoothDamp(current, target, ref rateOfChange, duration, maxSpeed, deltaTime);
}
}
}