History

Include the face model URL in the same packet as the avatar voxel URL.

Andrzej Kapolka committed 13 years ago

Commit a04ced61 parent fff10379 files · +34 −28Browse files

Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all

Unified · Split

interface/src/Application.cpp+18−13
@@ -1230,15 +1230,19 @@ static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& da · 1229 unmodified lines
12301230 return avatar->isInitialized() ? avatar : NULL;
12311231 }
12321232
1233−void Application::processAvatarVoxelURLMessage(unsigned char* packetData, size_t dataBytes) {
1233+void Application::processAvatarURLsMessage(unsigned char* packetData, size_t dataBytes) {
12341234 Avatar* avatar = processAvatarMessageHeader(packetData, dataBytes);
12351235 if (!avatar) {
12361236 return;
1237− }
1238− QUrl url = QUrl::fromEncoded(QByteArray((char*)packetData, dataBytes));
1237+ }
1238+ QDataStream in(QByteArray((char*)packetData, dataBytes));
1239+ QUrl voxelURL, faceURL;
1240+ in >> voxelURL;
1241+ in >> faceURL;
12391242
1240− // invoke the set URL function on the simulate/render thread
1241− QMetaObject::invokeMethod(avatar->getVoxels(), "setVoxelURL", Q_ARG(QUrl, url));
1243+ // invoke the set URL functions on the simulate/render thread
1244+ QMetaObject::invokeMethod(avatar->getVoxels(), "setVoxelURL", Q_ARG(QUrl, voxelURL));
1245+ QMetaObject::invokeMethod(&avatar->getHead().getBlendFace(), "setModelURL", Q_ARG(QUrl, faceURL));
12421246 }
12431247
12441248 void Application::processAvatarFaceVideoMessage(unsigned char* packetData, size_t dataBytes) {
@@ -1564,8 +1568,8 @@ void Application::init() { · 319 unmodified lines
15641568
15651569 qDebug("Loaded settings.\n");
15661570
1567− Avatar::sendAvatarVoxelURLMessage(_myAvatar.getVoxels()->getVoxelURL());
1568−
1571+ Avatar::sendAvatarURLsMessage(_myAvatar.getVoxels()->getVoxelURL(), _myAvatar.getHead().getBlendFace().getModelURL());
1572+
15691573 _palette.init(_glWidget->width(), _glWidget->height());
15701574 _palette.addAction(Menu::getInstance()->getActionForOption(MenuOption::VoxelAddMode), 0, 0);
15711575 _palette.addAction(Menu::getInstance()->getActionForOption(MenuOption::VoxelDeleteMode), 0, 1);
@@ -2136,10 +2140,11 @@ void Application::updateAvatar(float deltaTime) { · 564 unmodified lines
21362140 controlledBroadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString,
21372141 nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
21382142
2139− // once in a while, send my voxel url
2140− const float AVATAR_VOXEL_URL_SEND_INTERVAL = 1.0f; // seconds
2141− if (shouldDo(AVATAR_VOXEL_URL_SEND_INTERVAL, deltaTime)) {
2142− Avatar::sendAvatarVoxelURLMessage(_myAvatar.getVoxels()->getVoxelURL());
2143+ // once in a while, send my urls
2144+ const float AVATAR_URLS_SEND_INTERVAL = 1.0f; // seconds
2145+ if (shouldDo(AVATAR_URLS_SEND_INTERVAL, deltaTime)) {
2146+ Avatar::sendAvatarURLsMessage(_myAvatar.getVoxels()->getVoxelURL(),
2147+ _myAvatar.getHead().getBlendFace().getModelURL());
21432148 }
21442149 }
21452150 }
@@ -3510,8 +3515,8 @@ void* Application::networkReceive(void* args) { · 1364 unmodified lines
35103515 bytesReceived);
35113516 getInstance()->_bandwidthMeter.inputStream(BandwidthMeter::AVATARS).updateValue(bytesReceived);
35123517 break;
3513− case PACKET_TYPE_AVATAR_VOXEL_URL:
3514− processAvatarVoxelURLMessage(app->_incomingPacket, bytesReceived);
3518+ case PACKET_TYPE_AVATAR_URLS:
3519+ processAvatarURLsMessage(app->_incomingPacket, bytesReceived);
35153520 break;
35163521 case PACKET_TYPE_AVATAR_FACE_VIDEO:
35173522 processAvatarFaceVideoMessage(app->_incomingPacket, bytesReceived);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t