Added supersampling profiles.
This commit is contained in:
@@ -146,6 +146,43 @@ MyStackViewPage {
|
||||
Layout.leftMargin: 80
|
||||
spacing: 18
|
||||
|
||||
RowLayout {
|
||||
spacing: 18
|
||||
|
||||
MyText {
|
||||
text: "Supersampling Profile:"
|
||||
}
|
||||
|
||||
MyComboBox {
|
||||
id: summarySteamVRProfileComboBox
|
||||
Layout.maximumWidth: 378
|
||||
Layout.minimumWidth: 378
|
||||
Layout.preferredWidth: 378
|
||||
Layout.fillWidth: true
|
||||
model: [""]
|
||||
onCurrentIndexChanged: {
|
||||
if (currentIndex > 0) {
|
||||
summarySteamVRProfileApplyButton.enabled = true
|
||||
} else {
|
||||
summarySteamVRProfileApplyButton.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MyPushButton {
|
||||
id: summarySteamVRProfileApplyButton
|
||||
enabled: false
|
||||
Layout.preferredWidth: 150
|
||||
text: "Apply"
|
||||
onClicked: {
|
||||
if (summarySteamVRProfileComboBox.currentIndex > 0) {
|
||||
SteamVRTabController.applySteamVRProfile(summarySteamVRProfileComboBox.currentIndex - 1)
|
||||
summarySteamVRProfileComboBox.currentIndex = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 18
|
||||
|
||||
@@ -155,6 +192,7 @@ MyStackViewPage {
|
||||
|
||||
MyComboBox {
|
||||
id: summaryChaperoneProfileComboBox
|
||||
Layout.leftMargin: 47
|
||||
Layout.maximumWidth: 378
|
||||
Layout.minimumWidth: 378
|
||||
Layout.preferredWidth: 378
|
||||
@@ -325,7 +363,7 @@ MyStackViewPage {
|
||||
spacing: 18
|
||||
|
||||
MyComboBox {
|
||||
Layout.leftMargin: 33
|
||||
Layout.leftMargin: 78
|
||||
id: summaryPttProfileComboBox
|
||||
Layout.maximumWidth: 378
|
||||
Layout.minimumWidth: 378
|
||||
@@ -375,6 +413,7 @@ MyStackViewPage {
|
||||
|
||||
Component.onCompleted: {
|
||||
reloadChaperoneProfiles()
|
||||
reloadSteamVRProfiles()
|
||||
reloadPttProfiles()
|
||||
summaryVersionText.text = applicationVersion
|
||||
if (MoveCenterTabController.trackingUniverse === 0) {
|
||||
@@ -400,6 +439,13 @@ MyStackViewPage {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SteamVRTabController
|
||||
onSteamVRProfilesUpdated: {
|
||||
reloadSteamVRProfiles()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: AudioTabController
|
||||
onPttProfilesUpdated: {
|
||||
@@ -478,6 +524,17 @@ MyStackViewPage {
|
||||
summaryChaperoneProfileComboBox.model = profiles
|
||||
}
|
||||
|
||||
|
||||
function reloadSteamVRProfiles() {
|
||||
var profiles = [""]
|
||||
var profileCount = SteamVRTabController.getSteamVRProfileCount()
|
||||
for (var i = 0; i < profileCount; i++) {
|
||||
profiles.push(SteamVRTabController.getSteamVRProfileName(i))
|
||||
}
|
||||
summarySteamVRProfileComboBox.currentIndex = 0
|
||||
summarySteamVRProfileComboBox.model = profiles
|
||||
}
|
||||
|
||||
function reloadPttProfiles() {
|
||||
var profiles = [""]
|
||||
var profileCount = AudioTabController.getPttProfileCount()
|
||||
|
||||
@@ -7,9 +7,172 @@ MyStackViewPage {
|
||||
id: myStackViewPage1
|
||||
headerText: "SteamVR Settings"
|
||||
|
||||
|
||||
MyDialogOkPopup {
|
||||
id: steamvrMessageDialog
|
||||
function showMessage(title, text) {
|
||||
dialogTitle = title
|
||||
dialogText = text
|
||||
open()
|
||||
}
|
||||
}
|
||||
|
||||
MyDialogOkCancelPopup {
|
||||
id: steamvrDeleteProfileDialog
|
||||
property int profileIndex: -1
|
||||
dialogTitle: "Delete Profile"
|
||||
dialogText: "Do you really want to delete this profile?"
|
||||
onClosed: {
|
||||
if (okClicked) {
|
||||
SteamVRTabController.deleteSteamVRProfile(profileIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MyDialogOkCancelPopup {
|
||||
id: steamvrNewProfileDialog
|
||||
dialogTitle: "Create New Profile"
|
||||
dialogWidth: 600
|
||||
dialogHeight: 400
|
||||
dialogContentItem: ColumnLayout {
|
||||
RowLayout {
|
||||
Layout.topMargin: 16
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
MyText {
|
||||
text: "Name: "
|
||||
}
|
||||
MyTextField {
|
||||
id: steamvrNewProfileName
|
||||
keyBoardUID: 490
|
||||
color: "#cccccc"
|
||||
text: ""
|
||||
Layout.fillWidth: true
|
||||
font.pointSize: 20
|
||||
function onInputEvent(input) {
|
||||
steamvrNewProfileName.text = input
|
||||
}
|
||||
}
|
||||
}
|
||||
MyText {
|
||||
Layout.topMargin: 24
|
||||
text: "What to include:"
|
||||
}
|
||||
MyToggleButton {
|
||||
id: steamvrNewProfileIncludeSupersampling
|
||||
Layout.leftMargin: 32
|
||||
text: "Application Supersampling"
|
||||
}
|
||||
MyToggleButton {
|
||||
id: steamvrNewProfileIncludeSupersampleFiltering
|
||||
Layout.leftMargin: 32
|
||||
text: "Supersample Filtering"
|
||||
}
|
||||
MyToggleButton {
|
||||
id: steamvrNewProfileIncludeReprojectionSettingsg
|
||||
Layout.leftMargin: 32
|
||||
text: "Reprojection Settings"
|
||||
}
|
||||
}
|
||||
onClosed: {
|
||||
if (okClicked) {
|
||||
if (steamvrNewProfileName.text == "") {
|
||||
steamvrMessageDialog.showMessage("Create New Profile", "ERROR: Empty profile name.")
|
||||
} else if (!steamvrNewProfileIncludeSupersampling.checked
|
||||
&& !steamvrNewProfileIncludeSupersampleFiltering.checked
|
||||
&& !steamvrNewProfileIncludeReprojectionSettingsg.checked) {
|
||||
steamvrMessageDialog.showMessage("Create New Profile", "ERROR: Nothing included.")
|
||||
} else {
|
||||
SteamVRTabController.addSteamVRProfile(steamvrNewProfileName.text,
|
||||
steamvrNewProfileIncludeSupersampling.checked,
|
||||
steamvrNewProfileIncludeSupersampleFiltering.checked,
|
||||
steamvrNewProfileIncludeReprojectionSettingsg.checked)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function openPopup() {
|
||||
steamvrNewProfileName.text = ""
|
||||
steamvrNewProfileIncludeSupersampling.checked = false
|
||||
steamvrNewProfileIncludeSupersampleFiltering.checked = false
|
||||
steamvrNewProfileIncludeReprojectionSettingsg.checked = false
|
||||
open()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
content: ColumnLayout {
|
||||
spacing: 18
|
||||
|
||||
ColumnLayout {
|
||||
Layout.bottomMargin: 32
|
||||
spacing: 18
|
||||
RowLayout {
|
||||
spacing: 18
|
||||
|
||||
MyText {
|
||||
text: "Profile:"
|
||||
}
|
||||
|
||||
MyComboBox {
|
||||
id: steamvrProfileComboBox
|
||||
Layout.maximumWidth: 799
|
||||
Layout.minimumWidth: 799
|
||||
Layout.preferredWidth: 799
|
||||
Layout.fillWidth: true
|
||||
model: [""]
|
||||
onCurrentIndexChanged: {
|
||||
if (currentIndex > 0) {
|
||||
steamvrApplyProfileButton.enabled = true
|
||||
steamvrDeleteProfileButton.enabled = true
|
||||
} else {
|
||||
steamvrApplyProfileButton.enabled = false
|
||||
steamvrDeleteProfileButton.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MyPushButton {
|
||||
id: steamvrApplyProfileButton
|
||||
enabled: false
|
||||
Layout.preferredWidth: 200
|
||||
text: "Apply"
|
||||
onClicked: {
|
||||
if (steamvrProfileComboBox.currentIndex > 0) {
|
||||
SteamVRTabController.applySteamVRProfile(steamvrProfileComboBox.currentIndex - 1)
|
||||
steamvrProfileComboBox.currentIndex = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
spacing: 18
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
MyPushButton {
|
||||
id: steamvrDeleteProfileButton
|
||||
enabled: false
|
||||
Layout.preferredWidth: 200
|
||||
text: "Delete Profile"
|
||||
onClicked: {
|
||||
if (steamvrProfileComboBox.currentIndex > 0) {
|
||||
steamvrDeleteProfileDialog.profileIndex = steamvrProfileComboBox.currentIndex - 1
|
||||
steamvrDeleteProfileDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
MyPushButton {
|
||||
Layout.preferredWidth: 200
|
||||
text: "New Profile"
|
||||
onClicked: {
|
||||
steamvrNewProfileDialog.openPopup()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 16
|
||||
|
||||
@@ -225,6 +388,7 @@ MyStackViewPage {
|
||||
steamvrAllowInterleavedReprojectionToggle.checked = SteamVRTabController.allowInterleavedReprojection
|
||||
steamvrAllowAsyncReprojectionToggle.checked = SteamVRTabController.allowAsyncReprojection
|
||||
steamvrForceReprojectionToggle.checked = SteamVRTabController.forceReprojection
|
||||
reloadSteamVRProfiles()
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -255,6 +419,19 @@ MyStackViewPage {
|
||||
onForceReprojectionChanged: {
|
||||
steamvrForceReprojectionToggle.checked = SteamVRTabController.forceReprojection
|
||||
}
|
||||
onSteamVRProfilesUpdated: {
|
||||
reloadSteamVRProfiles()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reloadSteamVRProfiles() {
|
||||
var profiles = [""]
|
||||
var profileCount = SteamVRTabController.getSteamVRProfileCount()
|
||||
for (var i = 0; i < profileCount; i++) {
|
||||
profiles.push(SteamVRTabController.getSteamVRProfileName(i))
|
||||
}
|
||||
steamvrProfileComboBox.currentIndex = 0
|
||||
steamvrProfileComboBox.model = profiles
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace advsettings {
|
||||
|
||||
void SteamVRTabController::initStage1() {
|
||||
eventLoopTick();
|
||||
reloadSteamVRProfiles();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +18,79 @@ void SteamVRTabController::initStage2(OverlayController * parent, QQuickWindow *
|
||||
}
|
||||
|
||||
|
||||
void SteamVRTabController::reloadSteamVRProfiles() {
|
||||
steamvrProfiles.clear();
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup("steamVRSettings");
|
||||
auto profileCount = settings->beginReadArray("steamVRProfiles");
|
||||
for (int i = 0; i < profileCount; i++) {
|
||||
settings->setArrayIndex(i);
|
||||
steamvrProfiles.emplace_back();
|
||||
auto& entry = steamvrProfiles[i];
|
||||
entry.profileName = settings->value("profileName").toString().toStdString();
|
||||
entry.includesSupersampling = settings->value("includesSupersampling", false).toBool();
|
||||
if (entry.includesSupersampling) {
|
||||
entry.supersampling = settings->value("supersampling", 1.0f).toFloat();
|
||||
}
|
||||
entry.includesSupersampleFiltering = settings->value("includesSupersampleFiltering", false).toBool();
|
||||
if (entry.includesSupersampleFiltering) {
|
||||
entry.supersampleFiltering = settings->value("supersampleFiltering", true).toBool();
|
||||
}
|
||||
entry.includesReprojectionSettings = settings->value("includesReprojectionSettings", false).toBool();
|
||||
if (entry.includesReprojectionSettings) {
|
||||
entry.asynchronousReprojection = settings->value("asynchronousReprojection", true).toBool();
|
||||
entry.interleavedReprojection = settings->value("interleavedReprojection", true).toBool();
|
||||
entry.alwaysOnReprojection = settings->value("alwaysOnReprojection", true).toBool();
|
||||
}
|
||||
}
|
||||
settings->endArray();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
|
||||
void SteamVRTabController::saveSteamVRProfiles() {
|
||||
auto settings = OverlayController::appSettings();
|
||||
settings->beginGroup("steamVRSettings");
|
||||
settings->beginWriteArray("steamVRProfiles");
|
||||
unsigned i = 0;
|
||||
for (auto& p : steamvrProfiles) {
|
||||
settings->setArrayIndex(i);
|
||||
settings->setValue("profileName", QString::fromStdString(p.profileName));
|
||||
settings->setValue("includesSupersampling", p.includesSupersampling);
|
||||
if (p.includesSupersampling) {
|
||||
settings->setValue("supersampling", p.supersampling);
|
||||
}
|
||||
settings->setValue("includesSupersampleFiltering", p.includesSupersampleFiltering);
|
||||
if (p.includesSupersampleFiltering) {
|
||||
settings->setValue("supersampleFiltering", p.supersampleFiltering);
|
||||
}
|
||||
settings->setValue("includesReprojectionSettings", p.includesReprojectionSettings);
|
||||
if (p.includesReprojectionSettings) {
|
||||
settings->setValue("asynchronousReprojection", p.asynchronousReprojection);
|
||||
settings->setValue("interleavedReprojection", p.interleavedReprojection);
|
||||
settings->setValue("alwaysOnReprojection", p.alwaysOnReprojection);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
settings->endArray();
|
||||
settings->endGroup();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Q_INVOKABLE unsigned SteamVRTabController::getSteamVRProfileCount() {
|
||||
return (unsigned)steamvrProfiles.size();
|
||||
}
|
||||
|
||||
Q_INVOKABLE QString SteamVRTabController::getSteamVRProfileName(unsigned index) {
|
||||
if (index >= steamvrProfiles.size()) {
|
||||
return QString();
|
||||
} else {
|
||||
return QString::fromStdString(steamvrProfiles[index].profileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SteamVRTabController::eventLoopTick() {
|
||||
if (settingsUpdateCounter >= 50) {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
@@ -186,8 +260,6 @@ void SteamVRTabController::setAllowSupersampleFiltering(bool value, bool notify)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void SteamVRTabController::reset() {
|
||||
vr::EVRSettingsError vrSettingsError;
|
||||
|
||||
@@ -234,5 +306,70 @@ void SteamVRTabController::restartSteamVR() {
|
||||
}
|
||||
|
||||
|
||||
void SteamVRTabController::addSteamVRProfile(QString name, bool includeSupersampling, bool includeSupersampleFiltering, bool includeReprojectionSettings) {
|
||||
SteamVRProfile* profile = nullptr;
|
||||
for (auto& p : steamvrProfiles) {
|
||||
if (p.profileName.compare(name.toStdString()) == 0) {
|
||||
profile = &p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!profile) {
|
||||
auto i = steamvrProfiles.size();
|
||||
steamvrProfiles.emplace_back();
|
||||
profile = &steamvrProfiles[i];
|
||||
}
|
||||
profile->profileName = name.toStdString();
|
||||
profile->includesSupersampling = includeSupersampling;
|
||||
if (includeSupersampling) {
|
||||
profile->supersampling = m_superSampling;
|
||||
}
|
||||
profile->includesSupersampleFiltering = includeSupersampleFiltering;
|
||||
if (includeSupersampleFiltering) {
|
||||
profile->supersampleFiltering = m_allowSupersampleFiltering;
|
||||
}
|
||||
profile->includesReprojectionSettings = includeReprojectionSettings;
|
||||
if (includeReprojectionSettings) {
|
||||
profile->asynchronousReprojection = m_allowAsyncReprojection;
|
||||
profile->interleavedReprojection = m_allowInterleavedReprojection;
|
||||
profile->alwaysOnReprojection = m_forceReprojection;
|
||||
}
|
||||
saveSteamVRProfiles();
|
||||
OverlayController::appSettings()->sync();
|
||||
emit steamVRProfilesUpdated();
|
||||
}
|
||||
|
||||
|
||||
void SteamVRTabController::applySteamVRProfile(unsigned index) {
|
||||
if (index < steamvrProfiles.size()) {
|
||||
auto& profile = steamvrProfiles[index];
|
||||
if (profile.includesSupersampling) {
|
||||
setSuperSampling(profile.supersampling);
|
||||
}
|
||||
if (profile.includesSupersampleFiltering) {
|
||||
setAllowSupersampleFiltering(profile.supersampleFiltering);
|
||||
}
|
||||
if (profile.includesReprojectionSettings) {
|
||||
setAllowAsyncReprojection(profile.asynchronousReprojection);
|
||||
setAllowInterleavedReprojection(profile.interleavedReprojection);
|
||||
setForceReprojection(profile.alwaysOnReprojection);
|
||||
}
|
||||
vr::VRSettings()->Sync(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SteamVRTabController::deleteSteamVRProfile(unsigned index) {
|
||||
if (index < steamvrProfiles.size()) {
|
||||
auto pos = steamvrProfiles.begin() + index;
|
||||
steamvrProfiles.erase(pos);
|
||||
saveSteamVRProfiles();
|
||||
OverlayController::appSettings()->sync();
|
||||
emit steamVRProfilesUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace advconfig
|
||||
|
||||
|
||||
@@ -19,6 +19,22 @@ namespace advsettings {
|
||||
class OverlayController;
|
||||
|
||||
|
||||
struct SteamVRProfile {
|
||||
std::string profileName;
|
||||
|
||||
bool includesSupersampling = false;
|
||||
float supersampling = 1.0f;
|
||||
|
||||
bool includesSupersampleFiltering = false;
|
||||
bool supersampleFiltering = false;
|
||||
|
||||
bool includesReprojectionSettings = false;
|
||||
bool asynchronousReprojection = true;
|
||||
bool interleavedReprojection = true;
|
||||
bool alwaysOnReprojection = true;
|
||||
};
|
||||
|
||||
|
||||
class SteamVRTabController : public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(float superSampling READ superSampling WRITE setSuperSampling NOTIFY superSamplingChanged)
|
||||
@@ -39,6 +55,8 @@ private:
|
||||
bool m_forceReprojection = false;
|
||||
bool m_allowSupersampleFiltering = true;
|
||||
|
||||
std::vector<SteamVRProfile> steamvrProfiles;
|
||||
|
||||
unsigned settingsUpdateCounter = 0;
|
||||
|
||||
public:
|
||||
@@ -54,6 +72,12 @@ public:
|
||||
bool forceReprojection() const;
|
||||
bool allowSupersampleFiltering() const;
|
||||
|
||||
void reloadSteamVRProfiles();
|
||||
void saveSteamVRProfiles();
|
||||
|
||||
Q_INVOKABLE unsigned getSteamVRProfileCount();
|
||||
Q_INVOKABLE QString getSteamVRProfileName(unsigned index);
|
||||
|
||||
public slots:
|
||||
void setSuperSampling(float value, bool notify = true);
|
||||
void setCompositorSuperSampling(float value, bool notify = true);
|
||||
@@ -62,6 +86,10 @@ public slots:
|
||||
void setForceReprojection(bool value, bool notify = true);
|
||||
void setAllowSupersampleFiltering(bool value, bool notify = true);
|
||||
|
||||
void addSteamVRProfile(QString name, bool includeSupersampling, bool includeSupersampleFiltering, bool includeReprojectionSettings);
|
||||
void applySteamVRProfile(unsigned index);
|
||||
void deleteSteamVRProfile(unsigned index);
|
||||
|
||||
void reset();
|
||||
void restartSteamVR();
|
||||
|
||||
@@ -72,6 +100,8 @@ signals:
|
||||
void allowAsyncReprojectionChanged(bool value);
|
||||
void forceReprojectionChanged(bool value);
|
||||
void allowSupersampleFilteringChanged(bool value);
|
||||
|
||||
void steamVRProfilesUpdated();
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
Reference in New Issue
Block a user