mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
Implement interpolator mode for FS9
Summary: This implementation will always return true if we were setting the mode, since we cannot easily access the return value from CInterpolatorMulti::setMode in a thread safe manner. Reviewers: #swift_pilot_client, kbasan, msutcliffe Reviewed By: #swift_pilot_client, kbasan, msutcliffe Subscribers: kbasan, jenkins Differential Revision: https://dev.swift-project.org/D52
This commit is contained in:
committed by
Mathew Sutcliffe
parent
09da34d8f0
commit
27f97e8ac8
@@ -164,6 +164,7 @@ namespace BlackCore
|
|||||||
virtual bool isShuttingDown() const = 0;
|
virtual bool isShuttingDown() const = 0;
|
||||||
|
|
||||||
//! Set interpolation mode, empty callsign applies to all know callsigns
|
//! Set interpolation mode, empty callsign applies to all know callsigns
|
||||||
|
//! \return Returns true if the mode changed, otherwise false. Note that some implementations always return true.
|
||||||
virtual bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode, const BlackMisc::Aviation::CCallsign &callsign) = 0;
|
virtual bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode, const BlackMisc::Aviation::CCallsign &callsign) = 0;
|
||||||
|
|
||||||
//! \addtogroup swiftdotcommands
|
//! \addtogroup swiftdotcommands
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#define DIRECTPLAY_CLIENT_H
|
#define DIRECTPLAY_CLIENT_H
|
||||||
|
|
||||||
#include "directplaypeer.h"
|
#include "directplaypeer.h"
|
||||||
#include "blackmisc/simulation/interpolatorlinear.h"
|
#include "blackmisc/simulation/interpolatormulti.h"
|
||||||
#include "blackmisc/aviation/aircraftsituation.h"
|
#include "blackmisc/aviation/aircraftsituation.h"
|
||||||
#include "blackmisc/pq/time.h"
|
#include "blackmisc/pq/time.h"
|
||||||
#include "blackmisc/aviation/callsign.h"
|
#include "blackmisc/aviation/callsign.h"
|
||||||
@@ -51,7 +51,7 @@ namespace BlackSimPlugin
|
|||||||
void setHostAddress(const QString &hostAddress);
|
void setHostAddress(const QString &hostAddress);
|
||||||
|
|
||||||
//! Get interpolator
|
//! Get interpolator
|
||||||
BlackMisc::Simulation::CInterpolatorLinear *getInterpolator() { return &m_interpolator; }
|
BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() { return &m_interpolator; }
|
||||||
|
|
||||||
//! Set interpolation setup
|
//! Set interpolation setup
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -94,7 +94,7 @@ namespace BlackSimPlugin
|
|||||||
BlackMisc::Simulation::CInterpolationAndRenderingSetup getInterpolationSetup() const;
|
BlackMisc::Simulation::CInterpolationAndRenderingSetup getInterpolationSetup() const;
|
||||||
|
|
||||||
BlackMisc::PhysicalQuantities::CTime m_updateInterval;
|
BlackMisc::PhysicalQuantities::CTime m_updateInterval;
|
||||||
BlackMisc::Simulation::CInterpolatorLinear m_interpolator;
|
BlackMisc::Simulation::CInterpolatorMulti m_interpolator;
|
||||||
BlackMisc::Simulation::CInterpolationAndRenderingSetup m_interpolationSetup;
|
BlackMisc::Simulation::CInterpolationAndRenderingSetup m_interpolationSetup;
|
||||||
mutable QReadWriteLock m_interpolationSetupMutex;
|
mutable QReadWriteLock m_interpolationSetupMutex;
|
||||||
QString m_modelName;
|
QString m_modelName;
|
||||||
|
|||||||
@@ -305,10 +305,12 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFs9::setInterpolatorMode(CInterpolatorMulti::Mode mode, const CCallsign &callsign)
|
bool CSimulatorFs9::setInterpolatorMode(CInterpolatorMulti::Mode mode, const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
//! \todo (added by KWB 3/17) interpolator mode for FS9 needs implementation
|
const auto it = m_hashFs9Clients.find(callsign);
|
||||||
Q_UNUSED(mode);
|
if (it == m_hashFs9Clients.end()) { return false; }
|
||||||
Q_UNUSED(callsign);
|
QTimer::singleShot(0, it->data(), [client = *it, mode] { client->getInterpolator()->setMode(mode); });
|
||||||
return false;
|
// Always return true if we were setting the mode, since we cannot easily access the return value from
|
||||||
|
// CInterpolatorMulti::setMode in a thread safe manner.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFs9::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
bool CSimulatorFs9::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
||||||
|
|||||||
Reference in New Issue
Block a user