blob: 1233c5ffd235ef8ebdd7223d71d278081f181794 (
plain)
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
|
#pragma once
#include "StarJson.hpp"
namespace Star {
class InterpolationTracker {
public:
InterpolationTracker(Json config = Json());
// Should interpolation be enabled on entities at all? If this is false,
// extrapolationHint and interpolationLead will always return 0.
bool interpolationEnabled() const;
unsigned extrapolationHint() const;
// Time in-between entity updates
float entityUpdateDelta() const;
void receiveTimeUpdate(double remoteTime);
void update(double newLocalTime);
// Lead time that incoming interpolated data as of this moment should be
// marked for. If interpolation is disabled, this is always 0.0
float interpolationLeadTime() const;
private:
bool m_interpolationEnabled;
float m_entityUpdateDelta;
double m_timeLead;
unsigned m_extrapolationHint;
double m_timeTrackFactor;
double m_timeMaxDistance;
double m_currentTime;
Maybe<double> m_lastTimeUpdate;
Maybe<double> m_predictedTime;
};
}
|