mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
SnapshotInterpolation.Compute now returns <T> instead of Snapshot for ease of use
This commit is contained in:
parent
23a663bdae
commit
2c70e71555
@ -294,11 +294,11 @@ void UpdateServer()
|
||||
ref serverInterpolationTime,
|
||||
bufferTime, serverBuffer,
|
||||
catchupThreshold, catchupMultiplier,
|
||||
out Snapshot computed))
|
||||
out NTSnapshot computed))
|
||||
{
|
||||
NTSnapshot start = serverBuffer.Values[0];
|
||||
NTSnapshot goal = serverBuffer.Values[1];
|
||||
ApplySnapshot(start, goal, (NTSnapshot)computed);
|
||||
ApplySnapshot(start, goal, computed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -354,11 +354,11 @@ void UpdateClient()
|
||||
ref clientInterpolationTime,
|
||||
bufferTime, clientBuffer,
|
||||
catchupThreshold, catchupMultiplier,
|
||||
out Snapshot computed))
|
||||
out NTSnapshot computed))
|
||||
{
|
||||
NTSnapshot start = clientBuffer.Values[0];
|
||||
NTSnapshot goal = clientBuffer.Values[1];
|
||||
ApplySnapshot(start, goal, (NTSnapshot)computed);
|
||||
ApplySnapshot(start, goal, computed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public static bool Compute<T>(
|
||||
SortedList<double, T> buffer,
|
||||
int catchupThreshold,
|
||||
float catchupMultiplier,
|
||||
out Snapshot computed)
|
||||
out T computed)
|
||||
where T : Snapshot
|
||||
{
|
||||
// we buffer snapshots for 'bufferTime'
|
||||
@ -261,7 +261,8 @@ public static bool Compute<T>(
|
||||
//Debug.Log($"InverseLerp({first.remoteTimestamp:F2}, {second.remoteTimestamp:F2}, {first.remoteTimestamp} + {interpolationTime:F2}) = {t:F2} snapshotbuffer={buffer.Count}");
|
||||
|
||||
// interpolate snapshot, return true to indicate we computed one
|
||||
computed = first.Interpolate(second, t);
|
||||
// TODO casting 'second' to 'Snapshot' still boxes
|
||||
computed = (T)first.Interpolate(second, t);
|
||||
|
||||
// interpolationTime:
|
||||
// overshooting is ONLY allowed for smooth transitions when
|
||||
|
Loading…
Reference in New Issue
Block a user