mirror of
https://github.com/lubosz/overte.git
synced 2025-04-07 15:22:09 +02:00
move LOD FPS settings to Preferences
This commit is contained in:
parent
288bb5be38
commit
619428c325
7 changed files with 233 additions and 50 deletions
|
@ -1786,6 +1786,7 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa
|
|||
void Application::loadSettings() {
|
||||
|
||||
DependencyManager::get<AudioClient>()->loadSettings();
|
||||
DependencyManager::get<LODManager>()->loadSettings();
|
||||
|
||||
Menu::getInstance()->loadSettings();
|
||||
_myAvatar->loadData();
|
||||
|
@ -1793,6 +1794,7 @@ void Application::loadSettings() {
|
|||
|
||||
void Application::saveSettings() {
|
||||
DependencyManager::get<AudioClient>()->saveSettings();
|
||||
DependencyManager::get<LODManager>()->saveSettings();
|
||||
|
||||
Menu::getInstance()->saveSettings();
|
||||
_myAvatar->saveData();
|
||||
|
|
|
@ -17,11 +17,8 @@
|
|||
|
||||
#include "LODManager.h"
|
||||
|
||||
Setting::Handle<bool> automaticLODAdjust("automaticLODAdjust", true);
|
||||
Setting::Handle<float> desktopLODDecreaseFPS("desktopLODDecreaseFPS", DEFAULT_DESKTOP_LOD_DOWN_FPS);
|
||||
Setting::Handle<float> desktopLODIncreaseFPS("desktopLODIncreaseFPS", DEFAULT_DESKTOP_LOD_UP_FPS);
|
||||
Setting::Handle<float> hmdLODDecreaseFPS("hmdLODDecreaseFPS", DEFAULT_HMD_LOD_DOWN_FPS);
|
||||
Setting::Handle<float> hmdLODIncreaseFPS("hmdLODIncreaseFPS", DEFAULT_HMD_LOD_UP_FPS);
|
||||
|
||||
|
||||
Setting::Handle<float> avatarLODDistanceMultiplier("avatarLODDistanceMultiplier",
|
||||
|
@ -244,11 +241,8 @@ void LODManager::setBoundaryLevelAdjust(int boundaryLevelAdjust) {
|
|||
|
||||
|
||||
void LODManager::loadSettings() {
|
||||
setAutomaticLODAdjust(automaticLODAdjust.get());
|
||||
setDesktopLODDecreaseFPS(desktopLODDecreaseFPS.get());
|
||||
setDesktopLODIncreaseFPS(desktopLODIncreaseFPS.get());
|
||||
setHMDLODDecreaseFPS(hmdLODDecreaseFPS.get());
|
||||
setHMDLODIncreaseFPS(hmdLODIncreaseFPS.get());
|
||||
|
||||
setAvatarLODDistanceMultiplier(avatarLODDistanceMultiplier.get());
|
||||
setBoundaryLevelAdjust(boundaryLevelAdjust.get());
|
||||
|
@ -256,11 +250,8 @@ void LODManager::loadSettings() {
|
|||
}
|
||||
|
||||
void LODManager::saveSettings() {
|
||||
automaticLODAdjust.set(getAutomaticLODAdjust());
|
||||
desktopLODDecreaseFPS.set(getDesktopLODDecreaseFPS());
|
||||
desktopLODIncreaseFPS.set(getDesktopLODIncreaseFPS());
|
||||
hmdLODDecreaseFPS.set(getHMDLODDecreaseFPS());
|
||||
hmdLODIncreaseFPS.set(getHMDLODIncreaseFPS());
|
||||
|
||||
avatarLODDistanceMultiplier.set(getAvatarLODDistanceMultiplier());
|
||||
boundaryLevelAdjust.set(getBoundaryLevelAdjust());
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
#include <SimpleMovingAverage.h>
|
||||
|
||||
const float DEFAULT_DESKTOP_LOD_DOWN_FPS = 30.0;
|
||||
const float DEFAULT_DESKTOP_LOD_UP_FPS = 50.0;
|
||||
const float DEFAULT_HMD_LOD_DOWN_FPS = 60.0;
|
||||
const float DEFAULT_HMD_LOD_UP_FPS = 65.0;
|
||||
const float INCREASE_LOD_GAP = 5.0f;
|
||||
|
||||
const quint64 ADJUST_LOD_DOWN_DELAY = 1000 * 1000 * 0.5; // Consider adjusting LOD down after half a second
|
||||
const quint64 ADJUST_LOD_UP_DELAY = ADJUST_LOD_DOWN_DELAY * 2;
|
||||
|
@ -53,13 +52,11 @@ public:
|
|||
|
||||
Q_INVOKABLE void setDesktopLODDecreaseFPS(float value) { _desktopLODDecreaseFPS = value; }
|
||||
Q_INVOKABLE float getDesktopLODDecreaseFPS() const { return _desktopLODDecreaseFPS; }
|
||||
Q_INVOKABLE void setDesktopLODIncreaseFPS(float value) { _desktopLODIncreaseFPS = value; }
|
||||
Q_INVOKABLE float getDesktopLODIncreaseFPS() const { return _desktopLODIncreaseFPS; }
|
||||
Q_INVOKABLE float getDesktopLODIncreaseFPS() const { return _desktopLODDecreaseFPS + INCREASE_LOD_GAP; }
|
||||
|
||||
Q_INVOKABLE void setHMDLODDecreaseFPS(float value) { _hmdLODDecreaseFPS = value; }
|
||||
Q_INVOKABLE float getHMDLODDecreaseFPS() const { return _hmdLODDecreaseFPS; }
|
||||
Q_INVOKABLE void setHMDLODIncreaseFPS(float value) { _hmdLODIncreaseFPS = value; }
|
||||
Q_INVOKABLE float getHMDLODIncreaseFPS() const { return _hmdLODIncreaseFPS; }
|
||||
Q_INVOKABLE float getHMDLODIncreaseFPS() const { return _hmdLODDecreaseFPS + INCREASE_LOD_GAP; }
|
||||
|
||||
Q_INVOKABLE void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier = multiplier; }
|
||||
Q_INVOKABLE float getAvatarLODDistanceMultiplier() const { return _avatarLODDistanceMultiplier; }
|
||||
|
@ -94,9 +91,7 @@ private:
|
|||
|
||||
bool _automaticLODAdjust = true;
|
||||
float _desktopLODDecreaseFPS = DEFAULT_DESKTOP_LOD_DOWN_FPS;
|
||||
float _desktopLODIncreaseFPS = DEFAULT_DESKTOP_LOD_UP_FPS;
|
||||
float _hmdLODDecreaseFPS = DEFAULT_HMD_LOD_DOWN_FPS;
|
||||
float _hmdLODIncreaseFPS = DEFAULT_HMD_LOD_UP_FPS;
|
||||
|
||||
float _avatarLODDistanceMultiplier = DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER;
|
||||
|
||||
|
|
|
@ -50,26 +50,6 @@ LodToolsDialog::LodToolsDialog(QWidget* parent) :
|
|||
_automaticLODAdjust->setChecked(lodManager->getAutomaticLODAdjust());
|
||||
connect(_automaticLODAdjust, SIGNAL(toggled(bool)), SLOT(updateAutomaticLODAdjust()));
|
||||
|
||||
form->addRow("Desktop Decrease LOD Below FPS:", _desktopLODDecreaseFPS = new QDoubleSpinBox(this));
|
||||
_desktopLODDecreaseFPS->setValue(lodManager->getDesktopLODDecreaseFPS());
|
||||
_desktopLODDecreaseFPS->setDecimals(0);
|
||||
connect(_desktopLODDecreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateLODValues()));
|
||||
|
||||
form->addRow("Desktop Increase LOD Above FPS:", _desktopLODIncreaseFPS = new QDoubleSpinBox(this));
|
||||
_desktopLODIncreaseFPS->setValue(lodManager->getDesktopLODIncreaseFPS());
|
||||
_desktopLODIncreaseFPS->setDecimals(0);
|
||||
connect(_desktopLODIncreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateLODValues()));
|
||||
|
||||
form->addRow("HMD Decrease LOD Below FPS:", _hmdLODDecreaseFPS = new QDoubleSpinBox(this));
|
||||
_hmdLODDecreaseFPS->setValue(lodManager->getHMDLODDecreaseFPS());
|
||||
_hmdLODDecreaseFPS->setDecimals(0);
|
||||
connect(_hmdLODDecreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateLODValues()));
|
||||
|
||||
form->addRow("HMD Increase LOD Above FPS:", _hmdLODIncreaseFPS = new QDoubleSpinBox(this));
|
||||
_hmdLODIncreaseFPS->setValue(lodManager->getHMDLODIncreaseFPS());
|
||||
_hmdLODIncreaseFPS->setDecimals(0);
|
||||
connect(_hmdLODIncreaseFPS, SIGNAL(valueChanged(double)), SLOT(updateLODValues()));
|
||||
|
||||
form->addRow("Avatar LOD:", _avatarLOD = new QDoubleSpinBox(this));
|
||||
_avatarLOD->setDecimals(3);
|
||||
_avatarLOD->setRange(1.0 / MAXIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER, 1.0 / MINIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER);
|
||||
|
@ -123,12 +103,6 @@ void LodToolsDialog::updateLODValues() {
|
|||
auto lodManager = DependencyManager::get<LODManager>();
|
||||
|
||||
lodManager->setAutomaticLODAdjust(_automaticLODAdjust->isChecked());
|
||||
|
||||
lodManager->setDesktopLODDecreaseFPS(_desktopLODDecreaseFPS->value());
|
||||
lodManager->setDesktopLODIncreaseFPS(_desktopLODIncreaseFPS->value());
|
||||
lodManager->setHMDLODDecreaseFPS(_hmdLODDecreaseFPS->value());
|
||||
lodManager->setHMDLODIncreaseFPS(_hmdLODIncreaseFPS->value());
|
||||
|
||||
lodManager->setAvatarLODDistanceMultiplier(1.0 / _avatarLOD->value());
|
||||
}
|
||||
|
||||
|
@ -145,11 +119,6 @@ void LodToolsDialog::resetClicked(bool checked) {
|
|||
int sliderValue = DEFAULT_OCTREE_SIZE_SCALE / TREE_SCALE;
|
||||
_lodSize->setValue(sliderValue);
|
||||
_automaticLODAdjust->setChecked(true);
|
||||
_desktopLODDecreaseFPS->setValue(DEFAULT_DESKTOP_LOD_DOWN_FPS);
|
||||
_desktopLODIncreaseFPS->setValue(DEFAULT_DESKTOP_LOD_UP_FPS);
|
||||
_hmdLODDecreaseFPS->setValue(DEFAULT_HMD_LOD_DOWN_FPS);
|
||||
_hmdLODIncreaseFPS->setValue(DEFAULT_HMD_LOD_UP_FPS);
|
||||
|
||||
_avatarLOD->setValue(1.0 / DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER);
|
||||
|
||||
updateLODValues(); // tell our LOD manager about the reset
|
||||
|
|
|
@ -47,10 +47,8 @@ private:
|
|||
QCheckBox* _automaticLODAdjust;
|
||||
|
||||
QDoubleSpinBox* _desktopLODDecreaseFPS;
|
||||
QDoubleSpinBox* _desktopLODIncreaseFPS;
|
||||
|
||||
QDoubleSpinBox* _hmdLODDecreaseFPS;
|
||||
QDoubleSpinBox* _hmdLODIncreaseFPS;
|
||||
|
||||
|
||||
QDoubleSpinBox* _avatarLOD;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "Application.h"
|
||||
#include "MainWindow.h"
|
||||
#include "LODManager.h"
|
||||
#include "Menu.h"
|
||||
#include "ModelsBrowser.h"
|
||||
#include "PreferencesDialog.h"
|
||||
|
@ -174,6 +175,10 @@ void PreferencesDialog::loadPreferences() {
|
|||
ui.sixenseReticleMoveSpeedSpin->setValue(sixense.getReticleMoveSpeed());
|
||||
ui.invertSixenseButtonsCheckBox->setChecked(sixense.getInvertButtons());
|
||||
|
||||
// LOD items
|
||||
auto lodManager = DependencyManager::get<LODManager>();
|
||||
ui.desktopMinimumFPSSpin->setValue(lodManager->getDesktopLODDecreaseFPS());
|
||||
ui.hmdMinimumFPSSpin->setValue(lodManager->getHMDLODDecreaseFPS());
|
||||
}
|
||||
|
||||
void PreferencesDialog::savePreferences() {
|
||||
|
@ -275,4 +280,9 @@ void PreferencesDialog::savePreferences() {
|
|||
audio->setOutputStarveDetectionPeriod(ui.outputStarveDetectionPeriodSpinner->value());
|
||||
|
||||
Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height());
|
||||
|
||||
// LOD items
|
||||
auto lodManager = DependencyManager::get<LODManager>();
|
||||
lodManager->setDesktopLODDecreaseFPS(ui.desktopMinimumFPSSpin->value());
|
||||
lodManager->setHMDLODDecreaseFPS(ui.hmdMinimumFPSSpin->value());
|
||||
}
|
||||
|
|
|
@ -701,6 +701,219 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<spacer name="verticalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<widget class="QLabel" name="levelOfDetailTitleLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>18</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:#29967e</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Level of Detail Tuning</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_111x">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9x">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Minimum Desktop FPS</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<!--
|
||||
<property name="buddy">
|
||||
<cstring>fieldOfViewSpin</cstring>
|
||||
</property>
|
||||
-->
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_111x">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="desktopMinimumFPSSpin">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>95</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>120</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_111y">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9y">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Minimum HMD FPS</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<!--
|
||||
<property name="buddy">
|
||||
<cstring>fieldOfViewSpin</cstring>
|
||||
</property>
|
||||
-->
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_111y">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="hmdMinimumFPSSpin">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>95</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>120</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
|
@ -717,6 +930,7 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<widget class="QLabel" name="avatarTitleLabel">
|
||||
<property name="font">
|
||||
|
@ -738,6 +952,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_111">
|
||||
<property name="spacing">
|
||||
|
@ -820,6 +1035,9 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
|
|
Loading…
Reference in a new issue