mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:03:11 +02:00
Rename and refactor eye deflection slider
This commit is contained in:
parent
9980233a0d
commit
6c6e3eb758
7 changed files with 24 additions and 20 deletions
|
@ -2367,7 +2367,7 @@ void Application::updateMyAvatarLookAtPosition() {
|
||||||
const float GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT = 0.1f;
|
const float GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT = 0.1f;
|
||||||
glm::vec3 origin = _myAvatar->getHead()->getEyePosition();
|
glm::vec3 origin = _myAvatar->getHead()->getEyePosition();
|
||||||
float pitchSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? -1.0f : 1.0f;
|
float pitchSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? -1.0f : 1.0f;
|
||||||
float deflection = DependencyManager::get<Faceshift>()->getEyeDeflection();
|
float deflection = tracker->getEyeDeflection();
|
||||||
if (isLookingAtSomeone) {
|
if (isLookingAtSomeone) {
|
||||||
deflection *= GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT;
|
deflection *= GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
const int FPS_TIMER_DELAY = 2000; // ms
|
const int FPS_TIMER_DELAY = 2000; // ms
|
||||||
const int FPS_TIMER_DURATION = 2000; // ms
|
const int FPS_TIMER_DURATION = 2000; // ms
|
||||||
|
|
||||||
|
const float DEFAULT_EYE_DEFLECTION = 0.25f;
|
||||||
|
Setting::Handle<float> FaceTracker::_eyeDeflection("faceshiftEyeDeflection", DEFAULT_EYE_DEFLECTION);
|
||||||
|
|
||||||
void FaceTracker::init() {
|
void FaceTracker::init() {
|
||||||
_isMuted = Menu::getInstance()->isOptionChecked(MenuOption::MuteFaceTracking);
|
_isMuted = Menu::getInstance()->isOptionChecked(MenuOption::MuteFaceTracking);
|
||||||
_isInitialized = true; // FaceTracker can be used now
|
_isInitialized = true; // FaceTracker can be used now
|
||||||
|
@ -106,3 +109,7 @@ void FaceTracker::toggleMute() {
|
||||||
_isMuted = !_isMuted;
|
_isMuted = !_isMuted;
|
||||||
emit muteToggled();
|
emit muteToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FaceTracker::setEyeDeflection(float eyeDeflection) {
|
||||||
|
_eyeDeflection.set(eyeDeflection);
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
|
||||||
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
/// Base class for face trackers (Faceshift, DDE).
|
/// Base class for face trackers (Faceshift, DDE).
|
||||||
class FaceTracker : public QObject {
|
class FaceTracker : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -47,6 +49,9 @@ public:
|
||||||
void setIsMuted(bool isMuted) { _isMuted = isMuted; }
|
void setIsMuted(bool isMuted) { _isMuted = isMuted; }
|
||||||
void toggleMute();
|
void toggleMute();
|
||||||
|
|
||||||
|
static float getEyeDeflection() { return _eyeDeflection.get(); }
|
||||||
|
static void setEyeDeflection(float eyeDeflection);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void muteToggled();
|
void muteToggled();
|
||||||
|
|
||||||
|
@ -77,6 +82,8 @@ private slots:
|
||||||
private:
|
private:
|
||||||
bool _isCalculatingFPS = false;
|
bool _isCalculatingFPS = false;
|
||||||
int _frameCount = 0;
|
int _frameCount = 0;
|
||||||
|
|
||||||
|
static Setting::Handle<float> _eyeDeflection;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_FaceTracker_h
|
#endif // hifi_FaceTracker_h
|
||||||
|
|
|
@ -28,10 +28,8 @@ using namespace std;
|
||||||
|
|
||||||
const QString DEFAULT_FACESHIFT_HOSTNAME = "localhost";
|
const QString DEFAULT_FACESHIFT_HOSTNAME = "localhost";
|
||||||
const quint16 FACESHIFT_PORT = 33433;
|
const quint16 FACESHIFT_PORT = 33433;
|
||||||
const float DEFAULT_FACESHIFT_EYE_DEFLECTION = 0.25f;
|
|
||||||
|
|
||||||
Faceshift::Faceshift() :
|
Faceshift::Faceshift() :
|
||||||
_eyeDeflection("faceshiftEyeDeflection", DEFAULT_FACESHIFT_EYE_DEFLECTION),
|
|
||||||
_hostname("faceshiftHostname", DEFAULT_FACESHIFT_HOSTNAME)
|
_hostname("faceshiftHostname", DEFAULT_FACESHIFT_HOSTNAME)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_FACESHIFT
|
#ifdef HAVE_FACESHIFT
|
||||||
|
@ -306,10 +304,6 @@ void Faceshift::receive(const QByteArray& buffer) {
|
||||||
FaceTracker::countFrame();
|
FaceTracker::countFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::setEyeDeflection(float faceshiftEyeDeflection) {
|
|
||||||
_eyeDeflection.set(faceshiftEyeDeflection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Faceshift::setHostname(const QString& hostname) {
|
void Faceshift::setHostname(const QString& hostname) {
|
||||||
_hostname.set(hostname);
|
_hostname.set(hostname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,9 +68,6 @@ 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() { return _eyeDeflection.get(); }
|
|
||||||
void setEyeDeflection(float faceshiftEyeDeflection);
|
|
||||||
|
|
||||||
QString getHostname() { return _hostname.get(); }
|
QString getHostname() { return _hostname.get(); }
|
||||||
void setHostname(const QString& hostname);
|
void setHostname(const QString& hostname);
|
||||||
|
|
||||||
|
@ -134,7 +131,6 @@ private:
|
||||||
float _longTermAverageEyeYaw = 0.0f;
|
float _longTermAverageEyeYaw = 0.0f;
|
||||||
bool _longTermAverageInitialized = false;
|
bool _longTermAverageInitialized = false;
|
||||||
|
|
||||||
Setting::Handle<float> _eyeDeflection;
|
|
||||||
Setting::Handle<QString> _hostname;
|
Setting::Handle<QString> _hostname;
|
||||||
|
|
||||||
// see http://support.faceshift.com/support/articles/35129-export-of-blendshapes
|
// see http://support.faceshift.com/support/articles/35129-export-of-blendshapes
|
||||||
|
|
|
@ -142,10 +142,10 @@ void PreferencesDialog::loadPreferences() {
|
||||||
ui.ddeEyeClosingThresholdSlider->setValue(dde->getEyeClosingThreshold() *
|
ui.ddeEyeClosingThresholdSlider->setValue(dde->getEyeClosingThreshold() *
|
||||||
ui.ddeEyeClosingThresholdSlider->maximum());
|
ui.ddeEyeClosingThresholdSlider->maximum());
|
||||||
|
|
||||||
auto faceshift = DependencyManager::get<Faceshift>();
|
ui.faceTrackerEyeDeflectionSider->setValue(FaceTracker::getEyeDeflection() *
|
||||||
ui.faceshiftEyeDeflectionSider->setValue(faceshift->getEyeDeflection() *
|
ui.faceTrackerEyeDeflectionSider->maximum());
|
||||||
ui.faceshiftEyeDeflectionSider->maximum());
|
|
||||||
|
|
||||||
|
auto faceshift = DependencyManager::get<Faceshift>();
|
||||||
ui.faceshiftHostnameEdit->setText(faceshift->getHostname());
|
ui.faceshiftHostnameEdit->setText(faceshift->getHostname());
|
||||||
|
|
||||||
auto audio = DependencyManager::get<AudioClient>();
|
auto audio = DependencyManager::get<AudioClient>();
|
||||||
|
@ -233,10 +233,10 @@ void PreferencesDialog::savePreferences() {
|
||||||
dde->setEyeClosingThreshold(ui.ddeEyeClosingThresholdSlider->value() /
|
dde->setEyeClosingThreshold(ui.ddeEyeClosingThresholdSlider->value() /
|
||||||
(float)ui.ddeEyeClosingThresholdSlider->maximum());
|
(float)ui.ddeEyeClosingThresholdSlider->maximum());
|
||||||
|
|
||||||
auto faceshift = DependencyManager::get<Faceshift>();
|
FaceTracker::setEyeDeflection(ui.faceTrackerEyeDeflectionSider->value() /
|
||||||
faceshift->setEyeDeflection(ui.faceshiftEyeDeflectionSider->value() /
|
(float)ui.faceTrackerEyeDeflectionSider->maximum());
|
||||||
(float)ui.faceshiftEyeDeflectionSider->maximum());
|
|
||||||
|
|
||||||
|
auto faceshift = DependencyManager::get<Faceshift>();
|
||||||
faceshift->setHostname(ui.faceshiftHostnameEdit->text());
|
faceshift->setHostname(ui.faceshiftHostnameEdit->text());
|
||||||
|
|
||||||
qApp->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value());
|
qApp->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value());
|
||||||
|
|
|
@ -1468,13 +1468,13 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Faceshift eye deflection</string>
|
<string>Face tracker eye deflection</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="indent">
|
<property name="indent">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>faceshiftEyeDeflectionSider</cstring>
|
<cstring>faceTrackerEyeDeflectionSider</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1497,7 +1497,7 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="faceshiftEyeDeflectionSider">
|
<widget class="QSlider" name="faceTrackerEyeDeflectionSider">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
|
Loading…
Reference in a new issue