mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Try using the eye coefficients rather than the eye directions reported by
Faceshift.
This commit is contained in:
parent
218ac4641b
commit
37aa909322
2 changed files with 54 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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__) */
|
||||
|
|
Loading…
Reference in a new issue