Showing the changes to interface/src/Application.cpp (1 of 15 files). Show all
Unified · Split
| @@ -144,8 +144,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 143 unmodified lines | ||
| 144 | 144 | _enableProcessVoxelsThread(true), |
| 145 | 145 | _voxelProcessor(), |
| 146 | 146 | _voxelHideShowThread(&_voxels), |
| 147 | − _voxelEditSender(this), | |
| 148 | − _particleEditSender(this), | |
| 149 | 147 | _packetsPerSecond(0), |
| 150 | 148 | _bytesPerSecond(0), |
| 151 | 149 | _recentMaxPackets(0), |
| @@ -230,6 +228,10 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 78 unmodified lines | ||
| 230 | 228 | nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NODE_TYPE>() << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER |
| 231 | 229 | << NODE_TYPE_VOXEL_SERVER << NODE_TYPE_PARTICLE_SERVER |
| 232 | 230 | << NODE_TYPE_METAVOXEL_SERVER); |
| 231 | + | |
| 232 | + // connect to the packet sent signal of the _voxelEditSender and the _particleEditSender | |
| 233 | + connect(&_voxelEditSender, &VoxelEditPacketSender::packetSent, this, &Application::packetSent); | |
| 234 | + connect(&_particleEditSender, &ParticleEditPacketSender::packetSent, this, &Application::packetSent); | |
| 233 | 235 | |
| 234 | 236 | // move the silentNodeTimer to the _nodeThread |
| 235 | 237 | QTimer* silentNodeTimer = new QTimer(); |
| @@ -639,21 +641,20 @@ void Application::resetProfile(const QString& username) { · 403 unmodified lines | ||
| 639 | 641 | } |
| 640 | 642 | |
| 641 | 643 | void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_t dataBytes, |
| 642 | − const char* nodeTypes, int numNodeTypes) { | |
| 643 | − Application* self = getInstance(); | |
| 644 | − for (int i = 0; i < numNodeTypes; ++i) { | |
| 645 | − | |
| 644 | + const QSet<NODE_TYPE>& destinationNodeTypes) { | |
| 645 | + foreach(NODE_TYPE type, destinationNodeTypes) { | |
| 646 | 646 | // Intercept data to voxel server when voxels are disabled |
| 647 | − if (nodeTypes[i] == NODE_TYPE_VOXEL_SERVER && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { | |
| 647 | + if (type == NODE_TYPE_VOXEL_SERVER && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { | |
| 648 | 648 | continue; |
| 649 | 649 | } |
| 650 | − | |
| 650 | + | |
| 651 | 651 | // Perform the broadcast for one type |
| 652 | − int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(broadcastData, dataBytes, & nodeTypes[i], 1); | |
| 653 | − | |
| 652 | + int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(broadcastData, dataBytes, | |
| 653 | + QSet<NODE_TYPE>() << type); | |
| 654 | + | |
| 654 | 655 | // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise) |
| 655 | 656 | BandwidthMeter::ChannelIndex channel; |
| 656 | − switch (nodeTypes[i]) { | |
| 657 | + switch (type) { | |
| 657 | 658 | case NODE_TYPE_AGENT: |
| 658 | 659 | case NODE_TYPE_AVATAR_MIXER: |
| 659 | 660 | channel = BandwidthMeter::AVATARS; |
| @@ -664,7 +665,7 @@ void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_ · 4 unmodified lines | ||
| 664 | 665 | default: |
| 665 | 666 | continue; |
| 666 | 667 | } |
| 667 | − self->_bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * dataBytes); | |
| 668 | + _bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * dataBytes); | |
| 668 | 669 | } |
| 669 | 670 | } |
| 670 | 671 | |
| @@ -1319,15 +1320,13 @@ void Application::wheelEvent(QWheelEvent* event) { · 648 unmodified lines | ||
| 1319 | 1320 | } |
| 1320 | 1321 | |
| 1321 | 1322 | void Application::sendPingPackets() { |
| 1322 | − | |
| 1323 | − const char nodesToPing[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_PARTICLE_SERVER, | |
| 1324 | − NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_METAVOXEL_SERVER}; | |
| 1325 | − | |
| 1326 | 1323 | unsigned char pingPacket[MAX_PACKET_SIZE]; |
| 1327 | 1324 | int length = NodeList::getInstance()->fillPingPacket(pingPacket); |
| 1328 | 1325 | |
| 1329 | − getInstance()->controlledBroadcastToNodes(pingPacket, length, | |
| 1330 | − nodesToPing, sizeof(nodesToPing)); | |
| 1326 | + getInstance()->controlledBroadcastToNodes(pingPacket, length, QSet<NODE_TYPE>() | |
| 1327 | + << NODE_TYPE_VOXEL_SERVER << NODE_TYPE_PARTICLE_SERVER | |
| 1328 | + << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER | |
| 1329 | + << NODE_TYPE_METAVOXEL_SERVER); | |
| 1331 | 1330 | } |
| 1332 | 1331 | |
| 1333 | 1332 | // Every second, check the frame rates and other stuff |
| @@ -2369,9 +2368,8 @@ void Application::updateAvatar(float deltaTime) { · 1035 unmodified lines | ||
| 2369 | 2368 | |
| 2370 | 2369 | endOfBroadcastStringWrite += _myAvatar.getBroadcastData(endOfBroadcastStringWrite); |
| 2371 | 2370 | |
| 2372 | − const char nodeTypesOfInterest[] = { NODE_TYPE_AVATAR_MIXER }; | |
| 2373 | 2371 | controlledBroadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString, |
| 2374 | − nodeTypesOfInterest, sizeof(nodeTypesOfInterest)); | |
| 2372 | + QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER); | |
| 2375 | 2373 | |
| 2376 | 2374 | // Update _viewFrustum with latest camera and view frustum data... |
| 2377 | 2375 | // NOTE: we get this from the view frustum, to make it simpler, since the |
| @@ -3911,7 +3909,7 @@ int Application::parseOctreeStats(unsigned char* messageData, ssize_t messageLen · 1533 unmodified lines | ||
| 3911 | 3909 | return statsMessageLength; |
| 3912 | 3910 | } |
| 3913 | 3911 | |
| 3914 | −void Application::packetSentNotification(ssize_t length) { | |
| 3912 | +void Application::packetSent(quint64 length) { | |
| 3915 | 3913 | _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(length); |
| 3916 | 3914 | } |
| 3917 | 3915 | |