mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-09 20:32:48 +02:00
making requested changes
This commit is contained in:
parent
6eb5a78611
commit
60dd7e49ab
7 changed files with 75 additions and 26 deletions
|
@ -24,6 +24,7 @@ Slider {
|
|||
|
||||
property alias minimumValue: slider.from
|
||||
property alias maximumValue: slider.to
|
||||
property alias step: slider.stepSize
|
||||
property bool tickmarksEnabled: false
|
||||
|
||||
height: hifi.fontSizes.textFieldInput + 14 // Match height of TextField control.
|
||||
|
|
|
@ -55,6 +55,7 @@ Preference {
|
|||
value: preference.value
|
||||
minimumValue: preference.min
|
||||
maximumValue: preference.max
|
||||
step: preference.step
|
||||
width: 130
|
||||
anchors {
|
||||
right: parent.right
|
||||
|
|
|
@ -29,7 +29,10 @@ Item {
|
|||
TabBar {
|
||||
id: bar
|
||||
spacing: 0
|
||||
anchors.top: controllerSettings.top
|
||||
width: parent.width
|
||||
height: 40
|
||||
z: 10
|
||||
|
||||
TabButton {
|
||||
height: parent.height
|
||||
|
@ -284,7 +287,7 @@ Item {
|
|||
anchors.fill: stackView
|
||||
id: controllerPrefereneces
|
||||
objectName: "TabletControllerPreferences"
|
||||
showCategories: ["VR Movement"]
|
||||
showCategories: ["VR Movement", "Game Controller", "Sixense Controllers", "Perception Neuron", "Leap Motion"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,6 @@ StackView {
|
|||
TabletPreferencesDialog {
|
||||
id: root
|
||||
objectName: "TabletGeneralPreferences"
|
||||
showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Game Controller", "Sixense Controllers", "Perception Neuron", "Kinect", "Leap Motion"]
|
||||
showCategories: ["User Interface", "HMD", "Snapshots", "Privacy"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,6 @@ Window {
|
|||
property var proxy: modelData;
|
||||
onClicked: proxy.clicked()
|
||||
Component.onCompleted: updateProperties()
|
||||
//menu button should be visible only in VR mode
|
||||
visible: text !== "MENU"
|
||||
|
||||
Connections {
|
||||
target: proxy;
|
||||
|
|
|
@ -58,39 +58,55 @@ void setupPreferences() {
|
|||
{
|
||||
static const float MAX_DESKTOP_FPS = 60;
|
||||
static const float MAX_HMD_FPS = 90;
|
||||
static const float MIN_HMD_FPS = 35;
|
||||
static const float LOW = 0.25f;
|
||||
static const float MEDIUM = 0.5f;
|
||||
static const float HIGH = 0.75f;
|
||||
auto getter = []()->float {
|
||||
auto lodManager = DependencyManager::get<LODManager>();
|
||||
float sliderValue = 0;
|
||||
bool inHMD = qApp->isHMDMode();
|
||||
|
||||
float increaseFPS = 0;
|
||||
if (inHMD) {
|
||||
float hmdMinFPS = lodManager->getHMDLODDecreaseFPS();
|
||||
sliderValue = (MAX_HMD_FPS - hmdMinFPS) / MAX_HMD_FPS;
|
||||
increaseFPS = lodManager->getHMDLODDecreaseFPS();
|
||||
} else {
|
||||
float desktopMinFPS = lodManager->getDesktopLODDecreaseFPS();
|
||||
sliderValue = (MAX_DESKTOP_FPS - desktopMinFPS) / MAX_DESKTOP_FPS;
|
||||
increaseFPS = lodManager->getDesktopLODDecreaseFPS();
|
||||
}
|
||||
return sliderValue;
|
||||
float maxFPS = inHMD ? MAX_HMD_FPS : MAX_DESKTOP_FPS;
|
||||
float percentage = increaseFPS / maxFPS;
|
||||
|
||||
if (percentage >= HIGH) {
|
||||
return HIGH;
|
||||
} else if (percentage >= LOW) {
|
||||
return MEDIUM;
|
||||
}
|
||||
return LOW;
|
||||
};
|
||||
|
||||
auto setter = [](float value) {
|
||||
static const float THRASHING_DIFFERENCE = 10;
|
||||
auto lodManager = DependencyManager::get<LODManager>();
|
||||
if (qApp->isHMDMode()) {
|
||||
float desiredHMDFPS = (MAX_HMD_FPS - (MAX_HMD_FPS * value)) - THRASHING_DIFFERENCE;
|
||||
float actualHMDFPS = desiredHMDFPS > MIN_HMD_FPS ? desiredHMDFPS : MIN_HMD_FPS;
|
||||
lodManager->setHMDLODDecreaseFPS(actualHMDFPS);
|
||||
|
||||
bool isMaxValue = value == HIGH;
|
||||
bool isHMDMode = qApp->isHMDMode();
|
||||
|
||||
float maxFPS = isHMDMode ? MAX_HMD_FPS : MAX_DESKTOP_FPS;
|
||||
float desiredFPS = maxFPS - THRASHING_DIFFERENCE;
|
||||
|
||||
if (!isMaxValue) {
|
||||
desiredFPS = (maxFPS * value) - THRASHING_DIFFERENCE;
|
||||
}
|
||||
|
||||
if (isHMDMode) {
|
||||
lodManager->setHMDLODDecreaseFPS(desiredFPS);
|
||||
} else {
|
||||
float desiredDesktopFPS = (MAX_DESKTOP_FPS - (MAX_DESKTOP_FPS * value)) - THRASHING_DIFFERENCE;
|
||||
lodManager->setDesktopLODDecreaseFPS(desiredDesktopFPS);
|
||||
lodManager->setDesktopLODDecreaseFPS(desiredFPS);
|
||||
}
|
||||
};
|
||||
|
||||
auto wodSlider = new SliderPreference(GRAPHICS_QUALITY, "World Detail", getter, setter);
|
||||
wodSlider->setMin(0);
|
||||
wodSlider->setMax(1);
|
||||
wodSlider->setStep(0.1f);
|
||||
wodSlider->setMin(0.25f);
|
||||
wodSlider->setMax(0.75f);
|
||||
wodSlider->setStep(0.25f);
|
||||
preferences->addPreference(wodSlider);
|
||||
|
||||
auto getterShadow = []()->bool {
|
||||
|
|
|
@ -9,17 +9,29 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
/* jslint bitwise: true */
|
||||
|
||||
/* global Script, HMD, Tablet, Entities */
|
||||
|
||||
var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png";
|
||||
// var HOME_BUTTON_TEXTURE = Script.resourcesPath() + "meshes/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png";
|
||||
|
||||
(function() {
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var button = tablet.addButton({
|
||||
var lastHMDStatus = false;
|
||||
var buttonProperties = {
|
||||
icon: "icons/tablet-icons/menu-i.svg",
|
||||
activeIcon: "icons/tablet-icons/menu-a.svg",
|
||||
text: "MENU",
|
||||
sortOrder: 3
|
||||
});
|
||||
};
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var button = null;
|
||||
|
||||
if (HMD.active) {
|
||||
button = tablet.addButton(buttonProperties);
|
||||
button.clicked.connect(onClicked);
|
||||
lastHMDStatus = true;
|
||||
}
|
||||
|
||||
var onMenuScreen = false;
|
||||
|
||||
|
@ -35,19 +47,37 @@ var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-
|
|||
}
|
||||
}
|
||||
|
||||
HMD.displayModeChanged.connect(function(isHMDMode) {
|
||||
if (lastHMDStatus !== isHMDMode) {
|
||||
if (isHMDMode) {
|
||||
button = tablet.addButton(buttonProperties);
|
||||
button.clicked.connect(onClicked);
|
||||
} else if (button) {
|
||||
button.clicked.disconnect(onClicked);
|
||||
tablet.removeButton(button);
|
||||
button = null;
|
||||
}
|
||||
lastHMDStatus = isHMDMode;
|
||||
}
|
||||
});
|
||||
|
||||
function onScreenChanged(type, url) {
|
||||
onMenuScreen = type === "Menu";
|
||||
button.editProperties({isActive: onMenuScreen});
|
||||
if (button) {
|
||||
button.editProperties({isActive: onMenuScreen});
|
||||
}
|
||||
}
|
||||
|
||||
button.clicked.connect(onClicked);
|
||||
tablet.screenChanged.connect(onScreenChanged);
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
if (onMenuScreen) {
|
||||
tablet.gotoHomeScreen();
|
||||
}
|
||||
button.clicked.disconnect(onClicked);
|
||||
|
||||
if (button) {
|
||||
button.clicked.disconnect(onClicked);
|
||||
}
|
||||
tablet.removeButton(button);
|
||||
tablet.screenChanged.disconnect(onScreenChanged);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue