Skip to content

Commit 9e9172f

Browse files
update
Adding [MethodImpl(MethodImplOptions.AggressiveInlining)] to float, Vector3, and Quaternion LinearBufferInterpolator methods.
1 parent f6ad63f commit 9e9172f

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

com.unity.netcode.gameobjects/Runtime/Components/Interpolator/BufferedLinearInterpolatorFloat.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Runtime.CompilerServices;
12
using UnityEngine;
23

34
namespace Unity.Netcode
@@ -9,24 +10,28 @@ namespace Unity.Netcode
910
public class BufferedLinearInterpolatorFloat : BufferedLinearInterpolator<float>
1011
{
1112
/// <inheritdoc />
13+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1214
protected override float InterpolateUnclamped(float start, float end, float time)
1315
{
1416
return Mathf.LerpUnclamped(start, end, time);
1517
}
1618

1719
/// <inheritdoc />
20+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1821
protected override float Interpolate(float start, float end, float time)
1922
{
2023
return Mathf.Lerp(start, end, time);
2124
}
2225

2326
/// <inheritdoc />
27+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2428
private protected override bool IsAproximately(float first, float second, float precision = 1E-07F)
2529
{
2630
return Mathf.Approximately(first, second);
2731
}
2832

2933
/// <inheritdoc />
34+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3035
private protected override float SmoothDamp(float current, float target, ref float rateOfChange, float duration, float deltaTime, float maxSpeed = float.PositiveInfinity)
3136
{
3237
if (m_IsAngularValue)

com.unity.netcode.gameobjects/Runtime/Components/Interpolator/BufferedLinearInterpolatorQuaternion.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Runtime.CompilerServices;
12
using UnityEngine;
23

34
namespace Unity.Netcode
@@ -21,6 +22,7 @@ public class BufferedLinearInterpolatorQuaternion : BufferedLinearInterpolator<Q
2122
public bool IsSlerp;
2223

2324
/// <inheritdoc />
25+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2426
protected override Quaternion InterpolateUnclamped(Quaternion start, Quaternion end, float time)
2527
{
2628
if (IsSlerp)
@@ -34,6 +36,7 @@ protected override Quaternion InterpolateUnclamped(Quaternion start, Quaternion
3436
}
3537

3638
/// <inheritdoc />
39+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3740
protected override Quaternion Interpolate(Quaternion start, Quaternion end, float time)
3841
{
3942
if (IsSlerp)
@@ -47,6 +50,7 @@ protected override Quaternion Interpolate(Quaternion start, Quaternion end, floa
4750
}
4851

4952
/// <inheritdoc />
53+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
5054
private protected override Quaternion SmoothDamp(Quaternion current, Quaternion target, ref Quaternion rateOfChange, float duration, float deltaTime, float maxSpeed = float.PositiveInfinity)
5155
{
5256
Vector3 currentEuler = current.eulerAngles;
@@ -61,6 +65,7 @@ private protected override Quaternion SmoothDamp(Quaternion current, Quaternion
6165
}
6266

6367
/// <inheritdoc />
68+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6469
private protected override bool IsAproximately(Quaternion first, Quaternion second, float precision)
6570
{
6671
return Mathf.Abs(first.x - second.x) <= precision &&
@@ -70,6 +75,7 @@ private protected override bool IsAproximately(Quaternion first, Quaternion seco
7075
}
7176

7277
/// <inheritdoc />
78+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
7379
protected internal override Quaternion OnConvertTransformSpace(Transform transform, Quaternion rotation, bool inLocalSpace)
7480
{
7581
if (inLocalSpace)

com.unity.netcode.gameobjects/Runtime/Components/Interpolator/BufferedLinearInterpolatorVector3.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Runtime.CompilerServices;
12
using UnityEngine;
23

34
namespace Unity.Netcode
@@ -13,6 +14,7 @@ public class BufferedLinearInterpolatorVector3 : BufferedLinearInterpolator<Vect
1314
/// </summary>
1415
public bool IsSlerp;
1516
/// <inheritdoc />
17+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1618
protected override Vector3 InterpolateUnclamped(Vector3 start, Vector3 end, float time)
1719
{
1820
if (IsSlerp)
@@ -26,6 +28,7 @@ protected override Vector3 InterpolateUnclamped(Vector3 start, Vector3 end, floa
2628
}
2729

2830
/// <inheritdoc />
31+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2932
protected override Vector3 Interpolate(Vector3 start, Vector3 end, float time)
3033
{
3134
if (IsSlerp)
@@ -39,6 +42,7 @@ protected override Vector3 Interpolate(Vector3 start, Vector3 end, float time)
3942
}
4043

4144
/// <inheritdoc />
45+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
4246
protected internal override Vector3 OnConvertTransformSpace(Transform transform, Vector3 position, bool inLocalSpace)
4347
{
4448
if (inLocalSpace)
@@ -53,12 +57,14 @@ protected internal override Vector3 OnConvertTransformSpace(Transform transform,
5357
}
5458

5559
/// <inheritdoc />
60+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
5661
private protected override bool IsAproximately(Vector3 first, Vector3 second, float precision = 0.0001F)
5762
{
5863
return Vector3.Distance(first, second) <= precision;
5964
}
6065

6166
/// <inheritdoc />
67+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6268
private protected override Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 rateOfChange, float duration, float deltaTime, float maxSpeed)
6369
{
6470
if (m_IsAngularValue)

0 commit comments

Comments
 (0)