mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
Working on downloading the faces.
This commit is contained in:
parent
596d0ac471
commit
6be03ac3df
4 changed files with 76 additions and 4 deletions
|
@ -708,6 +708,10 @@ void Menu::editPreferences() {
|
||||||
avatarURL->setMinimumWidth(QLINE_MINIMUM_WIDTH);
|
avatarURL->setMinimumWidth(QLINE_MINIMUM_WIDTH);
|
||||||
form->addRow("Avatar URL:", avatarURL);
|
form->addRow("Avatar URL:", avatarURL);
|
||||||
|
|
||||||
|
QLineEdit* faceURL = new QLineEdit(applicationInstance->getAvatar()->getHead().getBlendFace().getModelURL().toString());
|
||||||
|
faceURL->setMinimumWidth(QLINE_MINIMUM_WIDTH);
|
||||||
|
form->addRow("Face URL:", faceURL);
|
||||||
|
|
||||||
QSpinBox* fieldOfView = new QSpinBox();
|
QSpinBox* fieldOfView = new QSpinBox();
|
||||||
fieldOfView->setMaximum(180);
|
fieldOfView->setMaximum(180);
|
||||||
fieldOfView->setMinimum(1);
|
fieldOfView->setMinimum(1);
|
||||||
|
@ -764,9 +768,12 @@ void Menu::editPreferences() {
|
||||||
NodeList::getInstance()->setDomainHostname(newHostname.constData());
|
NodeList::getInstance()->setDomainHostname(newHostname.constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl url(avatarURL->text());
|
QUrl avatarVoxelURL(avatarURL->text());
|
||||||
applicationInstance->getAvatar()->getVoxels()->setVoxelURL(url);
|
applicationInstance->getAvatar()->getVoxels()->setVoxelURL(avatarVoxelURL);
|
||||||
Avatar::sendAvatarVoxelURLMessage(url);
|
Avatar::sendAvatarVoxelURLMessage(avatarVoxelURL);
|
||||||
|
|
||||||
|
QUrl faceModelURL(faceURL->text());
|
||||||
|
applicationInstance->getAvatar()->getHead().getBlendFace().setModelURL(faceModelURL);
|
||||||
|
|
||||||
_gyroCameraSensitivity = gyroCameraSensitivity->value();
|
_gyroCameraSensitivity = gyroCameraSensitivity->value();
|
||||||
|
|
||||||
|
|
|
@ -786,6 +786,7 @@ void Avatar::loadData(QSettings* settings) {
|
||||||
_position.z = loadSetting(settings, "position_z", 0.0f);
|
_position.z = loadSetting(settings, "position_z", 0.0f);
|
||||||
|
|
||||||
_voxels.setVoxelURL(settings->value("voxelURL").toUrl());
|
_voxels.setVoxelURL(settings->value("voxelURL").toUrl());
|
||||||
|
_head.getBlendFace().setModelURL(settings->value("faceModelURL").toUrl());
|
||||||
|
|
||||||
_leanScale = loadSetting(settings, "leanScale", 0.05f);
|
_leanScale = loadSetting(settings, "leanScale", 0.05f);
|
||||||
|
|
||||||
|
@ -837,6 +838,7 @@ void Avatar::saveData(QSettings* set) {
|
||||||
set->setValue("position_z", _position.z);
|
set->setValue("position_z", _position.z);
|
||||||
|
|
||||||
set->setValue("voxelURL", _voxels.getVoxelURL());
|
set->setValue("voxelURL", _voxels.getVoxelURL());
|
||||||
|
set->setValue("faceModelURL", _head.getBlendFace().getModelURL());
|
||||||
|
|
||||||
set->setValue("leanScale", _leanScale);
|
set->setValue("leanScale", _leanScale);
|
||||||
set->setValue("scale", _newScale);
|
set->setValue("scale", _newScale);
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <numeric>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "BlendFace.h"
|
#include "BlendFace.h"
|
||||||
#include "Head.h"
|
#include "Head.h"
|
||||||
|
|
||||||
|
@ -16,6 +17,7 @@ using namespace std;
|
||||||
|
|
||||||
BlendFace::BlendFace(Head* owningHead) :
|
BlendFace::BlendFace(Head* owningHead) :
|
||||||
_owningHead(owningHead),
|
_owningHead(owningHead),
|
||||||
|
_modelReply(NULL),
|
||||||
_iboID(0)
|
_iboID(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -97,6 +99,30 @@ bool BlendFace::render(float alpha) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlendFace::setModelURL(const QUrl& url) {
|
||||||
|
// don't restart the download if it's the same URL
|
||||||
|
if (_modelURL == url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cancel any current download
|
||||||
|
if (_modelReply != 0) {
|
||||||
|
delete _modelReply;
|
||||||
|
_modelReply = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// remember the URL
|
||||||
|
_modelURL = url;
|
||||||
|
|
||||||
|
// load the URL data asynchronously
|
||||||
|
if (!url.isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_modelReply = Application::getInstance()->getNetworkAccessManager()->get(QNetworkRequest(url));
|
||||||
|
connect(_modelReply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(handleModelDownloadProgress(qint64,qint64)));
|
||||||
|
connect(_modelReply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleModelReplyError()));
|
||||||
|
}
|
||||||
|
|
||||||
void BlendFace::setRig(const fsMsgRig& rig) {
|
void BlendFace::setRig(const fsMsgRig& rig) {
|
||||||
if (rig.mesh().m_tris.empty()) {
|
if (rig.mesh().m_tris.empty()) {
|
||||||
// clear any existing geometry
|
// clear any existing geometry
|
||||||
|
@ -143,3 +169,25 @@ void BlendFace::setRig(const fsMsgRig& rig) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlendFace::handleModelDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) {
|
||||||
|
if (bytesReceived < bytesTotal) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray entirety = _modelReply->readAll();
|
||||||
|
_modelReply->disconnect(this);
|
||||||
|
_modelReply->deleteLater();
|
||||||
|
_modelReply = 0;
|
||||||
|
|
||||||
|
qDebug("Got %d bytes.\n", entirety.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlendFace::handleModelReplyError() {
|
||||||
|
qDebug("%s\n", _modelReply->errorString().toLocal8Bit().constData());
|
||||||
|
|
||||||
|
_modelReply->disconnect(this);
|
||||||
|
_modelReply->deleteLater();
|
||||||
|
_modelReply = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,14 @@
|
||||||
#define __interface__BlendFace__
|
#define __interface__BlendFace__
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include <fsbinarystream.h>
|
#include <fsbinarystream.h>
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
|
class QNetworkReply;
|
||||||
|
|
||||||
class Head;
|
class Head;
|
||||||
|
|
||||||
/// A face formed from a linear mix of blendshapes according to a set of coefficients.
|
/// A face formed from a linear mix of blendshapes according to a set of coefficients.
|
||||||
|
@ -28,14 +31,26 @@ public:
|
||||||
|
|
||||||
bool render(float alpha);
|
bool render(float alpha);
|
||||||
|
|
||||||
|
Q_INVOKABLE void setModelURL(const QUrl& url);
|
||||||
|
const QUrl& getModelURL() const { return _modelURL; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void setRig(const fs::fsMsgRig& rig);
|
void setRig(const fs::fsMsgRig& rig);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void handleModelDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
||||||
|
void handleModelReplyError();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Head* _owningHead;
|
Head* _owningHead;
|
||||||
|
|
||||||
|
QUrl _modelURL;
|
||||||
|
|
||||||
|
QNetworkReply* _modelReply;
|
||||||
|
|
||||||
GLuint _iboID;
|
GLuint _iboID;
|
||||||
GLuint _vboID;
|
GLuint _vboID;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue