History

fixing the graphics preference

Dante Ruiz committed 8 years ago

Commit 201b8a51 parent 2a6204c1 file · +37 −24Browse files

Showing the changes to interface/src/ui/PreferencesDialog.cpp (1 of 1 file). Show all

Unified · Split

interface/src/ui/PreferencesDialog.cpp+37−24
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515 #include <OffscreenUi.h>
1616 #include <Preferences.h>
1717 #include <QRandomGenerator>
18−#include <MessagesClient.h>
1918 #include <RenderShadowTask.h>
2019 #include <display-plugins/CompositorHelper.h>
2120
@@ -27,9 +26,6 @@ · 5 unmodified lines
2726 #include "SnapshotAnimated.h"
2827 #include "UserActivityLogger.h"
2928
30−#include "controllers/impl/MappingBuilderProxy.h"
31−#include "controllers/impl/RouteBuilderProxy.h"
32−
3329 void setupPreferences() {
3430 auto preferences = DependencyManager::get<Preferences>();
3531 auto nodeList = DependencyManager::get<NodeList>();
@@ -61,33 +57,50 @@ void setupPreferences() { · 25 unmodified lines
6157 // Graphics quality
6258 static const QString GRAPHICS_QUALITY { "Graphics Quality" };
6359 {
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+
6691 auto wodSlider = new SliderPreference(GRAPHICS_QUALITY, "World Detail", getter, setter);
6792 wodSlider->setMin(0);
68− wodSlider->setMax(2000);
93+ wodSlider->setMax(1);
94+ wodSlider->setStep(0.1);
6995 preferences->addPreference(wodSlider);
7096
7197 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);
81100 };
82101 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);
91104 };
92105 preferences->addPreference(new CheckPreference(GRAPHICS_QUALITY, "Show Shadows", getterShadow, setterShadow));
93106 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t