mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 10:49:33 +02:00
More settings update
This commit is contained in:
parent
fdade344a3
commit
09a9f82256
14 changed files with 112 additions and 136 deletions
|
@ -1575,14 +1575,12 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa
|
||||||
|
|
||||||
void Application::loadSettings() {
|
void Application::loadSettings() {
|
||||||
DependencyManager::get<Audio>()->loadSettings();
|
DependencyManager::get<Audio>()->loadSettings();
|
||||||
DependencyManager::get<LODManager>()->loadSettings();
|
|
||||||
Menu::getInstance()->loadSettings();
|
Menu::getInstance()->loadSettings();
|
||||||
_myAvatar->loadData();
|
_myAvatar->loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveSettings() {
|
void Application::saveSettings() {
|
||||||
DependencyManager::get<Audio>()->saveSettings();
|
DependencyManager::get<Audio>()->saveSettings();
|
||||||
DependencyManager::get<LODManager>()->saveSettings();
|
|
||||||
Menu::getInstance()->saveSettings();
|
Menu::getInstance()->saveSettings();
|
||||||
_myAvatar->saveData();
|
_myAvatar->saveData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <AbstractAudioInterface.h>
|
#include <AbstractAudioInterface.h>
|
||||||
#include <AudioRingBuffer.h>
|
#include <AudioRingBuffer.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
#include <SettingHandle.h>
|
||||||
#include <StDev.h>
|
#include <StDev.h>
|
||||||
|
|
||||||
#include "audio/AudioIOStats.h"
|
#include "audio/AudioIOStats.h"
|
||||||
|
|
|
@ -16,14 +16,15 @@
|
||||||
|
|
||||||
#include "LODManager.h"
|
#include "LODManager.h"
|
||||||
|
|
||||||
namespace SettingHandles {
|
LODManager::LODManager() :
|
||||||
const SettingHandle<bool> automaticAvatarLOD("automaticAvatarLOD", true);
|
_automaticAvatarLOD("automaticAvatarLOD", true),
|
||||||
const SettingHandle<float> avatarLODDecreaseFPS("avatarLODDecreaseFPS", DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS);
|
_avatarLODDecreaseFPS("avatarLODDecreaseFPS", DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS),
|
||||||
const SettingHandle<float> avatarLODIncreaseFPS("avatarLODIncreaseFPS", ADJUST_LOD_UP_FPS);
|
_avatarLODIncreaseFPS("avatarLODIncreaseFPS", ADJUST_LOD_UP_FPS),
|
||||||
const SettingHandle<float> avatarLODDistanceMultiplier("avatarLODDistanceMultiplier",
|
_avatarLODDistanceMultiplier("avatarLODDistanceMultiplier",
|
||||||
DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER);
|
DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER),
|
||||||
const SettingHandle<int> boundaryLevelAdjust("boundaryLevelAdjust", 0);
|
_boundaryLevelAdjust("boundaryLevelAdjust", 0),
|
||||||
const SettingHandle<float> octreeSizeScale("octreeSizeScale", DEFAULT_OCTREE_SIZE_SCALE);
|
_octreeSizeScale("octreeSizeScale", DEFAULT_OCTREE_SIZE_SCALE)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void LODManager::autoAdjustLOD(float currentFPS) {
|
void LODManager::autoAdjustLOD(float currentFPS) {
|
||||||
|
@ -41,23 +42,25 @@ void LODManager::autoAdjustLOD(float currentFPS) {
|
||||||
quint64 now = usecTimestampNow();
|
quint64 now = usecTimestampNow();
|
||||||
|
|
||||||
const quint64 ADJUST_AVATAR_LOD_DOWN_DELAY = 1000 * 1000;
|
const quint64 ADJUST_AVATAR_LOD_DOWN_DELAY = 1000 * 1000;
|
||||||
if (_automaticAvatarLOD) {
|
if (_automaticAvatarLOD.get()) {
|
||||||
if (_fastFPSAverage.getAverage() < _avatarLODDecreaseFPS) {
|
if (_fastFPSAverage.getAverage() < _avatarLODDecreaseFPS.get()) {
|
||||||
if (now - _lastAvatarDetailDrop > ADJUST_AVATAR_LOD_DOWN_DELAY) {
|
if (now - _lastAvatarDetailDrop > ADJUST_AVATAR_LOD_DOWN_DELAY) {
|
||||||
// attempt to lower the detail in proportion to the fps difference
|
// attempt to lower the detail in proportion to the fps difference
|
||||||
float targetFps = (_avatarLODDecreaseFPS + _avatarLODIncreaseFPS) * 0.5f;
|
float targetFps = (_avatarLODDecreaseFPS.get() + _avatarLODIncreaseFPS.get()) * 0.5f;
|
||||||
float averageFps = _fastFPSAverage.getAverage();
|
float averageFps = _fastFPSAverage.getAverage();
|
||||||
const float MAXIMUM_MULTIPLIER_SCALE = 2.0f;
|
const float MAXIMUM_MULTIPLIER_SCALE = 2.0f;
|
||||||
_avatarLODDistanceMultiplier = qMin(MAXIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER, _avatarLODDistanceMultiplier *
|
_avatarLODDistanceMultiplier.set(qMin(MAXIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER,
|
||||||
(averageFps < EPSILON ? MAXIMUM_MULTIPLIER_SCALE :
|
_avatarLODDistanceMultiplier.get() *
|
||||||
qMin(MAXIMUM_MULTIPLIER_SCALE, targetFps / averageFps)));
|
(averageFps < EPSILON ? MAXIMUM_MULTIPLIER_SCALE :
|
||||||
|
qMin(MAXIMUM_MULTIPLIER_SCALE,
|
||||||
|
targetFps / averageFps))));
|
||||||
_lastAvatarDetailDrop = now;
|
_lastAvatarDetailDrop = now;
|
||||||
}
|
}
|
||||||
} else if (_fastFPSAverage.getAverage() > _avatarLODIncreaseFPS) {
|
} else if (_fastFPSAverage.getAverage() > _avatarLODIncreaseFPS.get()) {
|
||||||
// let the detail level creep slowly upwards
|
// let the detail level creep slowly upwards
|
||||||
const float DISTANCE_DECREASE_RATE = 0.05f;
|
const float DISTANCE_DECREASE_RATE = 0.05f;
|
||||||
_avatarLODDistanceMultiplier = qMax(MINIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER,
|
_avatarLODDistanceMultiplier.set(qMax(MINIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER,
|
||||||
_avatarLODDistanceMultiplier - DISTANCE_DECREASE_RATE);
|
_avatarLODDistanceMultiplier.get() - DISTANCE_DECREASE_RATE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,29 +68,29 @@ void LODManager::autoAdjustLOD(float currentFPS) {
|
||||||
quint64 elapsed = now - _lastAdjust;
|
quint64 elapsed = now - _lastAdjust;
|
||||||
|
|
||||||
if (elapsed > ADJUST_LOD_DOWN_DELAY && _fpsAverage.getAverage() < ADJUST_LOD_DOWN_FPS
|
if (elapsed > ADJUST_LOD_DOWN_DELAY && _fpsAverage.getAverage() < ADJUST_LOD_DOWN_FPS
|
||||||
&& _octreeSizeScale > ADJUST_LOD_MIN_SIZE_SCALE) {
|
&& _octreeSizeScale.get() > ADJUST_LOD_MIN_SIZE_SCALE) {
|
||||||
|
|
||||||
_octreeSizeScale *= ADJUST_LOD_DOWN_BY;
|
_octreeSizeScale.set(_octreeSizeScale.get() * ADJUST_LOD_DOWN_BY);
|
||||||
|
|
||||||
if (_octreeSizeScale < ADJUST_LOD_MIN_SIZE_SCALE) {
|
if (_octreeSizeScale.get() < ADJUST_LOD_MIN_SIZE_SCALE) {
|
||||||
_octreeSizeScale = ADJUST_LOD_MIN_SIZE_SCALE;
|
_octreeSizeScale.set(ADJUST_LOD_MIN_SIZE_SCALE);
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
_lastAdjust = now;
|
_lastAdjust = now;
|
||||||
qDebug() << "adjusting LOD down... average fps for last approximately 5 seconds=" << _fpsAverage.getAverage()
|
qDebug() << "adjusting LOD down... average fps for last approximately 5 seconds=" << _fpsAverage.getAverage()
|
||||||
<< "_octreeSizeScale=" << _octreeSizeScale;
|
<< "_octreeSizeScale=" << _octreeSizeScale.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elapsed > ADJUST_LOD_UP_DELAY && _fpsAverage.getAverage() > ADJUST_LOD_UP_FPS
|
if (elapsed > ADJUST_LOD_UP_DELAY && _fpsAverage.getAverage() > ADJUST_LOD_UP_FPS
|
||||||
&& _octreeSizeScale < ADJUST_LOD_MAX_SIZE_SCALE) {
|
&& _octreeSizeScale.get() < ADJUST_LOD_MAX_SIZE_SCALE) {
|
||||||
_octreeSizeScale *= ADJUST_LOD_UP_BY;
|
_octreeSizeScale.set(_octreeSizeScale.get() * ADJUST_LOD_UP_BY);
|
||||||
if (_octreeSizeScale > ADJUST_LOD_MAX_SIZE_SCALE) {
|
if (_octreeSizeScale.get() > ADJUST_LOD_MAX_SIZE_SCALE) {
|
||||||
_octreeSizeScale = ADJUST_LOD_MAX_SIZE_SCALE;
|
_octreeSizeScale.set(ADJUST_LOD_MAX_SIZE_SCALE);
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
_lastAdjust = now;
|
_lastAdjust = now;
|
||||||
qDebug() << "adjusting LOD up... average fps for last approximately 5 seconds=" << _fpsAverage.getAverage()
|
qDebug() << "adjusting LOD up... average fps for last approximately 5 seconds=" << _fpsAverage.getAverage()
|
||||||
<< "_octreeSizeScale=" << _octreeSizeScale;
|
<< "_octreeSizeScale=" << _octreeSizeScale.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
@ -179,32 +182,13 @@ bool LODManager::shouldRenderMesh(float largestDimension, float distanceToCamera
|
||||||
}
|
}
|
||||||
|
|
||||||
void LODManager::setOctreeSizeScale(float sizeScale) {
|
void LODManager::setOctreeSizeScale(float sizeScale) {
|
||||||
_octreeSizeScale = sizeScale;
|
_octreeSizeScale.set(sizeScale);
|
||||||
_shouldRenderTableNeedsRebuilding = true;
|
_shouldRenderTableNeedsRebuilding = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LODManager::setBoundaryLevelAdjust(int boundaryLevelAdjust) {
|
void LODManager::setBoundaryLevelAdjust(int boundaryLevelAdjust) {
|
||||||
_boundaryLevelAdjust = boundaryLevelAdjust;
|
_boundaryLevelAdjust.set(boundaryLevelAdjust);
|
||||||
_shouldRenderTableNeedsRebuilding = true;
|
_shouldRenderTableNeedsRebuilding = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LODManager::loadSettings() {
|
|
||||||
setAutomaticAvatarLOD(SettingHandles::automaticAvatarLOD.get());
|
|
||||||
setAvatarLODDecreaseFPS(SettingHandles::avatarLODDecreaseFPS.get());
|
|
||||||
setAvatarLODIncreaseFPS(SettingHandles::avatarLODIncreaseFPS.get());
|
|
||||||
setAvatarLODDistanceMultiplier(SettingHandles::avatarLODDistanceMultiplier.get());
|
|
||||||
setBoundaryLevelAdjust(SettingHandles::boundaryLevelAdjust.get());
|
|
||||||
setOctreeSizeScale(SettingHandles::octreeSizeScale.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
void LODManager::saveSettings() {
|
|
||||||
SettingHandles::automaticAvatarLOD.set(getAutomaticAvatarLOD());
|
|
||||||
SettingHandles::avatarLODDecreaseFPS.set(getAvatarLODDecreaseFPS());
|
|
||||||
SettingHandles::avatarLODIncreaseFPS.set(getAvatarLODIncreaseFPS());
|
|
||||||
SettingHandles::avatarLODDistanceMultiplier.set(getAvatarLODDistanceMultiplier());
|
|
||||||
SettingHandles::boundaryLevelAdjust.set(getBoundaryLevelAdjust());
|
|
||||||
SettingHandles::octreeSizeScale.set(getOctreeSizeScale());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <OctreeConstants.h>
|
#include <OctreeConstants.h>
|
||||||
#include <Settings.h>
|
#include <SettingHandle.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <SimpleMovingAverage.h>
|
#include <SimpleMovingAverage.h>
|
||||||
|
|
||||||
|
@ -43,41 +43,38 @@ class LODManager : public Dependency {
|
||||||
SINGLETON_DEPENDENCY
|
SINGLETON_DEPENDENCY
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setAutomaticAvatarLOD(bool automaticAvatarLOD) { _automaticAvatarLOD = automaticAvatarLOD; }
|
void setAutomaticAvatarLOD(bool automaticAvatarLOD) { _automaticAvatarLOD.set(automaticAvatarLOD); }
|
||||||
bool getAutomaticAvatarLOD() const { return _automaticAvatarLOD; }
|
bool getAutomaticAvatarLOD() { return _automaticAvatarLOD.get(); }
|
||||||
void setAvatarLODDecreaseFPS(float avatarLODDecreaseFPS) { _avatarLODDecreaseFPS = avatarLODDecreaseFPS; }
|
void setAvatarLODDecreaseFPS(float avatarLODDecreaseFPS) { _avatarLODDecreaseFPS.set(avatarLODDecreaseFPS); }
|
||||||
float getAvatarLODDecreaseFPS() const { return _avatarLODDecreaseFPS; }
|
float getAvatarLODDecreaseFPS() { return _avatarLODDecreaseFPS.get(); }
|
||||||
void setAvatarLODIncreaseFPS(float avatarLODIncreaseFPS) { _avatarLODIncreaseFPS = avatarLODIncreaseFPS; }
|
void setAvatarLODIncreaseFPS(float avatarLODIncreaseFPS) { _avatarLODIncreaseFPS.set(avatarLODIncreaseFPS); }
|
||||||
float getAvatarLODIncreaseFPS() const { return _avatarLODIncreaseFPS; }
|
float getAvatarLODIncreaseFPS() { return _avatarLODIncreaseFPS.get(); }
|
||||||
void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier = multiplier; }
|
void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier.set(multiplier); }
|
||||||
float getAvatarLODDistanceMultiplier() const { return _avatarLODDistanceMultiplier; }
|
float getAvatarLODDistanceMultiplier() { return _avatarLODDistanceMultiplier.get(); }
|
||||||
|
|
||||||
// User Tweakable LOD Items
|
// User Tweakable LOD Items
|
||||||
QString getLODFeedbackText();
|
QString getLODFeedbackText();
|
||||||
void setOctreeSizeScale(float sizeScale);
|
void setOctreeSizeScale(float sizeScale);
|
||||||
float getOctreeSizeScale() const { return _octreeSizeScale; }
|
float getOctreeSizeScale() { return _octreeSizeScale.get(); }
|
||||||
|
|
||||||
void setBoundaryLevelAdjust(int boundaryLevelAdjust);
|
void setBoundaryLevelAdjust(int boundaryLevelAdjust);
|
||||||
int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; }
|
int getBoundaryLevelAdjust() { return _boundaryLevelAdjust.get(); }
|
||||||
|
|
||||||
void autoAdjustLOD(float currentFPS);
|
void autoAdjustLOD(float currentFPS);
|
||||||
void resetLODAdjust();
|
void resetLODAdjust();
|
||||||
|
|
||||||
bool shouldRenderMesh(float largestDimension, float distanceToCamera);
|
bool shouldRenderMesh(float largestDimension, float distanceToCamera);
|
||||||
|
|
||||||
void loadSettings();
|
|
||||||
void saveSettings();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LODManager() {}
|
LODManager();
|
||||||
|
|
||||||
bool _automaticAvatarLOD = true;
|
Setting::Handle<bool> _automaticAvatarLOD;
|
||||||
float _avatarLODDecreaseFPS = DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS;
|
Setting::Handle<float> _avatarLODDecreaseFPS;
|
||||||
float _avatarLODIncreaseFPS = ADJUST_LOD_UP_FPS;
|
Setting::Handle<float> _avatarLODIncreaseFPS;
|
||||||
float _avatarLODDistanceMultiplier = DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER;
|
Setting::Handle<float> _avatarLODDistanceMultiplier;
|
||||||
|
|
||||||
float _octreeSizeScale = DEFAULT_OCTREE_SIZE_SCALE;
|
Setting::Handle<int> _boundaryLevelAdjust;
|
||||||
int _boundaryLevelAdjust = 0;
|
Setting::Handle<float> _octreeSizeScale;
|
||||||
|
|
||||||
quint64 _lastAdjust = 0;
|
quint64 _lastAdjust = 0;
|
||||||
quint64 _lastAvatarDetailDrop = 0;
|
quint64 _lastAvatarDetailDrop = 0;
|
||||||
|
|
|
@ -18,24 +18,20 @@
|
||||||
#include <QHideEvent>
|
#include <QHideEvent>
|
||||||
#include <QWindowStateChangeEvent>
|
#include <QWindowStateChangeEvent>
|
||||||
|
|
||||||
#include <Settings.h>
|
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
namespace SettingHandles {
|
MainWindow::MainWindow(QWidget* parent) :
|
||||||
const SettingHandle<QRect> windowGeometry("WindowGeometry");
|
QMainWindow(parent),
|
||||||
}
|
_windowGeometry("WindowGeometry")
|
||||||
|
{
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::restoreGeometry() {
|
void MainWindow::restoreGeometry() {
|
||||||
// Did not use setGeometry() on purpose,
|
// Did not use setGeometry() on purpose,
|
||||||
// see http://doc.qt.io/qt-5/qsettings.html#restoring-the-state-of-a-gui-application
|
// see http://doc.qt.io/qt-5/qsettings.html#restoring-the-state-of-a-gui-application
|
||||||
QRect geometry = SettingHandles::windowGeometry.get(qApp->desktop()->availableGeometry());
|
QRect geometry = _windowGeometry.get(qApp->desktop()->availableGeometry());
|
||||||
move(geometry.topLeft());
|
move(geometry.topLeft());
|
||||||
resize(geometry.size());
|
resize(geometry.size());
|
||||||
}
|
}
|
||||||
|
@ -44,7 +40,7 @@ void MainWindow::saveGeometry() {
|
||||||
// Did not use geometry() on purpose,
|
// Did not use geometry() on purpose,
|
||||||
// see http://doc.qt.io/qt-5/qsettings.html#restoring-the-state-of-a-gui-application
|
// see http://doc.qt.io/qt-5/qsettings.html#restoring-the-state-of-a-gui-application
|
||||||
QRect geometry(pos(), size());
|
QRect geometry(pos(), size());
|
||||||
SettingHandles::windowGeometry.set(geometry);
|
_windowGeometry.set(geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::moveEvent(QMoveEvent* event) {
|
void MainWindow::moveEvent(QMoveEvent* event) {
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
class MainWindow : public QMainWindow {
|
class MainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -33,6 +35,9 @@ protected:
|
||||||
virtual void showEvent(QShowEvent* event);
|
virtual void showEvent(QShowEvent* event);
|
||||||
virtual void hideEvent(QHideEvent* event);
|
virtual void hideEvent(QHideEvent* event);
|
||||||
virtual void changeEvent(QEvent* event);
|
virtual void changeEvent(QEvent* event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Setting::Handle<QRect> _windowGeometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__MainWindow__) */
|
#endif /* defined(__hifi__MainWindow__) */
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <GlowEffect.h>
|
#include <GlowEffect.h>
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
#include <Settings.h>
|
#include <SettingHandle.h>
|
||||||
#include <UserActivityLogger.h>
|
#include <UserActivityLogger.h>
|
||||||
#include <XmppClient.h>
|
#include <XmppClient.h>
|
||||||
|
|
||||||
|
|
|
@ -239,8 +239,6 @@ namespace MenuOption {
|
||||||
const QString RunTimingTests = "Run Timing Tests";
|
const QString RunTimingTests = "Run Timing Tests";
|
||||||
const QString ScriptEditor = "Script Editor...";
|
const QString ScriptEditor = "Script Editor...";
|
||||||
const QString ScriptedMotorControl = "Enable Scripted Motor Control";
|
const QString ScriptedMotorControl = "Enable Scripted Motor Control";
|
||||||
const QString SettingsExport = "Export Settings";
|
|
||||||
const QString SettingsImport = "Import Settings";
|
|
||||||
const QString ShowBordersEntityNodes = "Show Entity Nodes";
|
const QString ShowBordersEntityNodes = "Show Entity Nodes";
|
||||||
const QString ShowBordersVoxelNodes = "Show Voxel Nodes";
|
const QString ShowBordersVoxelNodes = "Show Voxel Nodes";
|
||||||
const QString ShowIKConstraints = "Show IK Constraints";
|
const QString ShowIKConstraints = "Show IK Constraints";
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include <GeometryCache.h>
|
#include <GeometryCache.h>
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
#include <ResourceCache.h>
|
#include <ResourceCache.h>
|
||||||
#include <Settings.h>
|
|
||||||
#include <TextureCache.h>
|
#include <TextureCache.h>
|
||||||
|
|
||||||
#include "ModelUploader.h"
|
#include "ModelUploader.h"
|
||||||
|
@ -68,10 +67,8 @@ static const int MAX_CHECK = 30;
|
||||||
static const int QCOMPRESS_HEADER_POSITION = 0;
|
static const int QCOMPRESS_HEADER_POSITION = 0;
|
||||||
static const int QCOMPRESS_HEADER_SIZE = 4;
|
static const int QCOMPRESS_HEADER_SIZE = 4;
|
||||||
|
|
||||||
namespace SettingHandles {
|
Setting::Handle<QString> ModelUploader::_lastModelUploadLocation("LastModelUploadLocation",
|
||||||
const SettingHandle<QString> lastModelUploadLocation("LastModelUploadLocation",
|
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
||||||
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelUploader::uploadModel(ModelType modelType) {
|
void ModelUploader::uploadModel(ModelType modelType) {
|
||||||
ModelUploader* uploader = new ModelUploader(modelType);
|
ModelUploader* uploader = new ModelUploader(modelType);
|
||||||
|
@ -118,7 +115,7 @@ ModelUploader::~ModelUploader() {
|
||||||
|
|
||||||
bool ModelUploader::zip() {
|
bool ModelUploader::zip() {
|
||||||
// File Dialog
|
// File Dialog
|
||||||
QString lastLocation = SettingHandles::lastModelUploadLocation.get();
|
QString lastLocation = _lastModelUploadLocation.get();
|
||||||
|
|
||||||
if (lastLocation.isEmpty()) {
|
if (lastLocation.isEmpty()) {
|
||||||
lastLocation = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
lastLocation = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||||
|
@ -135,7 +132,7 @@ bool ModelUploader::zip() {
|
||||||
// If the user canceled we return.
|
// If the user canceled we return.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SettingHandles::lastModelUploadLocation.set(filename);
|
_lastModelUploadLocation.set(filename);
|
||||||
|
|
||||||
// First we check the FST file (if any)
|
// First we check the FST file (if any)
|
||||||
QFile* fst;
|
QFile* fst;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include <FBXReader.h>
|
#include <FBXReader.h>
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "ui/ModelsBrowser.h"
|
#include "ui/ModelsBrowser.h"
|
||||||
|
|
||||||
|
@ -68,13 +69,15 @@ private:
|
||||||
ModelType _modelType;
|
ModelType _modelType;
|
||||||
bool _readyToSend;
|
bool _readyToSend;
|
||||||
|
|
||||||
QHttpMultiPart* _dataMultiPart;
|
QHttpMultiPart* _dataMultiPart = nullptr;
|
||||||
|
|
||||||
int _numberOfChecks;
|
int _numberOfChecks;
|
||||||
QTimer _timer;
|
QTimer _timer;
|
||||||
|
|
||||||
QDialog* _progressDialog;
|
QDialog* _progressDialog = nullptr;
|
||||||
QProgressBar* _progressBar;
|
QProgressBar* _progressBar = nullptr;
|
||||||
|
|
||||||
|
static Setting::Handle<QString> _lastModelUploadLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A dialog that allows customization of various model properties.
|
/// A dialog that allows customization of various model properties.
|
||||||
|
@ -101,23 +104,23 @@ private:
|
||||||
QVariantHash _originalMapping;
|
QVariantHash _originalMapping;
|
||||||
QString _basePath;
|
QString _basePath;
|
||||||
FBXGeometry _geometry;
|
FBXGeometry _geometry;
|
||||||
QLineEdit* _name;
|
QLineEdit* _name = nullptr;
|
||||||
QPushButton* _textureDirectory;
|
QPushButton* _textureDirectory = nullptr;
|
||||||
QDoubleSpinBox* _scale;
|
QDoubleSpinBox* _scale = nullptr;
|
||||||
QDoubleSpinBox* _translationX;
|
QDoubleSpinBox* _translationX = nullptr;
|
||||||
QDoubleSpinBox* _translationY;
|
QDoubleSpinBox* _translationY = nullptr;
|
||||||
QDoubleSpinBox* _translationZ;
|
QDoubleSpinBox* _translationZ = nullptr;
|
||||||
QCheckBox* _pivotAboutCenter;
|
QCheckBox* _pivotAboutCenter = nullptr;
|
||||||
QComboBox* _pivotJoint;
|
QComboBox* _pivotJoint = nullptr;
|
||||||
QComboBox* _leftEyeJoint;
|
QComboBox* _leftEyeJoint = nullptr;
|
||||||
QComboBox* _rightEyeJoint;
|
QComboBox* _rightEyeJoint = nullptr;
|
||||||
QComboBox* _neckJoint;
|
QComboBox* _neckJoint = nullptr;
|
||||||
QComboBox* _rootJoint;
|
QComboBox* _rootJoint = nullptr;
|
||||||
QComboBox* _leanJoint;
|
QComboBox* _leanJoint = nullptr;
|
||||||
QComboBox* _headJoint;
|
QComboBox* _headJoint = nullptr;
|
||||||
QComboBox* _leftHandJoint;
|
QComboBox* _leftHandJoint = nullptr;
|
||||||
QComboBox* _rightHandJoint;
|
QComboBox* _rightHandJoint = nullptr;
|
||||||
QVBoxLayout* _freeJoints;
|
QVBoxLayout* _freeJoints = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_ModelUploader_h
|
#endif // hifi_ModelUploader_h
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
#include <PacketHeaders.h>
|
#include <PacketHeaders.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <Settings.h>
|
|
||||||
#include <ShapeCollider.h>
|
#include <ShapeCollider.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
#include <TextRenderer.h>
|
#include <TextRenderer.h>
|
||||||
|
@ -52,6 +51,7 @@ const float YAW_SPEED = 500.0f; // degrees/sec
|
||||||
const float PITCH_SPEED = 100.0f; // degrees/sec
|
const float PITCH_SPEED = 100.0f; // degrees/sec
|
||||||
const float COLLISION_RADIUS_SCALAR = 1.2f; // pertains to avatar-to-avatar collisions
|
const float COLLISION_RADIUS_SCALAR = 1.2f; // pertains to avatar-to-avatar collisions
|
||||||
const float COLLISION_RADIUS_SCALE = 0.125f;
|
const float COLLISION_RADIUS_SCALE = 0.125f;
|
||||||
|
const float DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES = 30.0f;
|
||||||
|
|
||||||
const float MAX_WALKING_SPEED = 2.5f; // human walking speed
|
const float MAX_WALKING_SPEED = 2.5f; // human walking speed
|
||||||
const float MAX_BOOST_SPEED = 0.5f * MAX_WALKING_SPEED; // keyboard motor gets additive boost below this speed
|
const float MAX_BOOST_SPEED = 0.5f * MAX_WALKING_SPEED; // keyboard motor gets additive boost below this speed
|
||||||
|
@ -90,7 +90,9 @@ MyAvatar::MyAvatar() :
|
||||||
_billboardValid(false),
|
_billboardValid(false),
|
||||||
_physicsSimulation(),
|
_physicsSimulation(),
|
||||||
_feetTouchFloor(true),
|
_feetTouchFloor(true),
|
||||||
_isLookingAtLeftEye(true)
|
_isLookingAtLeftEye(true),
|
||||||
|
_realWorldFieldOfView("realWorldFieldOfView",
|
||||||
|
DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES)
|
||||||
{
|
{
|
||||||
ShapeCollider::initDispatchTable();
|
ShapeCollider::initDispatchTable();
|
||||||
for (int i = 0; i < MAX_DRIVE_KEYS; i++) {
|
for (int i = 0; i < MAX_DRIVE_KEYS; i++) {
|
||||||
|
@ -339,8 +341,8 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
head->setDeltaPitch(estimatedRotation.x);
|
head->setDeltaPitch(estimatedRotation.x);
|
||||||
head->setDeltaYaw(estimatedRotation.y);
|
head->setDeltaYaw(estimatedRotation.y);
|
||||||
} else {
|
} else {
|
||||||
float magnifyFieldOfView = qApp->getViewFrustum()->getFieldOfView() /
|
float magnifyFieldOfView = qApp->getFieldOfView() /
|
||||||
qApp->getViewFrustum()->getRealWorldFieldOfView();
|
_realWorldFieldOfView.get();
|
||||||
head->setDeltaPitch(estimatedRotation.x * magnifyFieldOfView);
|
head->setDeltaPitch(estimatedRotation.x * magnifyFieldOfView);
|
||||||
head->setDeltaYaw(estimatedRotation.y * magnifyFieldOfView);
|
head->setDeltaYaw(estimatedRotation.y * magnifyFieldOfView);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,8 @@
|
||||||
#ifndef hifi_MyAvatar_h
|
#ifndef hifi_MyAvatar_h
|
||||||
#define hifi_MyAvatar_h
|
#define hifi_MyAvatar_h
|
||||||
|
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
#include <PhysicsSimulation.h>
|
#include <PhysicsSimulation.h>
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "Avatar.h"
|
#include "Avatar.h"
|
||||||
|
|
||||||
|
@ -47,12 +46,14 @@ public:
|
||||||
void setLeanScale(float scale) { _leanScale = scale; }
|
void setLeanScale(float scale) { _leanScale = scale; }
|
||||||
void setLocalGravity(glm::vec3 gravity);
|
void setLocalGravity(glm::vec3 gravity);
|
||||||
void setShouldRenderLocally(bool shouldRender) { _shouldRender = shouldRender; }
|
void setShouldRenderLocally(bool shouldRender) { _shouldRender = shouldRender; }
|
||||||
|
void setRealWorldFieldOfView(float realWorldFov) { _realWorldFieldOfView.set(realWorldFov); }
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
float getLeanScale() const { return _leanScale; }
|
float getLeanScale() const { return _leanScale; }
|
||||||
glm::vec3 getGravity() const { return _gravity; }
|
glm::vec3 getGravity() const { return _gravity; }
|
||||||
Q_INVOKABLE glm::vec3 getDefaultEyePosition() const;
|
Q_INVOKABLE glm::vec3 getDefaultEyePosition() const;
|
||||||
bool getShouldRenderLocally() const { return _shouldRender; }
|
bool getShouldRenderLocally() const { return _shouldRender; }
|
||||||
|
float getRealWorldFieldOfView() { return _realWorldFieldOfView.get(); }
|
||||||
|
|
||||||
const QList<AnimationHandlePointer>& getAnimationHandles() const { return _animationHandles; }
|
const QList<AnimationHandlePointer>& getAnimationHandles() const { return _animationHandles; }
|
||||||
AnimationHandlePointer addAnimationHandle();
|
AnimationHandlePointer addAnimationHandle();
|
||||||
|
@ -225,6 +226,8 @@ private:
|
||||||
|
|
||||||
glm::vec3 _trackedHeadPosition;
|
glm::vec3 _trackedHeadPosition;
|
||||||
|
|
||||||
|
Setting::Handle<float> _realWorldFieldOfView;
|
||||||
|
|
||||||
// private methods
|
// private methods
|
||||||
void updateOrientation(float deltaTime);
|
void updateOrientation(float deltaTime);
|
||||||
glm::vec3 applyKeyboardMotor(float deltaTime, const glm::vec3& velocity, bool walkingOnFloor);
|
glm::vec3 applyKeyboardMotor(float deltaTime, const glm::vec3& velocity, bool walkingOnFloor);
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <Settings.h>
|
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
|
||||||
#include "Faceshift.h"
|
#include "Faceshift.h"
|
||||||
|
@ -29,11 +28,6 @@ using namespace std;
|
||||||
const quint16 FACESHIFT_PORT = 33433;
|
const quint16 FACESHIFT_PORT = 33433;
|
||||||
float STARTING_FACESHIFT_FRAME_TIME = 0.033f;
|
float STARTING_FACESHIFT_FRAME_TIME = 0.033f;
|
||||||
|
|
||||||
namespace SettingHandles {
|
|
||||||
const SettingHandle<float> faceshiftEyeDeflection("faceshiftEyeDeflection", DEFAULT_FACESHIFT_EYE_DEFLECTION);
|
|
||||||
const SettingHandle<QString> faceshiftHostname("faceshiftHostname", DEFAULT_FACESHIFT_HOSTNAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
Faceshift::Faceshift() :
|
Faceshift::Faceshift() :
|
||||||
_tcpEnabled(true),
|
_tcpEnabled(true),
|
||||||
_tcpRetryCount(0),
|
_tcpRetryCount(0),
|
||||||
|
@ -61,7 +55,9 @@ Faceshift::Faceshift() :
|
||||||
_jawOpenIndex(21),
|
_jawOpenIndex(21),
|
||||||
_longTermAverageEyePitch(0.0f),
|
_longTermAverageEyePitch(0.0f),
|
||||||
_longTermAverageEyeYaw(0.0f),
|
_longTermAverageEyeYaw(0.0f),
|
||||||
_longTermAverageInitialized(false)
|
_longTermAverageInitialized(false),
|
||||||
|
_eyeDeflection("faceshiftEyeDeflection", DEFAULT_FACESHIFT_EYE_DEFLECTION),
|
||||||
|
_hostname("faceshiftHostname", DEFAULT_FACESHIFT_HOSTNAME)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_FACESHIFT
|
#ifdef HAVE_FACESHIFT
|
||||||
connect(&_tcpSocket, SIGNAL(connected()), SLOT(noteConnected()));
|
connect(&_tcpSocket, SIGNAL(connected()), SLOT(noteConnected()));
|
||||||
|
@ -73,9 +69,6 @@ Faceshift::Faceshift() :
|
||||||
|
|
||||||
_udpSocket.bind(FACESHIFT_PORT);
|
_udpSocket.bind(FACESHIFT_PORT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_eyeDeflection = SettingHandles::faceshiftEyeDeflection.get();
|
|
||||||
_hostname = SettingHandles::faceshiftHostname.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::init() {
|
void Faceshift::init() {
|
||||||
|
@ -169,7 +162,7 @@ void Faceshift::connectSocket() {
|
||||||
qDebug("Faceshift: Connecting...");
|
qDebug("Faceshift: Connecting...");
|
||||||
}
|
}
|
||||||
|
|
||||||
_tcpSocket.connectToHost(_hostname, FACESHIFT_PORT);
|
_tcpSocket.connectToHost(_hostname.get(), FACESHIFT_PORT);
|
||||||
_tracking = false;
|
_tracking = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,11 +314,9 @@ void Faceshift::receive(const QByteArray& buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::setEyeDeflection(float faceshiftEyeDeflection) {
|
void Faceshift::setEyeDeflection(float faceshiftEyeDeflection) {
|
||||||
_eyeDeflection = faceshiftEyeDeflection;
|
_eyeDeflection.set(faceshiftEyeDeflection);
|
||||||
SettingHandles::faceshiftEyeDeflection.set(_eyeDeflection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::setHostname(const QString& hostname) {
|
void Faceshift::setHostname(const QString& hostname) {
|
||||||
_hostname = hostname;
|
_hostname.set(hostname);
|
||||||
SettingHandles::faceshiftHostname.set(_hostname);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "FaceTracker.h"
|
#include "FaceTracker.h"
|
||||||
|
|
||||||
|
@ -62,10 +63,10 @@ public:
|
||||||
float getMouthSmileLeft() const { return getBlendshapeCoefficient(_mouthSmileLeftIndex); }
|
float getMouthSmileLeft() const { return getBlendshapeCoefficient(_mouthSmileLeftIndex); }
|
||||||
float getMouthSmileRight() const { return getBlendshapeCoefficient(_mouthSmileRightIndex); }
|
float getMouthSmileRight() const { return getBlendshapeCoefficient(_mouthSmileRightIndex); }
|
||||||
|
|
||||||
float getEyeDeflection() const { return _eyeDeflection; }
|
float getEyeDeflection() { return _eyeDeflection.get(); }
|
||||||
void setEyeDeflection(float faceshiftEyeDeflection);
|
void setEyeDeflection(float faceshiftEyeDeflection);
|
||||||
|
|
||||||
const QString& getHostname() const { return _hostname; }
|
QString getHostname() { return _hostname.get(); }
|
||||||
void setHostname(const QString& hostname);
|
void setHostname(const QString& hostname);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
@ -151,8 +152,8 @@ private:
|
||||||
float _longTermAverageEyeYaw;
|
float _longTermAverageEyeYaw;
|
||||||
bool _longTermAverageInitialized;
|
bool _longTermAverageInitialized;
|
||||||
|
|
||||||
float _eyeDeflection = DEFAULT_FACESHIFT_EYE_DEFLECTION;
|
Setting::Handle<float> _eyeDeflection;
|
||||||
QString _hostname = DEFAULT_FACESHIFT_HOSTNAME;
|
Setting::Handle<QString> _hostname;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue