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

@@ -40,8 +40,7 @@ namespace BlackGui
ui->cb_DebugDriver->setChecked(setup.showSimulatorDebugMessages());
ui->cb_LogInterpolation->setChecked(setup.logInterpolation());
ui->cb_EnableParts->setChecked(setup.isAircraftPartsEnabled());
ui->cb_ForceFullInterpolation->setChecked(setup.isForcingFullInterpolation());
ui->cb_EnableGndFlag->setChecked(setup.isGndFlagEnabled());
ui->cb_ForceVtolInterpolation->setChecked(setup.isForcingVtolInterpolation());
ui->cb_SendGndFlagToSim->setChecked(setup.isSendingGndFlagToSimulator());
ui->cb_FixSceneryOffset->setChecked(setup.isFixingSceneryOffset());
@@ -54,8 +53,7 @@ namespace BlackGui
{
CInterpolationAndRenderingSetupPerCallsign setup;
setup.setEnabledAircraftParts(ui->cb_EnableParts->isChecked());
setup.setEnabledGndFLag(ui->cb_EnableGndFlag->isChecked());
setup.setForceFullInterpolation(ui->cb_ForceFullInterpolation->isChecked());
setup.setForceVtolInterpolation(ui->cb_ForceVtolInterpolation->isChecked());
setup.setLogInterpolation(ui->cb_LogInterpolation->isChecked());
setup.setSendingGndFlagToSimulator(ui->cb_SendGndFlagToSim->isChecked());
setup.setSimulatorDebuggingMessages(ui->cb_DebugDriver->isChecked());
@@ -69,8 +67,7 @@ namespace BlackGui
CGuiUtility::checkBoxReadOnly(ui->cb_DebugDriver, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_LogInterpolation, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_EnableParts, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_ForceFullInterpolation, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_EnableGndFlag, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_ForceVtolInterpolation, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_SendGndFlagToSim, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_FixSceneryOffset, readonly);
ui->co_InterpolatorMode->setEnabled(!readonly);

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>236</width>
<width>240</width>
<height>102</height>
</rect>
</property>
@@ -42,7 +42,34 @@
</item>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QCheckBox" name="cb_SendGndFlagToSim">
<property name="text">
<string>send gnd.to simulator</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="cb_ForceVtolInterpolation">
<property name="text">
<string>force VTOL interpolation</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="cb_FixSceneryOffset">
<property name="text">
<string>fix scenery offset</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="cb_EnableParts">
<property name="text">
<string>enable parts</string>
@@ -52,34 +79,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="cb_EnableGndFlag">
<property name="text">
<string>use (network) gnd.flag</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="cb_SendGndFlagToSim">
<property name="text">
<string>send gnd.to simulator</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="cb_ForceFullInterpolation">
<property name="text">
<string>force full interpolation</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="cb_FixSceneryOffset">
<property name="text">
<string>fix scenery offset</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@@ -27,10 +27,9 @@ namespace BlackGui
m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", CInterpolationAndRenderingSetupPerCallsign::IndexCallsign, CCallsign::IndexCallsignString));
this->m_columns.addColumn(CColumn::standardString("interpolator", CInterpolationAndRenderingSetupPerCallsign::IndexInterpolatorModeAsString));
m_columns.addColumn(CColumn("parts", "aircraft parts", CInterpolationAndRenderingSetupPerCallsign::IndexEnabledAircraftParts, new CBoolIconFormatter("parts", "aircraft parts")));
m_columns.addColumn(CColumn("en.gnd.", "enable gnd (network)", CInterpolationAndRenderingSetupPerCallsign::IndexEnableGndFlag, new CBoolIconFormatter("en.gnd.", "enable gnd.")));
m_columns.addColumn(CColumn("send gnd.", "send gnd.", CInterpolationAndRenderingSetupPerCallsign::IndexSendGndFlagToSimulator, new CBoolIconFormatter("send gnd.", "send gnd.")));
m_columns.addColumn(CColumn("sc.os.", "fix scenery offset", CInterpolationAndRenderingSetupPerCallsign::IndexFixSceneryOffset, new CBoolIconFormatter("sc.os.", "fix scenery offset")));
m_columns.addColumn(CColumn("full", "full int.", CInterpolationAndRenderingSetupPerCallsign::IndexForceFullInterpolation, new CBoolIconFormatter("full", "full int.")));
m_columns.addColumn(CColumn("VTOL", "VTOL interpolstion", CInterpolationAndRenderingSetupPerCallsign::IndexForceVtolInterpolation, new CBoolIconFormatter("VTOL", "VTOL interpolation")));
m_columns.addColumn(CColumn("sim.dbg.", "simulator debug", CInterpolationAndRenderingSetupPerCallsign::IndexSimulatorDebugMessages, new CBoolIconFormatter("sim.dbg.", "simulator debug")));
m_columns.addColumn(CColumn("log.int.", "log.interpolation", CInterpolationAndRenderingSetupPerCallsign::IndexLogInterpolation, new CBoolIconFormatter("log.int.", "log.interpolation")));
// default sort order

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();