More settings update

This commit is contained in:
Atlante45 2015-02-03 10:30:14 -08:00
parent fdade344a3
commit 09a9f82256
14 changed files with 112 additions and 136 deletions

View file

@ -1575,14 +1575,12 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa
void Application::loadSettings() {
DependencyManager::get<Audio>()->loadSettings();
DependencyManager::get<LODManager>()->loadSettings();
Menu::getInstance()->loadSettings();
_myAvatar->loadData();
}
void Application::saveSettings() {
DependencyManager::get<Audio>()->saveSettings();
DependencyManager::get<LODManager>()->saveSettings();
Menu::getInstance()->saveSettings();
_myAvatar->saveData();
}

View file

@ -28,6 +28,7 @@
#include <AbstractAudioInterface.h>
#include <AudioRingBuffer.h>
#include <DependencyManager.h>
#include <SettingHandle.h>
#include <StDev.h>
#include "audio/AudioIOStats.h"

View file

@ -16,14 +16,15 @@
#include "LODManager.h"
namespace SettingHandles {
const SettingHandle<bool> automaticAvatarLOD("automaticAvatarLOD", true);
const SettingHandle<float> avatarLODDecreaseFPS("avatarLODDecreaseFPS", DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS);
const SettingHandle<float> avatarLODIncreaseFPS("avatarLODIncreaseFPS", ADJUST_LOD_UP_FPS);
const SettingHandle<float> avatarLODDistanceMultiplier("avatarLODDistanceMultiplier",
DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER);
const SettingHandle<int> boundaryLevelAdjust("boundaryLevelAdjust", 0);
const SettingHandle<float> octreeSizeScale("octreeSizeScale", DEFAULT_OCTREE_SIZE_SCALE);
LODManager::LODManager() :
_automaticAvatarLOD("automaticAvatarLOD", true),
_avatarLODDecreaseFPS("avatarLODDecreaseFPS", DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS),
_avatarLODIncreaseFPS("avatarLODIncreaseFPS", ADJUST_LOD_UP_FPS),
_avatarLODDistanceMultiplier("avatarLODDistanceMultiplier",
DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER),
_boundaryLevelAdjust("boundaryLevelAdjust", 0),
_octreeSizeScale("octreeSizeScale", DEFAULT_OCTREE_SIZE_SCALE)
{
}
void LODManager::autoAdjustLOD(float currentFPS) {
@ -41,23 +42,25 @@ void LODManager::autoAdjustLOD(float currentFPS) {
quint64 now = usecTimestampNow();
const quint64 ADJUST_AVATAR_LOD_DOWN_DELAY = 1000 * 1000;
if (_automaticAvatarLOD) {
if (_fastFPSAverage.getAverage() < _avatarLODDecreaseFPS) {
if (_automaticAvatarLOD.get()) {
if (_fastFPSAverage.getAverage() < _avatarLODDecreaseFPS.get()) {
if (now - _lastAvatarDetailDrop > ADJUST_AVATAR_LOD_DOWN_DELAY) {
// 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();
const float MAXIMUM_MULTIPLIER_SCALE = 2.0f;
_avatarLODDistanceMultiplier = qMin(MAXIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER, _avatarLODDistanceMultiplier *
(averageFps < EPSILON ? MAXIMUM_MULTIPLIER_SCALE :
qMin(MAXIMUM_MULTIPLIER_SCALE, targetFps / averageFps)));
_avatarLODDistanceMultiplier.set(qMin(MAXIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER,
_avatarLODDistanceMultiplier.get() *
(averageFps < EPSILON ? MAXIMUM_MULTIPLIER_SCALE :
qMin(MAXIMUM_MULTIPLIER_SCALE,
targetFps / averageFps))));
_lastAvatarDetailDrop = now;
}
} else if (_fastFPSAverage.getAverage() > _avatarLODIncreaseFPS) {
} else if (_fastFPSAverage.getAverage() > _avatarLODIncreaseFPS.get()) {
// let the detail level creep slowly upwards
const float DISTANCE_DECREASE_RATE = 0.05f;
_avatarLODDistanceMultiplier = qMax(MINIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER,
_avatarLODDistanceMultiplier - DISTANCE_DECREASE_RATE);
_avatarLODDistanceMultiplier.set(qMax(MINIMUM_AVATAR_LOD_DISTANCE_MULTIPLIER,
_avatarLODDistanceMultiplier.get() - DISTANCE_DECREASE_RATE));
}
}
@ -65,29 +68,29 @@ void LODManager::autoAdjustLOD(float currentFPS) {
quint64 elapsed = now - _lastAdjust;
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) {
_octreeSizeScale = ADJUST_LOD_MIN_SIZE_SCALE;
if (_octreeSizeScale.get() < ADJUST_LOD_MIN_SIZE_SCALE) {
_octreeSizeScale.set(ADJUST_LOD_MIN_SIZE_SCALE);
}
changed = true;
_lastAdjust = now;
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
&& _octreeSizeScale < ADJUST_LOD_MAX_SIZE_SCALE) {
_octreeSizeScale *= ADJUST_LOD_UP_BY;
if (_octreeSizeScale > ADJUST_LOD_MAX_SIZE_SCALE) {
_octreeSizeScale = ADJUST_LOD_MAX_SIZE_SCALE;
&& _octreeSizeScale.get() < ADJUST_LOD_MAX_SIZE_SCALE) {
_octreeSizeScale.set(_octreeSizeScale.get() * ADJUST_LOD_UP_BY);
if (_octreeSizeScale.get() > ADJUST_LOD_MAX_SIZE_SCALE) {
_octreeSizeScale.set(ADJUST_LOD_MAX_SIZE_SCALE);
}
changed = true;
_lastAdjust = now;
qDebug() << "adjusting LOD up... average fps for last approximately 5 seconds=" << _fpsAverage.getAverage()
<< "_octreeSizeScale=" << _octreeSizeScale;
<< "_octreeSizeScale=" << _octreeSizeScale.get();
}
if (changed) {
@ -179,32 +182,13 @@ bool LODManager::shouldRenderMesh(float largestDimension, float distanceToCamera
}
void LODManager::setOctreeSizeScale(float sizeScale) {
_octreeSizeScale = sizeScale;
_octreeSizeScale.set(sizeScale);
_shouldRenderTableNeedsRebuilding = true;
}
void LODManager::setBoundaryLevelAdjust(int boundaryLevelAdjust) {
_boundaryLevelAdjust = boundaryLevelAdjust;
_boundaryLevelAdjust.set(boundaryLevelAdjust);
_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());
}

View file

@ -14,7 +14,7 @@
#include <DependencyManager.h>
#include <OctreeConstants.h>
#include <Settings.h>
#include <SettingHandle.h>
#include <SharedUtil.h>
#include <SimpleMovingAverage.h>
@ -43,41 +43,38 @@ class LODManager : public Dependency {
SINGLETON_DEPENDENCY
public:
void setAutomaticAvatarLOD(bool automaticAvatarLOD) { _automaticAvatarLOD = automaticAvatarLOD; }
bool getAutomaticAvatarLOD() const { return _automaticAvatarLOD; }
void setAvatarLODDecreaseFPS(float avatarLODDecreaseFPS) { _avatarLODDecreaseFPS = avatarLODDecreaseFPS; }
float getAvatarLODDecreaseFPS() const { return _avatarLODDecreaseFPS; }
void setAvatarLODIncreaseFPS(float avatarLODIncreaseFPS) { _avatarLODIncreaseFPS = avatarLODIncreaseFPS; }
float getAvatarLODIncreaseFPS() const { return _avatarLODIncreaseFPS; }
void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier = multiplier; }
float getAvatarLODDistanceMultiplier() const { return _avatarLODDistanceMultiplier; }
void setAutomaticAvatarLOD(bool automaticAvatarLOD) { _automaticAvatarLOD.set(automaticAvatarLOD); }
bool getAutomaticAvatarLOD() { return _automaticAvatarLOD.get(); }
void setAvatarLODDecreaseFPS(float avatarLODDecreaseFPS) { _avatarLODDecreaseFPS.set(avatarLODDecreaseFPS); }
float getAvatarLODDecreaseFPS() { return _avatarLODDecreaseFPS.get(); }
void setAvatarLODIncreaseFPS(float avatarLODIncreaseFPS) { _avatarLODIncreaseFPS.set(avatarLODIncreaseFPS); }
float getAvatarLODIncreaseFPS() { return _avatarLODIncreaseFPS.get(); }
void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier.set(multiplier); }
float getAvatarLODDistanceMultiplier() { return _avatarLODDistanceMultiplier.get(); }
// User Tweakable LOD Items
QString getLODFeedbackText();
void setOctreeSizeScale(float sizeScale);
float getOctreeSizeScale() const { return _octreeSizeScale; }
float getOctreeSizeScale() { return _octreeSizeScale.get(); }
void setBoundaryLevelAdjust(int boundaryLevelAdjust);
int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; }
int getBoundaryLevelAdjust() { return _boundaryLevelAdjust.get(); }
void autoAdjustLOD(float currentFPS);
void resetLODAdjust();
bool shouldRenderMesh(float largestDimension, float distanceToCamera);
void loadSettings();
void saveSettings();
private:
LODManager() {}
LODManager();
bool _automaticAvatarLOD = true;
float _avatarLODDecreaseFPS = DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS;
float _avatarLODIncreaseFPS = ADJUST_LOD_UP_FPS;
float _avatarLODDistanceMultiplier = DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER;
Setting::Handle<bool> _automaticAvatarLOD;
Setting::Handle<float> _avatarLODDecreaseFPS;
Setting::Handle<float> _avatarLODIncreaseFPS;
Setting::Handle<float> _avatarLODDistanceMultiplier;
float _octreeSizeScale = DEFAULT_OCTREE_SIZE_SCALE;
int _boundaryLevelAdjust = 0;
Setting::Handle<int> _boundaryLevelAdjust;
Setting::Handle<float> _octreeSizeScale;
quint64 _lastAdjust = 0;
quint64 _lastAvatarDetailDrop = 0;

View file

@ -18,24 +18,20 @@
#include <QHideEvent>
#include <QWindowStateChangeEvent>
#include <Settings.h>
#include "MainWindow.h"
#include "Menu.h"
#include "Util.h"
namespace SettingHandles {
const SettingHandle<QRect> windowGeometry("WindowGeometry");
}
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) {
MainWindow::MainWindow(QWidget* parent) :
QMainWindow(parent),
_windowGeometry("WindowGeometry")
{
}
void MainWindow::restoreGeometry() {
// Did not use setGeometry() on purpose,
// 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());
resize(geometry.size());
}
@ -44,7 +40,7 @@ void MainWindow::saveGeometry() {
// Did not use geometry() on purpose,
// see http://doc.qt.io/qt-5/qsettings.html#restoring-the-state-of-a-gui-application
QRect geometry(pos(), size());
SettingHandles::windowGeometry.set(geometry);
_windowGeometry.set(geometry);
}
void MainWindow::moveEvent(QMoveEvent* event) {

View file

@ -14,6 +14,8 @@
#include <QMainWindow>
#include <SettingHandle.h>
class MainWindow : public QMainWindow {
Q_OBJECT
public:
@ -33,6 +35,9 @@ protected:
virtual void showEvent(QShowEvent* event);
virtual void hideEvent(QHideEvent* event);
virtual void changeEvent(QEvent* event);
private:
Setting::Handle<QRect> _windowGeometry;
};
#endif /* defined(__hifi__MainWindow__) */

View file

@ -17,7 +17,7 @@
#include <DependencyManager.h>
#include <GlowEffect.h>
#include <PathUtils.h>
#include <Settings.h>
#include <SettingHandle.h>
#include <UserActivityLogger.h>
#include <XmppClient.h>

View file

@ -239,8 +239,6 @@ namespace MenuOption {
const QString RunTimingTests = "Run Timing Tests";
const QString ScriptEditor = "Script Editor...";
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 ShowBordersVoxelNodes = "Show Voxel Nodes";
const QString ShowIKConstraints = "Show IK Constraints";

View file

@ -38,7 +38,6 @@
#include <GeometryCache.h>
#include <GLMHelpers.h>
#include <ResourceCache.h>
#include <Settings.h>
#include <TextureCache.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_SIZE = 4;
namespace SettingHandles {
const SettingHandle<QString> lastModelUploadLocation("LastModelUploadLocation",
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
}
Setting::Handle<QString> ModelUploader::_lastModelUploadLocation("LastModelUploadLocation",
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
void ModelUploader::uploadModel(ModelType modelType) {
ModelUploader* uploader = new ModelUploader(modelType);
@ -118,7 +115,7 @@ ModelUploader::~ModelUploader() {
bool ModelUploader::zip() {
// File Dialog
QString lastLocation = SettingHandles::lastModelUploadLocation.get();
QString lastLocation = _lastModelUploadLocation.get();
if (lastLocation.isEmpty()) {
lastLocation = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
@ -135,7 +132,7 @@ bool ModelUploader::zip() {
// If the user canceled we return.
return false;
}
SettingHandles::lastModelUploadLocation.set(filename);
_lastModelUploadLocation.set(filename);
// First we check the FST file (if any)
QFile* fst;

View file

@ -16,6 +16,7 @@
#include <QTimer>
#include <FBXReader.h>
#include <SettingHandle.h>
#include "ui/ModelsBrowser.h"
@ -68,13 +69,15 @@ private:
ModelType _modelType;
bool _readyToSend;
QHttpMultiPart* _dataMultiPart;
QHttpMultiPart* _dataMultiPart = nullptr;
int _numberOfChecks;
QTimer _timer;
QDialog* _progressDialog;
QProgressBar* _progressBar;
QDialog* _progressDialog = nullptr;
QProgressBar* _progressBar = nullptr;
static Setting::Handle<QString> _lastModelUploadLocation;
};
/// A dialog that allows customization of various model properties.
@ -101,23 +104,23 @@ private:
QVariantHash _originalMapping;
QString _basePath;
FBXGeometry _geometry;
QLineEdit* _name;
QPushButton* _textureDirectory;
QDoubleSpinBox* _scale;
QDoubleSpinBox* _translationX;
QDoubleSpinBox* _translationY;
QDoubleSpinBox* _translationZ;
QCheckBox* _pivotAboutCenter;
QComboBox* _pivotJoint;
QComboBox* _leftEyeJoint;
QComboBox* _rightEyeJoint;
QComboBox* _neckJoint;
QComboBox* _rootJoint;
QComboBox* _leanJoint;
QComboBox* _headJoint;
QComboBox* _leftHandJoint;
QComboBox* _rightHandJoint;
QVBoxLayout* _freeJoints;
QLineEdit* _name = nullptr;
QPushButton* _textureDirectory = nullptr;
QDoubleSpinBox* _scale = nullptr;
QDoubleSpinBox* _translationX = nullptr;
QDoubleSpinBox* _translationY = nullptr;
QDoubleSpinBox* _translationZ = nullptr;
QCheckBox* _pivotAboutCenter = nullptr;
QComboBox* _pivotJoint = nullptr;
QComboBox* _leftEyeJoint = nullptr;
QComboBox* _rightEyeJoint = nullptr;
QComboBox* _neckJoint = nullptr;
QComboBox* _rootJoint = nullptr;
QComboBox* _leanJoint = nullptr;
QComboBox* _headJoint = nullptr;
QComboBox* _leftHandJoint = nullptr;
QComboBox* _rightHandJoint = nullptr;
QVBoxLayout* _freeJoints = nullptr;
};
#endif // hifi_ModelUploader_h

View file

@ -28,7 +28,6 @@
#include <NodeList.h>
#include <PacketHeaders.h>
#include <PerfStat.h>
#include <Settings.h>
#include <ShapeCollider.h>
#include <SharedUtil.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 COLLISION_RADIUS_SCALAR = 1.2f; // pertains to avatar-to-avatar collisions
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_BOOST_SPEED = 0.5f * MAX_WALKING_SPEED; // keyboard motor gets additive boost below this speed
@ -90,7 +90,9 @@ MyAvatar::MyAvatar() :
_billboardValid(false),
_physicsSimulation(),
_feetTouchFloor(true),
_isLookingAtLeftEye(true)
_isLookingAtLeftEye(true),
_realWorldFieldOfView("realWorldFieldOfView",
DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES)
{
ShapeCollider::initDispatchTable();
for (int i = 0; i < MAX_DRIVE_KEYS; i++) {
@ -339,8 +341,8 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
head->setDeltaPitch(estimatedRotation.x);
head->setDeltaYaw(estimatedRotation.y);
} else {
float magnifyFieldOfView = qApp->getViewFrustum()->getFieldOfView() /
qApp->getViewFrustum()->getRealWorldFieldOfView();
float magnifyFieldOfView = qApp->getFieldOfView() /
_realWorldFieldOfView.get();
head->setDeltaPitch(estimatedRotation.x * magnifyFieldOfView);
head->setDeltaYaw(estimatedRotation.y * magnifyFieldOfView);
}

View file

@ -12,9 +12,8 @@
#ifndef hifi_MyAvatar_h
#define hifi_MyAvatar_h
#include <QSettings>
#include <PhysicsSimulation.h>
#include <SettingHandle.h>
#include "Avatar.h"
@ -47,12 +46,14 @@ public:
void setLeanScale(float scale) { _leanScale = scale; }
void setLocalGravity(glm::vec3 gravity);
void setShouldRenderLocally(bool shouldRender) { _shouldRender = shouldRender; }
void setRealWorldFieldOfView(float realWorldFov) { _realWorldFieldOfView.set(realWorldFov); }
// getters
float getLeanScale() const { return _leanScale; }
glm::vec3 getGravity() const { return _gravity; }
Q_INVOKABLE glm::vec3 getDefaultEyePosition() const;
bool getShouldRenderLocally() const { return _shouldRender; }
float getRealWorldFieldOfView() { return _realWorldFieldOfView.get(); }
const QList<AnimationHandlePointer>& getAnimationHandles() const { return _animationHandles; }
AnimationHandlePointer addAnimationHandle();
@ -225,6 +226,8 @@ private:
glm::vec3 _trackedHeadPosition;
Setting::Handle<float> _realWorldFieldOfView;
// private methods
void updateOrientation(float deltaTime);
glm::vec3 applyKeyboardMotor(float deltaTime, const glm::vec3& velocity, bool walkingOnFloor);

View file

@ -13,7 +13,6 @@
#include <GLMHelpers.h>
#include <PerfStat.h>
#include <Settings.h>
#include <SharedUtil.h>
#include "Faceshift.h"
@ -29,11 +28,6 @@ using namespace std;
const quint16 FACESHIFT_PORT = 33433;
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() :
_tcpEnabled(true),
_tcpRetryCount(0),
@ -61,7 +55,9 @@ Faceshift::Faceshift() :
_jawOpenIndex(21),
_longTermAverageEyePitch(0.0f),
_longTermAverageEyeYaw(0.0f),
_longTermAverageInitialized(false)
_longTermAverageInitialized(false),
_eyeDeflection("faceshiftEyeDeflection", DEFAULT_FACESHIFT_EYE_DEFLECTION),
_hostname("faceshiftHostname", DEFAULT_FACESHIFT_HOSTNAME)
{
#ifdef HAVE_FACESHIFT
connect(&_tcpSocket, SIGNAL(connected()), SLOT(noteConnected()));
@ -73,9 +69,6 @@ Faceshift::Faceshift() :
_udpSocket.bind(FACESHIFT_PORT);
#endif
_eyeDeflection = SettingHandles::faceshiftEyeDeflection.get();
_hostname = SettingHandles::faceshiftHostname.get();
}
void Faceshift::init() {
@ -169,7 +162,7 @@ void Faceshift::connectSocket() {
qDebug("Faceshift: Connecting...");
}
_tcpSocket.connectToHost(_hostname, FACESHIFT_PORT);
_tcpSocket.connectToHost(_hostname.get(), FACESHIFT_PORT);
_tracking = false;
}
}
@ -321,11 +314,9 @@ void Faceshift::receive(const QByteArray& buffer) {
}
void Faceshift::setEyeDeflection(float faceshiftEyeDeflection) {
_eyeDeflection = faceshiftEyeDeflection;
SettingHandles::faceshiftEyeDeflection.set(_eyeDeflection);
_eyeDeflection.set(faceshiftEyeDeflection);
}
void Faceshift::setHostname(const QString& hostname) {
_hostname = hostname;
SettingHandles::faceshiftHostname.set(_hostname);
_hostname.set(hostname);
}

View file

@ -20,6 +20,7 @@
#endif
#include <DependencyManager.h>
#include <SettingHandle.h>
#include "FaceTracker.h"
@ -62,10 +63,10 @@ public:
float getMouthSmileLeft() const { return getBlendshapeCoefficient(_mouthSmileLeftIndex); }
float getMouthSmileRight() const { return getBlendshapeCoefficient(_mouthSmileRightIndex); }
float getEyeDeflection() const { return _eyeDeflection; }
float getEyeDeflection() { return _eyeDeflection.get(); }
void setEyeDeflection(float faceshiftEyeDeflection);
const QString& getHostname() const { return _hostname; }
QString getHostname() { return _hostname.get(); }
void setHostname(const QString& hostname);
void update();
@ -151,8 +152,8 @@ private:
float _longTermAverageEyeYaw;
bool _longTermAverageInitialized;
float _eyeDeflection = DEFAULT_FACESHIFT_EYE_DEFLECTION;
QString _hostname = DEFAULT_FACESHIFT_HOSTNAME;
Setting::Handle<float> _eyeDeflection;
Setting::Handle<QString> _hostname;
};