mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
Merge pull request #2176 from ey6es/master
Don't simulate avatars when they're being rendered as billboards, fix QThreadStorage warning.
This commit is contained in:
commit
dd41459b65
6 changed files with 22 additions and 19 deletions
|
@ -358,6 +358,8 @@ Application::~Application() {
|
|||
_myAvatar = NULL;
|
||||
|
||||
delete _glWidget;
|
||||
|
||||
AccountManager::getInstance().destroy();
|
||||
}
|
||||
|
||||
void Application::restoreSizeAndPosition() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Avatar*>(_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();
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<QNetworkReply*, JSONCallbackParameters> _pendingCallbackMap;
|
||||
|
||||
DataServerAccountInfo _accountInfo;
|
||||
|
|
Loading…
Reference in a new issue