diff --git a/interface/src/devices/Faceshift.cpp b/interface/src/devices/Faceshift.cpp index 4418d19223..5e35d23415 100644 --- a/interface/src/devices/Faceshift.cpp +++ b/interface/src/devices/Faceshift.cpp @@ -26,7 +26,11 @@ Faceshift::Faceshift() : _browHeight(0.0f), _browUpCenterIndex(-1), _mouthSize(0.0f), - _jawOpenIndex(-1) + _jawOpenIndex(-1), + _leftEyeUpIndex(-1), + _leftEyeInIndex(-1), + _rightEyeUpIndex(-1), + _rightEyeInIndex(-1) { connect(&_socket, SIGNAL(connected()), SLOT(noteConnected())); connect(&_socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(noteError(QAbstractSocket::SocketError))); @@ -108,6 +112,21 @@ void Faceshift::readFromSocket() { if (_jawOpenIndex != -1) { _mouthSize = data.m_coeffs[_jawOpenIndex]; } + const float PITCH_SCALE = 45.0f; + if (_leftEyeUpIndex != -1) { + _eyeGazeLeftPitch = PITCH_SCALE * (data.m_coeffs[_leftEyeUpIndex] - data.m_coeffs[_leftEyeDownIndex]); + } + const float YAW_SCALE = 45.0f; + if (_leftEyeInIndex != -1) { + _eyeGazeLeftYaw = YAW_SCALE * (data.m_coeffs[_leftEyeOutIndex] - data.m_coeffs[_leftEyeInIndex]); + } + if (_rightEyeUpIndex != -1) { + _eyeGazeRightPitch = PITCH_SCALE * (data.m_coeffs[_rightEyeUpIndex] - + data.m_coeffs[_rightEyeDownIndex]); + } + if (_rightEyeInIndex != -1) { + _eyeGazeRightYaw = YAW_SCALE * (data.m_coeffs[_rightEyeInIndex] - data.m_coeffs[_rightEyeOutIndex]); + } } break; } @@ -125,6 +144,30 @@ void Faceshift::readFromSocket() { } else if (names[i] == "JawOpen") { _jawOpenIndex = i; + + } else if (names[i] == "EyeUp_L") { + _leftEyeUpIndex = i; + + } else if (names[i] == "EyeDown_L") { + _leftEyeDownIndex = i; + + } else if (names[i] == "EyeIn_L") { + _leftEyeInIndex = i; + + } else if (names[i] == "EyeOut_L") { + _leftEyeOutIndex = i; + + } else if (names[i] == "EyeUp_R") { + _rightEyeUpIndex = i; + + } else if (names[i] == "EyeDown_R") { + _rightEyeDownIndex = i; + + } else if (names[i] == "EyeIn_R") { + _rightEyeInIndex = i; + + } else if (names[i] == "EyeOut_R") { + _rightEyeOutIndex = i; } } break; diff --git a/interface/src/devices/Faceshift.h b/interface/src/devices/Faceshift.h index 286a7a56a1..745ce6f099 100644 --- a/interface/src/devices/Faceshift.h +++ b/interface/src/devices/Faceshift.h @@ -85,6 +85,16 @@ private: float _mouthSize; int _jawOpenIndex; + + int _leftEyeUpIndex; + int _leftEyeDownIndex; + int _leftEyeInIndex; + int _leftEyeOutIndex; + + int _rightEyeUpIndex; + int _rightEyeDownIndex; + int _rightEyeInIndex; + int _rightEyeOutIndex; }; #endif /* defined(__interface__Faceshift__) */