Ref T261, adjusted interpolation setup

* removed "IndexEnableGndFlag" as this is actually part of FSD network settings
* renamed to "isForcingVtolInterpolation"
* adjusted interpolator, and UI for setup
This commit is contained in:
Klaus Basan
2018-05-09 02:09:27 +02:00
parent f4320b18c5
commit 23dcccc806
7 changed files with 54 additions and 78 deletions

View File

@@ -24,13 +24,6 @@ namespace BlackMisc
CInterpolationAndRenderingSetupBase::CInterpolationAndRenderingSetupBase()
{ }
bool CInterpolationAndRenderingSetupBase::setEnabledGndFLag(bool enabled)
{
if (enabled == m_enabledGndFlag) { return false; }
m_enabledGndFlag = enabled;
return true;
}
bool CInterpolationAndRenderingSetupBase::setSendingGndFlagToSimulator(bool sendFLag)
{
if (sendFLag == m_sendGndToSim) { return false; }
@@ -91,9 +84,8 @@ namespace BlackMisc
{
case IndexLogInterpolation: return CVariant::fromValue(m_logInterpolation);
case IndexSimulatorDebugMessages: return CVariant::fromValue(m_simulatorDebugMessages);
case IndexForceFullInterpolation: return CVariant::fromValue(m_forceFullInterpolation);
case IndexForceVtolInterpolation: return CVariant::fromValue(m_forceVtolInterpolation);
case IndexEnabledAircraftParts: return CVariant::fromValue(m_enabledAircraftParts);
case IndexEnableGndFlag: return CVariant::fromValue(m_enabledGndFlag);
case IndexSendGndFlagToSimulator: return CVariant::fromValue(m_sendGndToSim);
case IndexInterpolatorMode: return CVariant::fromValue(m_interpolatorMode);
case IndexInterpolatorModeAsString: return CVariant::fromValue(this->getInterpolatorModeAsString());
@@ -111,9 +103,8 @@ namespace BlackMisc
{
case IndexLogInterpolation: m_logInterpolation = variant.toBool(); return;
case IndexSimulatorDebugMessages: m_simulatorDebugMessages = variant.toBool(); return;
case IndexForceFullInterpolation: m_forceFullInterpolation = variant.toBool(); return;
case IndexForceVtolInterpolation: m_forceVtolInterpolation = variant.toBool(); return;
case IndexEnabledAircraftParts: m_enabledAircraftParts = variant.toBool(); return;
case IndexEnableGndFlag: m_enabledGndFlag = variant.toBool(); return;
case IndexSendGndFlagToSimulator: m_sendGndToSim = variant.toBool(); return;
case IndexInterpolatorMode: m_interpolatorMode = variant.toInt(); return;
case IndexInterpolatorModeAsString: this->setInterpolatorMode(variant.toQString()); return;
@@ -130,9 +121,8 @@ namespace BlackMisc
QStringLiteral("Interpolator: ") % this->getInterpolatorModeAsString() %
QStringLiteral(" | Dbg.sim.msgs: ") % boolToYesNo(m_simulatorDebugMessages) %
QStringLiteral(" | log interpolation: ") % boolToYesNo(m_logInterpolation) %
QStringLiteral(" | force full interpolation: ") % boolToYesNo(m_forceFullInterpolation) %
QStringLiteral(" | force VTOL interpolation: ") % boolToYesNo(m_forceVtolInterpolation) %
QStringLiteral(" | enable parts: ") % boolToYesNo(m_enabledAircraftParts) %
QStringLiteral(" | enable gnd: ") % boolToYesNo(m_enabledGndFlag) %
QStringLiteral(" | send gnd: ") % boolToYesNo(m_sendGndToSim) %
QStringLiteral(" | fix.scenery offset: ") % boolToYesNo(m_fixSceneryOffset);
}
@@ -255,10 +245,11 @@ namespace BlackMisc
{
m_logInterpolation = baseValues.logInterpolation();
m_simulatorDebugMessages = baseValues.showSimulatorDebugMessages();
m_forceFullInterpolation = baseValues.isForcingFullInterpolation();
m_forceVtolInterpolation = baseValues.isForcingVtolInterpolation();
m_enabledAircraftParts = baseValues.isAircraftPartsEnabled();
m_enabledGndFlag = baseValues.isGndFlagEnabled();
m_sendGndToSim = baseValues.isSendingGndFlagToSimulator();
m_fixSceneryOffset = baseValues.isFixingSceneryOffset();
m_interpolatorMode = baseValues.getInterpolatorMode();
}
QString CInterpolationAndRenderingSetupGlobal::convertToQString(bool i18n) const
@@ -318,11 +309,10 @@ namespace BlackMisc
CPropertyIndexList diff;
if (this->logInterpolation() != globalSetup.logInterpolation()) { diff.push_back(IndexLogInterpolation); }
if (this->showSimulatorDebugMessages() != globalSetup.showSimulatorDebugMessages()) { diff.push_back(IndexSimulatorDebugMessages); }
if (this->isForcingFullInterpolation() != globalSetup.isForcingFullInterpolation()) { diff.push_back(IndexForceFullInterpolation); }
if (this->isForcingVtolInterpolation() != globalSetup.isForcingVtolInterpolation()) { diff.push_back(IndexForceVtolInterpolation); }
if (this->isAircraftPartsEnabled() != globalSetup.isAircraftPartsEnabled()) { diff.push_back(IndexEnabledAircraftParts); }
if (this->isGndFlagEnabled() != globalSetup.isGndFlagEnabled()) { diff.push_back(IndexEnableGndFlag); }
if (this->isSendingGndFlagToSimulator() != globalSetup.isSendingGndFlagToSimulator()) { diff.push_back(IndexSendGndFlagToSimulator); }
if (this->isFixingSceneryOffset() != globalSetup.isForcingFullInterpolation()) { diff.push_back(IndexFixSceneryOffset); }
if (this->isFixingSceneryOffset() != globalSetup.isForcingVtolInterpolation()) { diff.push_back(IndexFixSceneryOffset); }
return diff;
}

View File

@@ -33,9 +33,8 @@ namespace BlackMisc
{
IndexLogInterpolation = CPropertyIndex::GlobalIndexCInterpolatioRenderingSetup,
IndexSimulatorDebugMessages,
IndexForceFullInterpolation,
IndexForceVtolInterpolation,
IndexSendGndFlagToSimulator,
IndexEnableGndFlag,
IndexEnabledAircraftParts,
IndexInterpolatorMode,
IndexInterpolatorModeAsString,
@@ -62,10 +61,10 @@ namespace BlackMisc
void setLogInterpolation(bool log) { m_logInterpolation = log; }
//! Full interpolation (skip optimizations like checking if aircraft moves etc.)
bool isForcingFullInterpolation() const { return m_forceFullInterpolation; }
bool isForcingVtolInterpolation() const { return m_forceVtolInterpolation; }
//! Force full interpolation
void setForceFullInterpolation(bool force) { m_forceFullInterpolation = force; }
void setForceVtolInterpolation(bool force) { m_forceVtolInterpolation = force; }
//! Set enabled aircraft parts
bool setEnabledAircraftParts(bool enabled);
@@ -76,12 +75,6 @@ namespace BlackMisc
//! Aircraft parts enabled (still requires the other aircraft to send parts)
bool isAircraftPartsEnabled() const { return m_enabledAircraftParts; }
//! Set gnd.flag enabled (aircraft supports gnd.flag)
bool setEnabledGndFLag(bool enabled);
//! Is gnd.flag enabled (aircraft supports gnd.flag)
bool isGndFlagEnabled() const { return m_enabledGndFlag; }
//! Send GND flag to simulator
bool isSendingGndFlagToSimulator() const { return m_sendGndToSim; }
@@ -130,9 +123,8 @@ namespace BlackMisc
bool m_logInterpolation = false; //!< Debug messages in interpolator
bool m_simulatorDebugMessages = false; //!< Debug messages of simulator (aka plugin)
bool m_forceFullInterpolation = false; //!< always do a full interpolation, even if aircraft is not moving
bool m_forceVtolInterpolation = false; //!< always do a full interpolation, even if aircraft is not moving
bool m_enabledAircraftParts = true; //!< Enable aircraft parts
bool m_enabledGndFlag = true; //!< Enable gnd.flag
bool m_sendGndToSim = true; //!< Send the gnd.flag to simulator
bool m_fixSceneryOffset = true; //!< Fix. scenery offset
int m_interpolatorMode = static_cast<int>(Spline); //!< interpolator mode (spline, ...)
@@ -213,10 +205,9 @@ namespace BlackMisc
CInterpolationAndRenderingSetupGlobal,
BLACK_METAMEMBER(logInterpolation),
BLACK_METAMEMBER(simulatorDebugMessages),
BLACK_METAMEMBER(forceFullInterpolation),
BLACK_METAMEMBER(forceVtolInterpolation),
BLACK_METAMEMBER(sendGndToSim),
BLACK_METAMEMBER(enabledAircraftParts),
BLACK_METAMEMBER(enabledGndFlag),
BLACK_METAMEMBER(fixSceneryOffset),
BLACK_METAMEMBER(interpolatorMode),
BLACK_METAMEMBER(maxRenderedAircraft),
@@ -273,10 +264,9 @@ namespace BlackMisc
CInterpolationAndRenderingSetupPerCallsign,
BLACK_METAMEMBER(logInterpolation),
BLACK_METAMEMBER(simulatorDebugMessages),
BLACK_METAMEMBER(forceFullInterpolation),
BLACK_METAMEMBER(forceVtolInterpolation),
BLACK_METAMEMBER(sendGndToSim),
BLACK_METAMEMBER(enabledAircraftParts),
BLACK_METAMEMBER(enabledGndFlag),
BLACK_METAMEMBER(fixSceneryOffset),
BLACK_METAMEMBER(interpolatorMode)
);

View File

@@ -72,11 +72,12 @@ namespace BlackMisc
}
template<typename Derived>
CAircraftSituationList CInterpolator<Derived>::remoteAircraftSituationsAndChange(bool useSceneryOffset)
CAircraftSituationList CInterpolator<Derived>::remoteAircraftSituationsAndChange(const CInterpolationAndRenderingSetupPerCallsign &setup)
{
const bool vtol = setup.isForcingVtolInterpolation() || m_model.isVtol();
CAircraftSituationList validSituations = this->remoteAircraftSituations(m_callsign);
m_currentSituationChange = CAircraftSituationChange(validSituations, m_model.getCG(), m_model.isVtol(), true, true);
if (useSceneryOffset && m_currentSituationChange.hasSceneryDeviation() && m_model.hasCG())
m_currentSituationChange = CAircraftSituationChange(validSituations, m_model.getCG(), vtol, true, true);
if (setup.isFixingSceneryOffset() && m_currentSituationChange.hasSceneryDeviation() && m_model.hasCG())
{
const CLength os = m_currentSituationChange.getGuessedSceneryDeviationCG();
m_currentSceneryOffset = os;
@@ -84,7 +85,7 @@ namespace BlackMisc
{
const CLength addValue = os * -1.0; // positive values means too high, negative values too low
int changed = validSituations.addAltitudeOffset(addValue);
m_currentSituationChange = CAircraftSituationChange(validSituations, m_model.getCG(), m_model.isVtol(), true, true); // recalculate
m_currentSituationChange = CAircraftSituationChange(validSituations, m_model.getCG(), vtol, true, true); // recalculate
Q_UNUSED(changed);
}
}
@@ -359,7 +360,7 @@ namespace BlackMisc
m_currentTimeMsSinceEpoch = currentTimeSinceEpoc;
m_situationsLastModified = this->situationsLastModified(m_callsign);
m_currentSetup = setup;
m_currentSituations = this->remoteAircraftSituationsAndChange(setup.isFixingSceneryOffset());
m_currentSituations = this->remoteAircraftSituationsAndChange(setup);
m_currentInterpolationStatus.reset();
m_currentPartsStatus.reset();

View File

@@ -263,7 +263,7 @@ namespace BlackMisc
//! Get situations and calculate change, also correct altitudes if applicable
//! \remark calculates offset (scenery) and situations change
Aviation::CAircraftSituationList remoteAircraftSituationsAndChange(bool useSceneryOffset);
Aviation::CAircraftSituationList remoteAircraftSituationsAndChange(const CInterpolationAndRenderingSetupPerCallsign &setup);
//! Center of gravity, fetched from provider in case needed
PhysicalQuantities::CLength getAndFetchModelCG();