History

handle merge with nodelist-patches branch

Stephen Birarda committed 12 years ago

Commit 4ebd5792 parents 349c790 801069715 files · +50 −66Browse files

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

Unified · Split

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

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