Showing the changes to interface/src/ui/PreferencesDialog.cpp (1 of 1 file). Show all
Unified · Split
| @@ -15,7 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <OffscreenUi.h> |
| 16 | 16 | #include <Preferences.h> |
| 17 | 17 | #include <QRandomGenerator> |
| 18 | −#include <MessagesClient.h> | |
| 19 | 18 | #include <RenderShadowTask.h> |
| 20 | 19 | #include <display-plugins/CompositorHelper.h> |
| 21 | 20 | |
| @@ -27,9 +26,6 @@ · 5 unmodified lines | ||
| 27 | 26 | #include "SnapshotAnimated.h" |
| 28 | 27 | #include "UserActivityLogger.h" |
| 29 | 28 | |
| 30 | −#include "controllers/impl/MappingBuilderProxy.h" | |
| 31 | −#include "controllers/impl/RouteBuilderProxy.h" | |
| 32 | − | |
| 33 | 29 | void setupPreferences() { |
| 34 | 30 | auto preferences = DependencyManager::get<Preferences>(); |
| 35 | 31 | auto nodeList = DependencyManager::get<NodeList>(); |
| @@ -61,33 +57,50 @@ void setupPreferences() { · 25 unmodified lines | ||
| 61 | 57 | // Graphics quality |
| 62 | 58 | static const QString GRAPHICS_QUALITY { "Graphics Quality" }; |
| 63 | 59 | { |
| 64 | − auto getter = []()->float { return DependencyManager::get<LODManager>()->getOctreeSizeScale()/TREE_SCALE; }; | |
| 65 | − auto setter = [](float value) { DependencyManager::get<LODManager>()->setOctreeSizeScale(value*TREE_SCALE); }; | |
| 60 | + static const float MAX_DESKTOP_FPS = 60; | |
| 61 | + static const float MAX_HMD_FPS = 90; | |
| 62 | + static const float MIN_HMD_FPS = 35; | |
| 63 | + auto getter = []()->float { | |
| 64 | + auto lodManager = DependencyManager::get<LODManager>(); | |
| 65 | + float sliderValue = 0; | |
| 66 | + bool inHMD = qApp->isHMDMode(); | |
| 67 | + | |
| 68 | + if (inHMD) { | |
| 69 | + float hmdMinFPS = lodManager->getHMDLODDecreaseFPS(); | |
| 70 | + sliderValue = (MAX_HMD_FPS - hmdMinFPS) / MAX_HMD_FPS; | |
| 71 | + } else { | |
| 72 | + float desktopMinFPS = lodManager->getDesktopLODDecreaseFPS(); | |
| 73 | + sliderValue = (MAX_DESKTOP_FPS - desktopMinFPS) / MAX_DESKTOP_FPS; | |
| 74 | + } | |
| 75 | + return sliderValue; | |
| 76 | + }; | |
| 77 | + | |
| 78 | + auto setter = [](float value) { | |
| 79 | + static const float THRASHING_DIFFERENCE = 10; | |
| 80 | + auto lodManager = DependencyManager::get<LODManager>(); | |
| 81 | + if (qApp->isHMDMode()) { | |
| 82 | + float desiredHMDFPS = (MAX_HMD_FPS - (MAX_HMD_FPS * value)) - THRASHING_DIFFERENCE; | |
| 83 | + float actualHMDFPS = desiredHMDFPS > MIN_HMD_FPS ? desiredHMDFPS : MIN_HMD_FPS; | |
| 84 | + lodManager->setHMDLODDecreaseFPS(actualHMDFPS); | |
| 85 | + } else { | |
| 86 | + float desiredDesktopFPS = (MAX_DESKTOP_FPS - (MAX_DESKTOP_FPS * value)) - THRASHING_DIFFERENCE; | |
| 87 | + lodManager->setDesktopLODDecreaseFPS(desiredDesktopFPS); | |
| 88 | + } | |
| 89 | + }; | |
| 90 | + | |
| 66 | 91 | auto wodSlider = new SliderPreference(GRAPHICS_QUALITY, "World Detail", getter, setter); |
| 67 | 92 | wodSlider->setMin(0); |
| 68 | − wodSlider->setMax(2000); | |
| 93 | + wodSlider->setMax(1); | |
| 94 | + wodSlider->setStep(0.1); | |
| 69 | 95 | preferences->addPreference(wodSlider); |
| 70 | 96 | |
| 71 | 97 | auto getterShadow = []()->bool { |
| 72 | − bool ret = false; | |
| 73 | − auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | |
| 74 | − if (renderConfig) { | |
| 75 | − auto mainViewShadowTaskConfig = renderConfig->getConfig<RenderShadowTask>("RenderMainView.RenderShadowTask"); | |
| 76 | − if (mainViewShadowTaskConfig) { | |
| 77 | − ret = (mainViewShadowTaskConfig->getPreset() == QStringLiteral("Enabled")); | |
| 78 | − } | |
| 79 | − } | |
| 80 | − return ret; | |
| 98 | + auto menu = Menu::getInstance(); | |
| 99 | + return menu->isOptionChecked(MenuOption::Shadows); | |
| 81 | 100 | }; |
| 82 | 101 | auto setterShadow = [](bool value) { |
| 83 | − auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | |
| 84 | − if (renderConfig) { | |
| 85 | − auto mainViewShadowTaskConfig = renderConfig->getConfig<RenderShadowTask>("RenderMainView.RenderShadowTask"); | |
| 86 | − if (mainViewShadowTaskConfig) { | |
| 87 | − mainViewShadowTaskConfig->setPreset(value ? QStringLiteral("Enabled") | |
| 88 | − : QStringLiteral("None")); | |
| 89 | − } | |
| 90 | − } | |
| 102 | + auto menu = Menu::getInstance(); | |
| 103 | + menu->setIsOptionChecked(MenuOption::Shadows, value); | |
| 91 | 104 | }; |
| 92 | 105 | preferences->addPreference(new CheckPreference(GRAPHICS_QUALITY, "Show Shadows", getterShadow, setterShadow)); |
| 93 | 106 | } |