mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00: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,
|
ref serverInterpolationTime,
|
||||||
bufferTime, serverBuffer,
|
bufferTime, serverBuffer,
|
||||||
catchupThreshold, catchupMultiplier,
|
catchupThreshold, catchupMultiplier,
|
||||||
out Snapshot computed))
|
out NTSnapshot computed))
|
||||||
{
|
{
|
||||||
NTSnapshot start = serverBuffer.Values[0];
|
NTSnapshot start = serverBuffer.Values[0];
|
||||||
NTSnapshot goal = serverBuffer.Values[1];
|
NTSnapshot goal = serverBuffer.Values[1];
|
||||||
ApplySnapshot(start, goal, (NTSnapshot)computed);
|
ApplySnapshot(start, goal, computed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,11 +354,11 @@ void UpdateClient()
|
|||||||
ref clientInterpolationTime,
|
ref clientInterpolationTime,
|
||||||
bufferTime, clientBuffer,
|
bufferTime, clientBuffer,
|
||||||
catchupThreshold, catchupMultiplier,
|
catchupThreshold, catchupMultiplier,
|
||||||
out Snapshot computed))
|
out NTSnapshot computed))
|
||||||
{
|
{
|
||||||
NTSnapshot start = clientBuffer.Values[0];
|
NTSnapshot start = clientBuffer.Values[0];
|
||||||
NTSnapshot goal = clientBuffer.Values[1];
|
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,
|
SortedList<double, T> buffer,
|
||||||
int catchupThreshold,
|
int catchupThreshold,
|
||||||
float catchupMultiplier,
|
float catchupMultiplier,
|
||||||
out Snapshot computed)
|
out T computed)
|
||||||
where T : Snapshot
|
where T : Snapshot
|
||||||
{
|
{
|
||||||
// we buffer snapshots for 'bufferTime'
|
// 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}");
|
//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
|
// 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:
|
// interpolationTime:
|
||||||
// overshooting is ONLY allowed for smooth transitions when
|
// overshooting is ONLY allowed for smooth transitions when
|
||||||
|
Loading…
Reference in New Issue
Block a user