diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 1092066edd..8c865f906c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -358,6 +358,8 @@ Application::~Application() { _myAvatar = NULL; delete _glWidget; + + AccountManager::getInstance().destroy(); } void Application::restoreSizeAndPosition() { diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index d537b86854..7ada8b0764 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -135,10 +135,10 @@ void Avatar::simulate(float deltaTime) { getHand()->simulate(deltaTime, false); _skeletonModel.setLODDistance(getLODDistance()); - _skeletonModel.simulate(deltaTime, _shouldRenderBillboard); - glm::vec3 headPosition; - if (!_skeletonModel.getHeadPosition(headPosition)) { - headPosition = _position; + glm::vec3 headPosition = _position; + if (!_shouldRenderBillboard) { + _skeletonModel.simulate(deltaTime); + _skeletonModel.getHeadPosition(headPosition); } Head* head = getHead(); head->setPosition(headPosition); diff --git a/interface/src/avatar/Head.cpp b/interface/src/avatar/Head.cpp index 91cf3ab07f..74bf983eb1 100644 --- a/interface/src/avatar/Head.cpp +++ b/interface/src/avatar/Head.cpp @@ -58,7 +58,7 @@ void Head::reset() { -void Head::simulate(float deltaTime, bool isMine, bool delayLoad) { +void Head::simulate(float deltaTime, bool isMine, bool billboard) { // Update audio trailing average for rendering facial animations Faceshift* faceshift = Application::getInstance()->getFaceshift(); @@ -75,7 +75,7 @@ void Head::simulate(float deltaTime, bool isMine, bool delayLoad) { } } - if (!_isFaceshiftConnected) { + if (!(_isFaceshiftConnected || billboard)) { // Update eye saccades const float AVERAGE_MICROSACCADE_INTERVAL = 0.50f; const float AVERAGE_SACCADE_INTERVAL = 4.0f; @@ -161,11 +161,10 @@ void Head::simulate(float deltaTime, bool isMine, bool delayLoad) { if (!isMine) { _faceModel.setLODDistance(static_cast(_owningAvatar)->getLODDistance()); } - _faceModel.simulate(deltaTime, delayLoad); - - // the blend face may have custom eye meshes - if (!_faceModel.getEyePositions(_leftEyePosition, _rightEyePosition)) { - _leftEyePosition = _rightEyePosition = getPosition(); + _leftEyePosition = _rightEyePosition = getPosition(); + if (!billboard) { + _faceModel.simulate(deltaTime); + _faceModel.getEyePositions(_leftEyePosition, _rightEyePosition); } _eyePosition = calculateAverageEyePosition(); } diff --git a/interface/src/avatar/Head.h b/interface/src/avatar/Head.h index 5c8e1e8769..7e7a96a3a7 100644 --- a/interface/src/avatar/Head.h +++ b/interface/src/avatar/Head.h @@ -36,7 +36,7 @@ public: void init(); void reset(); - void simulate(float deltaTime, bool isMine, bool delayLoad = false); + void simulate(float deltaTime, bool isMine, bool billboard = false); void render(float alpha); void setScale(float scale); void setPosition(glm::vec3 position) { _position = position; } diff --git a/libraries/shared/src/AccountManager.cpp b/libraries/shared/src/AccountManager.cpp index 0f39ba4146..888d42ddda 100644 --- a/libraries/shared/src/AccountManager.cpp +++ b/libraries/shared/src/AccountManager.cpp @@ -35,7 +35,7 @@ const QString ACCOUNTS_GROUP = "accounts"; AccountManager::AccountManager() : _authURL(), - _networkAccessManager(), + _networkAccessManager(new QNetworkAccessManager(this)), _pendingCallbackMap(), _accountInfo() { @@ -130,16 +130,16 @@ void AccountManager::invokedRequest(const QString& path, QNetworkAccessManager:: switch (operation) { case QNetworkAccessManager::GetOperation: - networkReply = _networkAccessManager.get(authenticatedRequest); + networkReply = _networkAccessManager->get(authenticatedRequest); break; case QNetworkAccessManager::PostOperation: case QNetworkAccessManager::PutOperation: authenticatedRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); if (operation == QNetworkAccessManager::PostOperation) { - networkReply = _networkAccessManager.post(authenticatedRequest, dataByteArray); + networkReply = _networkAccessManager->post(authenticatedRequest, dataByteArray); } else { - networkReply = _networkAccessManager.put(authenticatedRequest, dataByteArray); + networkReply = _networkAccessManager->put(authenticatedRequest, dataByteArray); } break; @@ -242,7 +242,7 @@ void AccountManager::requestAccessToken(const QString& login, const QString& pas request.setUrl(grantURL); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - QNetworkReply* requestReply = _networkAccessManager.post(request, postData); + QNetworkReply* requestReply = _networkAccessManager->post(request, postData); connect(requestReply, &QNetworkReply::finished, this, &AccountManager::requestFinished); connect(requestReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(requestError(QNetworkReply::NetworkError))); } @@ -292,4 +292,4 @@ void AccountManager::requestFinished() { void AccountManager::requestError(QNetworkReply::NetworkError error) { // TODO: error handling qDebug() << "AccountManager requestError - " << error; -} \ No newline at end of file +} diff --git a/libraries/shared/src/AccountManager.h b/libraries/shared/src/AccountManager.h index 654549791e..8b3c6b362c 100644 --- a/libraries/shared/src/AccountManager.h +++ b/libraries/shared/src/AccountManager.h @@ -53,6 +53,8 @@ public: QString getUsername() const { return _accountInfo.getUsername(); } + void destroy() { delete _networkAccessManager; } + public slots: void requestFinished(); void requestError(QNetworkReply::NetworkError error); @@ -76,7 +78,7 @@ private: const JSONCallbackParameters& callbackParams, const QByteArray& dataByteArray); QUrl _authURL; - QNetworkAccessManager _networkAccessManager; + QNetworkAccessManager* _networkAccessManager; QMap _pendingCallbackMap; DataServerAccountInfo _accountInfo;