mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Ref T259, Ref T243 removed guessing from FSX driver code (now in interpolator) and also use guessing in emulated driver
This commit is contained in:
committed by
Roland Winklmeier
parent
f1faeef84a
commit
5c6a37c669
@@ -424,7 +424,7 @@ namespace BlackSimPlugin
|
|||||||
CPartsStatus statusParts;
|
CPartsStatus statusParts;
|
||||||
Q_ASSERT_X(im, Q_FUNC_INFO, "interpolator missing");
|
Q_ASSERT_X(im, Q_FUNC_INFO, "interpolator missing");
|
||||||
const CAircraftSituation s = im->getInterpolatedSituation(now, setup, statusInterpolation);
|
const CAircraftSituation s = im->getInterpolatedSituation(now, setup, statusInterpolation);
|
||||||
const CAircraftParts p = im->getInterpolatedParts(now, setup, statusParts, log);
|
const CAircraftParts p = im->getInterpolatedOrGuessedParts(now, setup, statusParts, log);
|
||||||
m_countInterpolatedParts++;
|
m_countInterpolatedParts++;
|
||||||
m_countInterpolatedSituations++;
|
m_countInterpolatedSituations++;
|
||||||
Q_UNUSED(s);
|
Q_UNUSED(s);
|
||||||
|
|||||||
@@ -1108,18 +1108,20 @@ namespace BlackSimPlugin
|
|||||||
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "missing callsign");
|
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "missing callsign");
|
||||||
Q_ASSERT_X(simObject.hasValidRequestAndObjectId(), Q_FUNC_INFO, "Missing ids");
|
Q_ASSERT_X(simObject.hasValidRequestAndObjectId(), Q_FUNC_INFO, "Missing ids");
|
||||||
|
|
||||||
// fetch parts
|
// setup
|
||||||
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupPerCallsignOrDefault(callsign);
|
const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupPerCallsignOrDefault(callsign);
|
||||||
const bool useAircraftParts = setup.isAircraftPartsEnabled() && aircraftWithParts.contains(callsign);
|
const bool useAircraftParts = setup.isAircraftPartsEnabled() && aircraftWithParts.contains(callsign);
|
||||||
const bool logInterpolationAndParts = setup.logInterpolation();
|
const bool logInterpolationAndParts = setup.logInterpolation();
|
||||||
const bool sendGround = setup.sendGndFlagToSimulator();
|
const bool sendGround = setup.sendGndFlagToSimulator();
|
||||||
CPartsStatus partsStatus(useAircraftParts);
|
CPartsStatus partsStatus(useAircraftParts);
|
||||||
const CAircraftParts parts = useAircraftParts ? simObject.getInterpolatedParts(currentTimestamp, setup, partsStatus, logInterpolationAndParts) : CAircraftParts();
|
|
||||||
|
|
||||||
// get interpolated situation
|
// Interpolated situation
|
||||||
CInterpolationStatus interpolatorStatus;
|
CInterpolationStatus interpolatorStatus;
|
||||||
const CAircraftSituation interpolatedSituation = simObject.getInterpolatedSituation(currentTimestamp, setup, interpolatorStatus);
|
const CAircraftSituation interpolatedSituation = simObject.getInterpolatedSituation(currentTimestamp, setup, interpolatorStatus);
|
||||||
|
|
||||||
|
// Interpolated parts
|
||||||
|
const CAircraftParts parts = useAircraftParts ? simObject.getInterpolatedOrGuessedParts(currentTimestamp, setup, partsStatus, logInterpolationAndParts) : CAircraftParts::guessedParts(interpolatedSituation, simObject.isVtol(), simObject.getEngineCount());
|
||||||
|
|
||||||
if (interpolatorStatus.hasValidSituation())
|
if (interpolatorStatus.hasValidSituation())
|
||||||
{
|
{
|
||||||
// update situation
|
// update situation
|
||||||
@@ -1152,14 +1154,6 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
this->updateRemoteAircraftParts(simObject, parts, partsStatus);
|
this->updateRemoteAircraftParts(simObject, parts, partsStatus);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// guess on position, but not every frame
|
|
||||||
if (m_interpolationRequest % GuessRemoteAircraftPartsCycle == 0)
|
|
||||||
{
|
|
||||||
this->guessAndUpdateRemoteAircraftParts(simObject, interpolatedSituation, interpolatorStatus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // all callsigns
|
} // all callsigns
|
||||||
|
|
||||||
const qint64 dt = QDateTime::currentMSecsSinceEpoch() - currentTimestamp;
|
const qint64 dt = QDateTime::currentMSecsSinceEpoch() - currentTimestamp;
|
||||||
@@ -1168,16 +1162,6 @@ namespace BlackSimPlugin
|
|||||||
m_statsUpdateAircraftTimeAvgMs = m_statsUpdateAircraftTimeTotalMs / m_statsUpdateAircraftCountMs;
|
m_statsUpdateAircraftTimeAvgMs = m_statsUpdateAircraftTimeTotalMs / m_statsUpdateAircraftCountMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFsxCommon::guessAndUpdateRemoteAircraftParts(const CSimConnectObject &simObj, const CAircraftSituation &interpolatedSituation, const CInterpolationStatus &interpolationStatus)
|
|
||||||
{
|
|
||||||
if (!simObj.hasValidRequestAndObjectId()) { return false; }
|
|
||||||
if (!interpolationStatus.isInterpolated()) { return false; }
|
|
||||||
|
|
||||||
const CAircraftParts parts = CAircraftParts::guessedParts(interpolatedSituation, simObj.isVtol(), 4);
|
|
||||||
DataDefinitionRemoteAircraftPartsWithoutLights ddRemoteAircraftPartsWithoutLights(parts);
|
|
||||||
return this->sendRemoteAircraftPartsToSimulator(simObj, ddRemoteAircraftPartsWithoutLights, parts.getAdjustedLights());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimulatorFsxCommon::updateRemoteAircraftParts(const CSimConnectObject &simObj, const CAircraftParts &parts, const CPartsStatus &partsStatus)
|
bool CSimulatorFsxCommon::updateRemoteAircraftParts(const CSimConnectObject &simObj, const CAircraftParts &parts, const CPartsStatus &partsStatus)
|
||||||
{
|
{
|
||||||
if (!simObj.hasValidRequestAndObjectId()) { return false; }
|
if (!simObj.hasValidRequestAndObjectId()) { return false; }
|
||||||
|
|||||||
@@ -244,10 +244,6 @@ namespace BlackSimPlugin
|
|||||||
bool updateRemoteAircraftParts(const CSimConnectObject &simObj,
|
bool updateRemoteAircraftParts(const CSimConnectObject &simObj,
|
||||||
const BlackMisc::Aviation::CAircraftParts &parts, const BlackMisc::Simulation::CPartsStatus &partsStatus);
|
const BlackMisc::Aviation::CAircraftParts &parts, const BlackMisc::Simulation::CPartsStatus &partsStatus);
|
||||||
|
|
||||||
//! Update remote aircraft parts by guessing (send to FSX)
|
|
||||||
bool guessAndUpdateRemoteAircraftParts(const CSimConnectObject &simObject,
|
|
||||||
const BlackMisc::Aviation::CAircraftSituation &interpolatedSituation, const BlackMisc::Simulation::CInterpolationStatus &interpolationStatus);
|
|
||||||
|
|
||||||
//! Send parts to simulator
|
//! Send parts to simulator
|
||||||
bool sendRemoteAircraftPartsToSimulator(const CSimConnectObject &simObject, DataDefinitionRemoteAircraftPartsWithoutLights &ddRemoteAircraftParts, const BlackMisc::Aviation::CAircraftLights &lights);
|
bool sendRemoteAircraftPartsToSimulator(const CSimConnectObject &simObject, DataDefinitionRemoteAircraftPartsWithoutLights &ddRemoteAircraftParts, const BlackMisc::Aviation::CAircraftLights &lights);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user