mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T185 Enable spline interpolation with only one position update,
by just copying it three times, so planes can be rendered without waiting for more updates.
This commit is contained in:
@@ -22,5 +22,9 @@ namespace BlackMisc
|
||||
CSequence<CAircraftParts>(other)
|
||||
{ }
|
||||
|
||||
CAircraftPartsList::CAircraftPartsList(std::initializer_list<CAircraftParts> il) :
|
||||
CSequence<CAircraftParts>(il)
|
||||
{ }
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -39,6 +39,9 @@ namespace BlackMisc
|
||||
|
||||
//! Construct from a base class object.
|
||||
CAircraftPartsList(const CSequence<CAircraftParts> &other);
|
||||
|
||||
//! Construct from initializer list.
|
||||
CAircraftPartsList(std::initializer_list<CAircraftParts> il);
|
||||
};
|
||||
|
||||
} //namespace
|
||||
|
||||
@@ -27,5 +27,9 @@ namespace BlackMisc
|
||||
CSequence<CAircraftSituation>(other)
|
||||
{ }
|
||||
|
||||
CAircraftSituationList::CAircraftSituationList(std::initializer_list<CAircraftSituation> il) :
|
||||
CSequence<CAircraftSituation>(il)
|
||||
{ }
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -45,6 +45,8 @@ namespace BlackMisc
|
||||
//! Construct from a base class object.
|
||||
CAircraftSituationList(const CSequence<CAircraftSituation> &other);
|
||||
|
||||
//! Construct from initializer list.
|
||||
CAircraftSituationList(std::initializer_list<CAircraftSituation> il);
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -265,12 +265,26 @@ namespace BlackMisc
|
||||
template <typename Derived>
|
||||
void CInterpolator<Derived>::addAircraftSituation(const CAircraftSituation &situation)
|
||||
{
|
||||
if (m_aircraftSituations.isEmpty())
|
||||
{
|
||||
// make sure we have enough situations to do start interpolating immediately without waiting for more updates
|
||||
m_aircraftSituations = { situation, situation };
|
||||
m_aircraftSituations.back().addMsecs(-10000); // number here does
|
||||
m_aircraftSituations.front().addMsecs(-5000); // not really matter
|
||||
}
|
||||
m_aircraftSituations.push_frontMaxElements(situation, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
void CInterpolator<Derived>::addAircraftParts(const CAircraftParts &parts)
|
||||
{
|
||||
if (m_aircraftParts.isEmpty())
|
||||
{
|
||||
// make sure we have enough parts to do start interpolating immediately without waiting for more updates
|
||||
m_aircraftParts = { parts, parts };
|
||||
m_aircraftParts.back().addMsecs(-10000); // number here does
|
||||
m_aircraftParts.front().addMsecs(-5000); // not really matter
|
||||
}
|
||||
m_aircraftParts.push_front(parts);
|
||||
IRemoteAircraftProvider::removeOutdatedParts(m_aircraftParts);
|
||||
|
||||
|
||||
@@ -137,6 +137,11 @@ namespace BlackMisc
|
||||
this->m_timestampMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch();
|
||||
}
|
||||
|
||||
void ITimestampBased::addMsecs(qint64 ms)
|
||||
{
|
||||
this->m_timestampMSecsSinceEpoch += ms;
|
||||
}
|
||||
|
||||
QString ITimestampBased::getFormattedUtcTimestampDhms() const
|
||||
{
|
||||
return this->hasValidTimestamp() ?
|
||||
|
||||
@@ -86,6 +86,9 @@ namespace BlackMisc
|
||||
//! Set the current time as timestamp
|
||||
void setCurrentUtcTime();
|
||||
|
||||
//! Add the given number of milliseconds to the timestamp.
|
||||
void addMsecs(qint64 ms);
|
||||
|
||||
//! Formatted timestamp
|
||||
QString getFormattedUtcTimestampDhms() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user