mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
further patching to conditionally build without Faceshift
This commit is contained in:
parent
b2a99edb2e
commit
10ed33cb38
2 changed files with 24 additions and 25 deletions
|
@ -63,37 +63,31 @@ Faceshift::Faceshift() :
|
||||||
_udpSocket.bind(FACESHIFT_PORT);
|
_udpSocket.bind(FACESHIFT_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::init() {
|
|
||||||
setTCPEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Faceshift));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Faceshift::isConnectedOrConnecting() const {
|
|
||||||
return _tcpSocket.state() == QAbstractSocket::ConnectedState ||
|
|
||||||
(_tcpRetryCount == 0 && _tcpSocket.state() != QAbstractSocket::UnconnectedState);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Faceshift::isActive() const {
|
|
||||||
const quint64 ACTIVE_TIMEOUT_USECS = 1000000;
|
|
||||||
return (usecTimestampNow() - _lastTrackingStateReceived) < ACTIVE_TIMEOUT_USECS;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
Faceshift::Faceshift() {
|
Faceshift::Faceshift() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void Faceshift::init() {
|
||||||
|
setTCPEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Faceshift));
|
||||||
|
}
|
||||||
|
|
||||||
bool Faceshift::isConnectedOrConnecting() const {
|
bool Faceshift::isConnectedOrConnecting() const {
|
||||||
return false;
|
return _tcpSocket.state() == QAbstractSocket::ConnectedState ||
|
||||||
|
(_tcpRetryCount == 0 && _tcpSocket.state() != QAbstractSocket::UnconnectedState);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Faceshift::isActive() const {
|
bool Faceshift::isActive() const {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_FACESHIFT
|
#ifdef HAVE_FACESHIFT
|
||||||
|
const quint64 ACTIVE_TIMEOUT_USECS = 1000000;
|
||||||
|
return (usecTimestampNow() - _lastTrackingStateReceived) < ACTIVE_TIMEOUT_USECS;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void Faceshift::update() {
|
void Faceshift::update() {
|
||||||
if (!isActive()) {
|
if (!isActive()) {
|
||||||
|
@ -120,12 +114,14 @@ void Faceshift::update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::reset() {
|
void Faceshift::reset() {
|
||||||
|
#ifdef HAVE_FACESHIFT
|
||||||
if (_tcpSocket.state() == QAbstractSocket::ConnectedState) {
|
if (_tcpSocket.state() == QAbstractSocket::ConnectedState) {
|
||||||
string message;
|
string message;
|
||||||
fsBinaryStream::encode_message(message, fsMsgCalibrateNeutral());
|
fsBinaryStream::encode_message(message, fsMsgCalibrateNeutral());
|
||||||
send(message);
|
send(message);
|
||||||
}
|
}
|
||||||
_longTermAverageInitialized = false;
|
_longTermAverageInitialized = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::updateFakeCoefficients(float leftBlink, float rightBlink, float browUp,
|
void Faceshift::updateFakeCoefficients(float leftBlink, float rightBlink, float browUp,
|
||||||
|
@ -161,11 +157,13 @@ void Faceshift::connectSocket() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::noteConnected() {
|
void Faceshift::noteConnected() {
|
||||||
|
#ifdef HAVE_FACESHIFT
|
||||||
qDebug("Faceshift: Connected.");
|
qDebug("Faceshift: Connected.");
|
||||||
// request the list of blendshape names
|
// request the list of blendshape names
|
||||||
string message;
|
string message;
|
||||||
fsBinaryStream::encode_message(message, fsMsgSendBlendshapeNames());
|
fsBinaryStream::encode_message(message, fsMsgSendBlendshapeNames());
|
||||||
send(message);
|
send(message);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::noteError(QAbstractSocket::SocketError error) {
|
void Faceshift::noteError(QAbstractSocket::SocketError error) {
|
||||||
|
@ -202,6 +200,7 @@ void Faceshift::send(const std::string& message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::receive(const QByteArray& buffer) {
|
void Faceshift::receive(const QByteArray& buffer) {
|
||||||
|
#ifdef HAVE_FACESHIFT
|
||||||
_stream.received(buffer.size(), buffer.constData());
|
_stream.received(buffer.size(), buffer.constData());
|
||||||
fsMsgPtr msg;
|
fsMsgPtr msg;
|
||||||
for (fsMsgPtr msg; (msg = _stream.get_message()); ) {
|
for (fsMsgPtr msg; (msg = _stream.get_message()); ) {
|
||||||
|
@ -282,6 +281,5 @@ void Faceshift::receive(const QByteArray& buffer) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -35,8 +35,6 @@ public:
|
||||||
bool isConnectedOrConnecting() const;
|
bool isConnectedOrConnecting() const;
|
||||||
|
|
||||||
bool isActive() const;
|
bool isActive() const;
|
||||||
|
|
||||||
#ifdef HAVE_FACESHIFT
|
|
||||||
|
|
||||||
const glm::vec3& getHeadAngularVelocity() const { return _headAngularVelocity; }
|
const glm::vec3& getHeadAngularVelocity() const { return _headAngularVelocity; }
|
||||||
|
|
||||||
|
@ -93,7 +91,11 @@ private:
|
||||||
|
|
||||||
QTcpSocket _tcpSocket;
|
QTcpSocket _tcpSocket;
|
||||||
QUdpSocket _udpSocket;
|
QUdpSocket _udpSocket;
|
||||||
|
|
||||||
|
#ifdef HAVE_FACESHIFT
|
||||||
fs::fsBinaryStream _stream;
|
fs::fsBinaryStream _stream;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool _tcpEnabled;
|
bool _tcpEnabled;
|
||||||
int _tcpRetryCount;
|
int _tcpRetryCount;
|
||||||
bool _tracking;
|
bool _tracking;
|
||||||
|
@ -129,7 +131,6 @@ private:
|
||||||
float _longTermAverageEyeYaw;
|
float _longTermAverageEyeYaw;
|
||||||
bool _longTermAverageInitialized;
|
bool _longTermAverageInitialized;
|
||||||
|
|
||||||
#endif // HAVE_FACESHIFT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Faceshift_h
|
#endif // hifi_Faceshift_h
|
||||||
|
|
Loading…
Reference in a new issue