mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Finish all of the logic and most of the layout
This commit is contained in:
parent
2471a3eb72
commit
ce2b7e5baa
5 changed files with 235 additions and 9 deletions
|
@ -22,6 +22,7 @@ FocusScope {
|
|||
property alias editable: comboBox.editable
|
||||
property alias comboBox: comboBox
|
||||
readonly property alias currentText: comboBox.currentText;
|
||||
property alias displayText: comboBox.displayText;
|
||||
property alias currentIndex: comboBox.currentIndex;
|
||||
property int currentHighLightedIndex: comboBox.currentIndex;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import QtQuick.Layouts 1.12
|
|||
import stylesUit 1.0 as HifiStylesUit
|
||||
import controlsUit 1.0 as HifiControlsUit
|
||||
import "qrc:////qml//controls" as HifiControls
|
||||
import PerformanceEnums 1.0
|
||||
|
||||
Flickable {
|
||||
HifiStylesUit.HifiConstants { id: hifi; }
|
||||
|
@ -51,6 +52,7 @@ Flickable {
|
|||
ColumnLayout {
|
||||
Layout.topMargin: 10
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.preferredHeight: contentItem.height
|
||||
spacing: 0
|
||||
|
||||
HifiControlsUit.RadioButton {
|
||||
|
@ -62,6 +64,7 @@ Flickable {
|
|||
checked: Performance.getPerformancePreset() === PerformanceEnums.LOW
|
||||
onClicked: {
|
||||
Performance.setPerformancePreset(PerformanceEnums.LOW);
|
||||
root.refreshAllDropdowns();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,6 +77,7 @@ Flickable {
|
|||
checked: Performance.getPerformancePreset() === PerformanceEnums.MID
|
||||
onClicked: {
|
||||
Performance.setPerformancePreset(PerformanceEnums.MID);
|
||||
root.refreshAllDropdowns();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,6 +90,7 @@ Flickable {
|
|||
checked: Performance.getPerformancePreset() === PerformanceEnums.HIGH
|
||||
onClicked: {
|
||||
Performance.setPerformancePreset(PerformanceEnums.HIGH);
|
||||
root.refreshAllDropdowns();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,9 +100,9 @@ Flickable {
|
|||
fontSize: 16
|
||||
leftPadding: 0
|
||||
text: "Custom"
|
||||
checked: !(performanceLow.checked || performanceMedium.checked || performanceHigh.checked)
|
||||
checked: Performance.getPerformancePreset() === PerformanceEnums.UNKNOWN
|
||||
onClicked: {
|
||||
|
||||
Performance.setPerformancePreset(PerformanceEnums.UNKNOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +110,12 @@ Flickable {
|
|||
ColumnLayout {
|
||||
Layout.topMargin: 10
|
||||
Layout.preferredWidth: parent.width
|
||||
spacing: 0
|
||||
Layout.preferredHeight: contentItem.height
|
||||
spacing: 30
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.preferredHeight: 35
|
||||
|
||||
HifiStylesUit.RalewayRegular {
|
||||
id: resolutionHeader
|
||||
|
@ -116,7 +123,7 @@ Flickable {
|
|||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
width: 130
|
||||
height: paintedHeight
|
||||
height: parent.height
|
||||
size: 16
|
||||
color: "#FFFFFF"
|
||||
}
|
||||
|
@ -128,7 +135,7 @@ Flickable {
|
|||
anchors.leftMargin: 57
|
||||
anchors.top: parent.top
|
||||
width: 150
|
||||
height: resolutionHeader.height
|
||||
height: parent.height
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
minimumValue: 0.25
|
||||
maximumValue: 1.5
|
||||
|
@ -152,7 +159,218 @@ Flickable {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.preferredHeight: 35
|
||||
|
||||
HifiStylesUit.RalewayRegular {
|
||||
id: worldDetailHeader
|
||||
text: "World Detail"
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
width: 130
|
||||
height: parent.height
|
||||
size: 16
|
||||
color: "#FFFFFF"
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: worldDetailModel
|
||||
|
||||
ListElement {
|
||||
text: "Low World Detail"
|
||||
worldDetailQualityValue: 0.25
|
||||
}
|
||||
ListElement {
|
||||
text: "Medium World Detail"
|
||||
worldDetailQualityValue: 0.5
|
||||
}
|
||||
ListElement {
|
||||
text: "Full World Detail"
|
||||
worldDetailQualityValue: 0.75
|
||||
}
|
||||
}
|
||||
|
||||
HifiControlsUit.ComboBox {
|
||||
id: worldDetailDropdown
|
||||
enabled: performanceCustom.checked
|
||||
anchors.left: worldDetailHeader.right
|
||||
anchors.leftMargin: 20
|
||||
anchors.top: parent.top
|
||||
width: 280
|
||||
height: parent.height
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
model: worldDetailModel
|
||||
currentIndex: -1
|
||||
|
||||
function refreshWorldDetailDropdown() {
|
||||
var currentWorldDetailQuality = LODManager.worldDetailQuality;
|
||||
if (currentWorldDetailQuality <= 0.25) {
|
||||
worldDetailDropdown.currentIndex = 0;
|
||||
} else if (currentWorldDetailQuality <= 0.5) {
|
||||
worldDetailDropdown.currentIndex = 1;
|
||||
} else {
|
||||
worldDetailDropdown.currentIndex = 2;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
worldDetailDropdown.refreshWorldDetailDropdown();
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
LODManager.worldDetailQuality = model.get(currentIndex).worldDetailQualityValue;
|
||||
worldDetailDropdown.displayText = model.get(currentIndex).text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.preferredHeight: 35
|
||||
|
||||
HifiStylesUit.RalewayRegular {
|
||||
id: renderingEffectsHeader
|
||||
text: "Rendering Effects"
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
width: 130
|
||||
height: parent.height
|
||||
size: 16
|
||||
color: "#FFFFFF"
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: renderingEffectsModel
|
||||
|
||||
ListElement {
|
||||
text: "No Rendering Effects"
|
||||
preferredRenderMethod: 1 // "FORWARD"
|
||||
shadowsEnabled: false
|
||||
}
|
||||
ListElement {
|
||||
text: "Local Lights, Fog, Bloom"
|
||||
preferredRenderMethod: 0 // "DEFERRED"
|
||||
shadowsEnabled: false
|
||||
}
|
||||
ListElement {
|
||||
text: "Local Lights, Fog, Bloom, Shadows"
|
||||
preferredRenderMethod: 0 // "DEFERRED"
|
||||
shadowsEnabled: true
|
||||
}
|
||||
}
|
||||
|
||||
HifiControlsUit.ComboBox {
|
||||
id: renderingEffectsDropdown
|
||||
enabled: performanceCustom.checked
|
||||
anchors.left: renderingEffectsHeader.right
|
||||
anchors.leftMargin: 20
|
||||
anchors.top: parent.top
|
||||
width: 280
|
||||
height: parent.height
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
model: renderingEffectsModel
|
||||
currentIndex: -1
|
||||
|
||||
function refreshRenderingEffectsDropdownDisplay() {
|
||||
if (Render.shadowsEnabled) {
|
||||
renderingEffectsDropdown.currentIndex = 2;
|
||||
} else if (Render.renderMethod === 0) {
|
||||
renderingEffectsDropdown.currentIndex = 1;
|
||||
} else {
|
||||
renderingEffectsDropdown.currentIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
renderingEffectsDropdown.refreshRenderingEffectsDropdownDisplay();
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
var renderMethodToSet = 1;
|
||||
if (model.get(currentIndex).preferredRenderMethod === 0 &&
|
||||
PlatformInfo.isRenderMethodDeferredCapable()) {
|
||||
renderMethodToSet = 0;
|
||||
}
|
||||
Render.renderMethod = model.get(currentIndex).preferredRenderMethod;
|
||||
Render.shadowsEnabled = model.get(currentIndex).shadowsEnabled;
|
||||
renderingEffectsDropdown.displayText = model.get(currentIndex).text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.preferredHeight: 35
|
||||
|
||||
HifiStylesUit.RalewayRegular {
|
||||
id: refreshRateHeader
|
||||
text: "Refresh Rate"
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
width: 130
|
||||
height: parent.height
|
||||
size: 16
|
||||
color: "#FFFFFF"
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: refreshRateModel
|
||||
|
||||
ListElement {
|
||||
text: "Economical"
|
||||
refreshRatePreset: 0 // RefreshRateProfile::ECO
|
||||
}
|
||||
ListElement {
|
||||
text: "Interactive"
|
||||
refreshRatePreset: 1 // RefreshRateProfile::INTERACTIVE
|
||||
}
|
||||
ListElement {
|
||||
text: "Real-Time"
|
||||
refreshRatePreset: 2 // RefreshRateProfile::REALTIME
|
||||
}
|
||||
}
|
||||
|
||||
HifiControlsUit.ComboBox {
|
||||
id: refreshRateDropdown
|
||||
enabled: performanceCustom.checked
|
||||
anchors.left: refreshRateHeader.right
|
||||
anchors.leftMargin: 20
|
||||
anchors.top: parent.top
|
||||
width: 280
|
||||
height: parent.height
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
model: refreshRateModel
|
||||
currentIndex: -1
|
||||
|
||||
function refreshRefreshRateDropdownDisplay() {
|
||||
if (Performance.getRefreshRateProfile() === 0) {
|
||||
refreshRateDropdown.currentIndex = 0;
|
||||
} else if (Performance.getRefreshRateProfile() === 1) {
|
||||
refreshRateDropdown.currentIndex = 1;
|
||||
} else {
|
||||
refreshRateDropdown.currentIndex = 2;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
refreshRateDropdown.refreshRefreshRateDropdownDisplay();
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
Performance.setRefreshRateProfile(model.get(currentIndex).refreshRatePreset);
|
||||
refreshRateDropdown.displayText = model.get(currentIndex).text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function refreshAllDropdowns() {
|
||||
worldDetailDropdown.refreshWorldDetailDropdown();
|
||||
renderingEffectsDropdown.refreshRenderingEffectsDropdownDisplay();
|
||||
refreshRateDropdown.refreshRefreshRateDropdownDisplay();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
|
|||
RenderScriptingInterface::getInstance()->setShadowsEnabled(true);
|
||||
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME);
|
||||
|
||||
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.5f);
|
||||
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.75f);
|
||||
|
||||
break;
|
||||
case PerformancePreset::MID:
|
||||
|
@ -114,7 +114,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
|
|||
|
||||
RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommandedPpiScale);
|
||||
|
||||
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.75f);
|
||||
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.25f);
|
||||
|
||||
break;
|
||||
case PerformancePreset::UNKNOWN:
|
||||
|
|
|
@ -221,4 +221,6 @@ QStringList PlatformInfoScriptingInterface::getPlatformTierNames() {
|
|||
return platformTierNames;
|
||||
}
|
||||
|
||||
|
||||
bool PlatformInfoScriptingInterface::isRenderMethodDeferredCapable() {
|
||||
return platform::Profiler::isRenderMethodDeferredCapable();
|
||||
}
|
||||
|
|
|
@ -245,7 +245,12 @@ public slots:
|
|||
*/
|
||||
QStringList getPlatformTierNames();
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* Gets whether the current hardware can render using the Deferred method.
|
||||
* @function PlatformInfo.isRenderMethodDeferredCapable
|
||||
* @returns {bool} <code>true</code> if the current hardware can render using the Deferred method; <code>false</code> otherwise.
|
||||
*/
|
||||
bool isRenderMethodDeferredCapable();
|
||||
};
|
||||
|
||||
#endif // hifi_PlatformInfoScriptingInterface_h
|
||||
|
|
Loading…
Reference in a new issue