diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ad6a0d86ce..daf2a76f5f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1786,6 +1786,7 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa void Application::loadSettings() { DependencyManager::get()->loadSettings(); + DependencyManager::get()->loadSettings(); Menu::getInstance()->loadSettings(); _myAvatar->loadData(); @@ -1793,6 +1794,7 @@ void Application::loadSettings() { void Application::saveSettings() { DependencyManager::get()->saveSettings(); + DependencyManager::get()->saveSettings(); Menu::getInstance()->saveSettings(); _myAvatar->saveData(); diff --git a/interface/src/LODManager.cpp b/interface/src/LODManager.cpp index 739e5f280a..5c55952e3a 100644 --- a/interface/src/LODManager.cpp +++ b/interface/src/LODManager.cpp @@ -17,11 +17,8 @@ #include "LODManager.h" -Setting::Handle automaticLODAdjust("automaticLODAdjust", true); Setting::Handle desktopLODDecreaseFPS("desktopLODDecreaseFPS", DEFAULT_DESKTOP_LOD_DOWN_FPS); -Setting::Handle desktopLODIncreaseFPS("desktopLODIncreaseFPS", DEFAULT_DESKTOP_LOD_UP_FPS); Setting::Handle hmdLODDecreaseFPS("hmdLODDecreaseFPS", DEFAULT_HMD_LOD_DOWN_FPS); -Setting::Handle hmdLODIncreaseFPS("hmdLODIncreaseFPS", DEFAULT_HMD_LOD_UP_FPS); Setting::Handle avatarLODDistanceMultiplier("avatarLODDistanceMultiplier", @@ -244,11 +241,8 @@ void LODManager::setBoundaryLevelAdjust(int boundaryLevelAdjust) { void LODManager::loadSettings() { - setAutomaticLODAdjust(automaticLODAdjust.get()); setDesktopLODDecreaseFPS(desktopLODDecreaseFPS.get()); - setDesktopLODIncreaseFPS(desktopLODIncreaseFPS.get()); setHMDLODDecreaseFPS(hmdLODDecreaseFPS.get()); - setHMDLODIncreaseFPS(hmdLODIncreaseFPS.get()); setAvatarLODDistanceMultiplier(avatarLODDistanceMultiplier.get()); setBoundaryLevelAdjust(boundaryLevelAdjust.get()); @@ -256,11 +250,8 @@ void LODManager::loadSettings() { } void LODManager::saveSettings() { - automaticLODAdjust.set(getAutomaticLODAdjust()); desktopLODDecreaseFPS.set(getDesktopLODDecreaseFPS()); - desktopLODIncreaseFPS.set(getDesktopLODIncreaseFPS()); hmdLODDecreaseFPS.set(getHMDLODDecreaseFPS()); - hmdLODIncreaseFPS.set(getHMDLODIncreaseFPS()); avatarLODDistanceMultiplier.set(getAvatarLODDistanceMultiplier()); boundaryLevelAdjust.set(getBoundaryLevelAdjust()); diff --git a/interface/src/LODManager.h b/interface/src/LODManager.h index 57b03cba42..7d63fbd172 100644 --- a/interface/src/LODManager.h +++ b/interface/src/LODManager.h @@ -18,9 +18,8 @@ #include const float DEFAULT_DESKTOP_LOD_DOWN_FPS = 30.0; -const float DEFAULT_DESKTOP_LOD_UP_FPS = 50.0; const float DEFAULT_HMD_LOD_DOWN_FPS = 60.0; -const float DEFAULT_HMD_LOD_UP_FPS = 65.0; +const float INCREASE_LOD_GAP = 5.0f; const quint64 ADJUST_LOD_DOWN_DELAY = 1000 * 1000 * 0.5; // Consider adjusting LOD down after half a second const quint64 ADJUST_LOD_UP_DELAY = ADJUST_LOD_DOWN_DELAY * 2; @@ -53,13 +52,11 @@ public: Q_INVOKABLE void setDesktopLODDecreaseFPS(float value) { _desktopLODDecreaseFPS = value; } Q_INVOKABLE float getDesktopLODDecreaseFPS() const { return _desktopLODDecreaseFPS; } - Q_INVOKABLE void setDesktopLODIncreaseFPS(float value) { _desktopLODIncreaseFPS = value; } - Q_INVOKABLE float getDesktopLODIncreaseFPS() const { return _desktopLODIncreaseFPS; } + Q_INVOKABLE float getDesktopLODIncreaseFPS() const { return _desktopLODDecreaseFPS + INCREASE_LOD_GAP; } Q_INVOKABLE void setHMDLODDecreaseFPS(float value) { _hmdLODDecreaseFPS = value; } Q_INVOKABLE float getHMDLODDecreaseFPS() const { return _hmdLODDecreaseFPS; } - Q_INVOKABLE void setHMDLODIncreaseFPS(float value) { _hmdLODIncreaseFPS = value; } - Q_INVOKABLE float getHMDLODIncreaseFPS() const { return _hmdLODIncreaseFPS; } + Q_INVOKABLE float getHMDLODIncreaseFPS() const { return _hmdLODDecreaseFPS + INCREASE_LOD_GAP; } Q_INVOKABLE void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier = multiplier; } Q_INVOKABLE float getAvatarLODDistanceMultiplier() const { return _avatarLODDistanceMultiplier; } @@ -94,9 +91,7 @@ private: bool _automaticLODAdjust = true; float _desktopLODDecreaseFPS = DEFAULT_DESKTOP_LOD_DOWN_FPS; - float _desktopLODIncreaseFPS = DEFAULT_DESKTOP_LOD_UP_FPS; float _hmdLODDecreaseFPS = DEFAULT_HMD_LOD_DOWN_FPS; - float _hmdLODIncreaseFPS = DEFAULT_HMD_LOD_UP_FPS; float _avatarLODDistanceMultiplier = DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER; diff --git a/interface/src/ui/LodToolsDialog.cpp b/interface/src/ui/LodToolsDialog.cpp index af434d5565..7635012bc2 100644 --- a/interface/src/ui/LodToolsDialog.cpp +++ b/interface/src/ui/LodToolsDialog.cpp @@ -50,26 +50,6 @@ LodToolsDialog::LodToolsDialog(QWidget* parent) : _automaticLODAdjust->setChecked(lodManager->getAutomaticLODAdjust()); connect(_automaticLODAdjust, SIGNAL(toggled(bool)), SLOT(updateAutomaticLODAdjust())); - form->addRow("Desktop Decrease LOD Below FPS:", _desktopLODDecreaseFPS = new QDoubleSpinBox(this)); - _desktopLODDecreaseFPS->setValue(lodManager->getDesktopLODDecreaseFPS()); - _desktopLODDecreaseFPS->setDecimals(0); - connect(_desktopLODDecreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateLODValues())); - - form->addRow("Desktop Increase LOD Above FPS:", _desktopLODIncreaseFPS = new QDoubleSpinBox(this)); - _desktopLODIncreaseFPS->setValue(lodManager->getDesktopLODIncreaseFPS()); - _desktopLODIncreaseFPS->setDecimals(0); - connect(_desktopLODIncreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateLODValues())); - - form->addRow("HMD Decrease LOD Below FPS:", _hmdLODDecreaseFPS = new QDoubleSpinBox(this)); - _hmdLODDecreaseFPS->setValue(lodManager->getHMDLODDecreaseFPS()); - _hmdLODDecreaseFPS->setDecimals(0); - connect(_hmdLODDecreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateLODValues())); - - form->addRow("HMD Increase LOD Above FPS:", _hmdLODIncreaseFPS = new QDoubleSpinBox(this)); - _hmdLODIncreaseFPS->setValue(lodManager->getHMDLODIncreaseFPS()); - _hmdLODIncreaseFPS->setDecimals(0); - connect(_hmdLODIncreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateLODValues())); - form->addRow("Avatar LOD:", _avatarLOD = new QDoubleSpinBox(this)); _avatarLOD->setDecimals(3); _avatarLOD->setRange(1.0 / MAXIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER, 1.0 / MINIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER); @@ -123,12 +103,6 @@ void LodToolsDialog::updateLODValues() { auto lodManager = DependencyManager::get(); lodManager->setAutomaticLODAdjust(_automaticLODAdjust->isChecked()); - - lodManager->setDesktopLODDecreaseFPS(_desktopLODDecreaseFPS->value()); - lodManager->setDesktopLODIncreaseFPS(_desktopLODIncreaseFPS->value()); - lodManager->setHMDLODDecreaseFPS(_hmdLODDecreaseFPS->value()); - lodManager->setHMDLODIncreaseFPS(_hmdLODIncreaseFPS->value()); - lodManager->setAvatarLODDistanceMultiplier(1.0 / _avatarLOD->value()); } @@ -145,11 +119,6 @@ void LodToolsDialog::resetClicked(bool checked) { int sliderValue = DEFAULT_OCTREE_SIZE_SCALE / TREE_SCALE; _lodSize->setValue(sliderValue); _automaticLODAdjust->setChecked(true); - _desktopLODDecreaseFPS->setValue(DEFAULT_DESKTOP_LOD_DOWN_FPS); - _desktopLODIncreaseFPS->setValue(DEFAULT_DESKTOP_LOD_UP_FPS); - _hmdLODDecreaseFPS->setValue(DEFAULT_HMD_LOD_DOWN_FPS); - _hmdLODIncreaseFPS->setValue(DEFAULT_HMD_LOD_UP_FPS); - _avatarLOD->setValue(1.0 / DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER); updateLODValues(); // tell our LOD manager about the reset diff --git a/interface/src/ui/LodToolsDialog.h b/interface/src/ui/LodToolsDialog.h index 2e85b3f5a5..709357fddd 100644 --- a/interface/src/ui/LodToolsDialog.h +++ b/interface/src/ui/LodToolsDialog.h @@ -47,10 +47,8 @@ private: QCheckBox* _automaticLODAdjust; QDoubleSpinBox* _desktopLODDecreaseFPS; - QDoubleSpinBox* _desktopLODIncreaseFPS; QDoubleSpinBox* _hmdLODDecreaseFPS; - QDoubleSpinBox* _hmdLODIncreaseFPS; QDoubleSpinBox* _avatarLOD; diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index fa63079290..a07de371a2 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -19,6 +19,7 @@ #include "Application.h" #include "MainWindow.h" +#include "LODManager.h" #include "Menu.h" #include "ModelsBrowser.h" #include "PreferencesDialog.h" @@ -174,6 +175,10 @@ void PreferencesDialog::loadPreferences() { ui.sixenseReticleMoveSpeedSpin->setValue(sixense.getReticleMoveSpeed()); ui.invertSixenseButtonsCheckBox->setChecked(sixense.getInvertButtons()); + // LOD items + auto lodManager = DependencyManager::get(); + ui.desktopMinimumFPSSpin->setValue(lodManager->getDesktopLODDecreaseFPS()); + ui.hmdMinimumFPSSpin->setValue(lodManager->getHMDLODDecreaseFPS()); } void PreferencesDialog::savePreferences() { @@ -275,4 +280,9 @@ void PreferencesDialog::savePreferences() { audio->setOutputStarveDetectionPeriod(ui.outputStarveDetectionPeriodSpinner->value()); Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height()); + + // LOD items + auto lodManager = DependencyManager::get(); + lodManager->setDesktopLODDecreaseFPS(ui.desktopMinimumFPSSpin->value()); + lodManager->setHMDLODDecreaseFPS(ui.hmdMinimumFPSSpin->value()); } diff --git a/interface/ui/preferencesDialog.ui b/interface/ui/preferencesDialog.ui index 13894a2592..d295d094c2 100644 --- a/interface/ui/preferencesDialog.ui +++ b/interface/ui/preferencesDialog.ui @@ -701,6 +701,219 @@ + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + Arial + 18 + 75 + true + + + + color:#29967e + + + Level of Detail Tuning + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + + + + Minimum Desktop FPS + + + 0 + + + + + + + + + Arial + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + 100 + 0 + + + + + 95 + 36 + + + + + Arial + + + + 0 + + + 120 + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + + + + Minimum HMD FPS + + + 0 + + + + + + + + + Arial + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + 100 + 0 + + + + + 95 + 36 + + + + + Arial + + + + 0 + + + 120 + + + + + + + @@ -717,6 +930,7 @@ + @@ -738,6 +952,7 @@ + @@ -820,6 +1035,9 @@ + + +