History

Merge remote-tracking branch 'upstream/master' into particles

Jeffrey Ventrella committed 13 years ago

Commit 6e844812 parents 7f3750f 4b0899641 files · +3689 −97Browse files

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

Unified · Split

interface/src/Application.cpp+52−5
@@ -938,6 +938,36 @@ void Application::sendPingPackets() { · 937 unmodified lines
938 nodesToPing, sizeof(nodesToPing));938 nodesToPing, sizeof(nodesToPing));
939}939}
940 940
941void Application::sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data) {
942 unsigned char packet[MAX_PACKET_SIZE];
943 unsigned char* packetPosition = packet;
944
945 packetPosition += populateTypeAndVersion(packetPosition, PACKET_TYPE_AVATAR_FACE_VIDEO);
946
947 *(uint16_t*)packetPosition = NodeList::getInstance()->getOwnerID();
948 packetPosition += sizeof(uint16_t);
949
950 *(uint32_t*)packetPosition = frameCount;
951 packetPosition += sizeof(uint32_t);
952
953 *(uint32_t*)packetPosition = data.size();
954 packetPosition += sizeof(uint32_t);
955
956 uint32_t* offsetPosition = (uint32_t*)packetPosition;
957 packetPosition += sizeof(uint32_t);
958
959 int headerSize = packetPosition - packet;
960
961 // break the data up into submessages of the maximum size
962 *offsetPosition = 0;
963 while (*offsetPosition < data.size()) {
964 int payloadSize = min(data.size() - (int)*offsetPosition, MAX_PACKET_SIZE - headerSize);
965 memcpy(packetPosition, data.constData() + *offsetPosition, payloadSize);
966 getInstance()->controlledBroadcastToNodes(packet, headerSize + payloadSize, &NODE_TYPE_AVATAR_MIXER, 1);
967 *offsetPosition += payloadSize;
968 }
969}
970
941// Every second, check the frame rates and other stuff971// Every second, check the frame rates and other stuff
942void Application::timer() {972void Application::timer() {
943 gettimeofday(&_timerEnd, NULL);973 gettimeofday(&_timerEnd, NULL);
@@ -1047,7 +1077,7 @@ void Application::sendAvatarVoxelURLMessage(const QUrl& url) { · 103 unmodified lines
1047 controlledBroadcastToNodes((unsigned char*)message.data(), message.size(), & NODE_TYPE_AVATAR_MIXER, 1);1077 controlledBroadcastToNodes((unsigned char*)message.data(), message.size(), & NODE_TYPE_AVATAR_MIXER, 1);
1048}1078}
1049 1079
1050void Application::processAvatarVoxelURLMessage(unsigned char *packetData, size_t dataBytes) {1080static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) {
1051 // skip the header1081 // skip the header
1052 int numBytesPacketHeader = numBytesForPacketHeader(packetData);1082 int numBytesPacketHeader = numBytesForPacketHeader(packetData);
1053 packetData += numBytesPacketHeader;1083 packetData += numBytesPacketHeader;
@@ -1061,18 +1091,31 @@ void Application::processAvatarVoxelURLMessage(unsigned char *packetData, size_t · 7 unmodified lines
1061 // make sure the node exists1091 // make sure the node exists
1062 Node* node = NodeList::getInstance()->nodeWithID(nodeID);1092 Node* node = NodeList::getInstance()->nodeWithID(nodeID);
1063 if (!node || !node->getLinkedData()) {1093 if (!node || !node->getLinkedData()) {
1064 return;1094 return NULL;
1065 }1095 }
1066 Avatar* avatar = static_cast<Avatar*>(node->getLinkedData());1096 Avatar* avatar = static_cast<Avatar*>(node->getLinkedData());
1067 if (!avatar->isInitialized()) {1097 return avatar->isInitialized() ? avatar : NULL;
1068 return; // wait until initialized1098}
1069 }1099
1100void Application::processAvatarVoxelURLMessage(unsigned char* packetData, size_t dataBytes) {
1101 Avatar* avatar = processAvatarMessageHeader(packetData, dataBytes);
1102 if (!avatar) {
1103 return;
1104 }
1070 QUrl url = QUrl::fromEncoded(QByteArray((char*)packetData, dataBytes));1105 QUrl url = QUrl::fromEncoded(QByteArray((char*)packetData, dataBytes));
1071 1106
1072 // invoke the set URL function on the simulate/render thread1107 // invoke the set URL function on the simulate/render thread
1073 QMetaObject::invokeMethod(avatar->getVoxels(), "setVoxelURL", Q_ARG(QUrl, url));1108 QMetaObject::invokeMethod(avatar->getVoxels(), "setVoxelURL", Q_ARG(QUrl, url));
1074}1109}
1075 1110
1111void Application::processAvatarFaceVideoMessage(unsigned char* packetData, size_t dataBytes) {
1112 Avatar* avatar = processAvatarMessageHeader(packetData, dataBytes);
1113 if (!avatar) {
1114 return;
1115 }
1116 avatar->getHead().getFace().processVideoMessage(packetData, dataBytes);
1117}
1118
1076void Application::checkBandwidthMeterClick() {1119void Application::checkBandwidthMeterClick() {
1077 // ... to be called upon button release1120 // ... to be called upon button release
1078 1121
@@ -1682,6 +1725,7 @@ void Application::initMenu() { · 603 unmodified lines
1682 (_renderAvatarBalls = renderMenu->addAction("Avatar as Balls"))->setCheckable(true);1725 (_renderAvatarBalls = renderMenu->addAction("Avatar as Balls"))->setCheckable(true);
1683 _renderAvatarBalls->setChecked(false);1726 _renderAvatarBalls->setChecked(false);
1684 renderMenu->addAction("Cycle Voxel Mode", _myAvatar.getVoxels(), SLOT(cycleMode()));1727 renderMenu->addAction("Cycle Voxel Mode", _myAvatar.getVoxels(), SLOT(cycleMode()));
1728 renderMenu->addAction("Cycle Face Mode", &_myAvatar.getHead().getFace(), SLOT(cycleRenderMode()));
1685 (_renderFrameTimerOn = renderMenu->addAction("Show Timer"))->setCheckable(true);1729 (_renderFrameTimerOn = renderMenu->addAction("Show Timer"))->setCheckable(true);
1686 _renderFrameTimerOn->setChecked(false);1730 _renderFrameTimerOn->setChecked(false);
1687 (_renderLookatOn = renderMenu->addAction("Lookat Vectors"))->setCheckable(true);1731 (_renderLookatOn = renderMenu->addAction("Lookat Vectors"))->setCheckable(true);
@@ -3402,6 +3446,9 @@ void* Application::networkReceive(void* args) { · 1714 unmodified lines
3402 case PACKET_TYPE_AVATAR_VOXEL_URL:3446 case PACKET_TYPE_AVATAR_VOXEL_URL:
3403 processAvatarVoxelURLMessage(app->_incomingPacket, bytesReceived);3447 processAvatarVoxelURLMessage(app->_incomingPacket, bytesReceived);
3404 break;3448 break;
3449 case PACKET_TYPE_AVATAR_FACE_VIDEO:
3450 processAvatarFaceVideoMessage(app->_incomingPacket, bytesReceived);
3451 break;
3405 default:3452 default:
3406 NodeList::getInstance()->processNodeData(&senderAddress, app->_incomingPacket, bytesReceived);3453 NodeList::getInstance()->processNodeData(&senderAddress, app->_incomingPacket, bytesReceived);
3407 break;3454 break;

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