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
15#include <OffscreenUi.h>15#include <OffscreenUi.h>
16#include <Preferences.h>16#include <Preferences.h>
17#include <QRandomGenerator>17#include <QRandomGenerator>
18#include <MessagesClient.h>
19#include <RenderShadowTask.h>18#include <RenderShadowTask.h>
20#include <display-plugins/CompositorHelper.h>19#include <display-plugins/CompositorHelper.h>
21 20
@@ -27,9 +26,6 @@ · 5 unmodified lines
27#include "SnapshotAnimated.h"26#include "SnapshotAnimated.h"
28#include "UserActivityLogger.h"27#include "UserActivityLogger.h"
29 28
30#include "controllers/impl/MappingBuilderProxy.h"
31#include "controllers/impl/RouteBuilderProxy.h"
32
33void setupPreferences() {29void setupPreferences() {
34 auto preferences = DependencyManager::get<Preferences>();30 auto preferences = DependencyManager::get<Preferences>();
35 auto nodeList = DependencyManager::get<NodeList>();31 auto nodeList = DependencyManager::get<NodeList>();
@@ -61,33 +57,50 @@ void setupPreferences() { · 25 unmodified lines
61 // Graphics quality57 // Graphics quality
62 static const QString GRAPHICS_QUALITY { "Graphics Quality" };58 static const QString GRAPHICS_QUALITY { "Graphics Quality" };
63 {59 {
64 auto getter = []()->float { return DependencyManager::get<LODManager>()->getOctreeSizeScale()/TREE_SCALE; };60 static const float MAX_DESKTOP_FPS = 60;
65 auto setter = [](float value) { DependencyManager::get<LODManager>()->setOctreeSizeScale(value*TREE_SCALE); };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 auto wodSlider = new SliderPreference(GRAPHICS_QUALITY, "World Detail", getter, setter);91 auto wodSlider = new SliderPreference(GRAPHICS_QUALITY, "World Detail", getter, setter);
67 wodSlider->setMin(0);92 wodSlider->setMin(0);
68 wodSlider->setMax(2000);93 wodSlider->setMax(1);
94 wodSlider->setStep(0.1);
69 preferences->addPreference(wodSlider);95 preferences->addPreference(wodSlider);
70 96
71 auto getterShadow = []()->bool {97 auto getterShadow = []()->bool {
72 bool ret = false;98 auto menu = Menu::getInstance();
73 auto renderConfig = qApp->getRenderEngine()->getConfiguration();99 return menu->isOptionChecked(MenuOption::Shadows);
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;
81 };100 };
82 auto setterShadow = [](bool value) {101 auto setterShadow = [](bool value) {
83 auto renderConfig = qApp->getRenderEngine()->getConfiguration();102 auto menu = Menu::getInstance();
84 if (renderConfig) {103 menu->setIsOptionChecked(MenuOption::Shadows, value);
85 auto mainViewShadowTaskConfig = renderConfig->getConfig<RenderShadowTask>("RenderMainView.RenderShadowTask");
86 if (mainViewShadowTaskConfig) {
87 mainViewShadowTaskConfig->setPreset(value ? QStringLiteral("Enabled")
88 : QStringLiteral("None"));
89 }
90 }
91 };104 };
92 preferences->addPreference(new CheckPreference(GRAPHICS_QUALITY, "Show Shadows", getterShadow, setterShadow));105 preferences->addPreference(new CheckPreference(GRAPHICS_QUALITY, "Show Shadows", getterShadow, setterShadow));
93 }106 }

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