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
144144 _enableProcessVoxelsThread(true),
145145 _voxelProcessor(),
146146 _voxelHideShowThread(&_voxels),
147− _voxelEditSender(this),
148− _particleEditSender(this),
149147 _packetsPerSecond(0),
150148 _bytesPerSecond(0),
151149 _recentMaxPackets(0),
@@ -230,6 +228,10 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 78 unmodified lines
230228 nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NODE_TYPE>() << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER
231229 << NODE_TYPE_VOXEL_SERVER << NODE_TYPE_PARTICLE_SERVER
232230 << 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);
233235
234236 // move the silentNodeTimer to the _nodeThread
235237 QTimer* silentNodeTimer = new QTimer();
@@ -639,21 +641,20 @@ void Application::resetProfile(const QString& username) { · 403 unmodified lines
639641 }
640642
641643 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) {
646646 // 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)) {
648648 continue;
649649 }
650−
650+
651651 // 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+
654655 // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)
655656 BandwidthMeter::ChannelIndex channel;
656− switch (nodeTypes[i]) {
657+ switch (type) {
657658 case NODE_TYPE_AGENT:
658659 case NODE_TYPE_AVATAR_MIXER:
659660 channel = BandwidthMeter::AVATARS;
@@ -664,7 +665,7 @@ void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_ · 4 unmodified lines
664665 default:
665666 continue;
666667 }
667− self->_bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * dataBytes);
668+ _bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * dataBytes);
668669 }
669670 }
670671
@@ -1319,15 +1320,13 @@ void Application::wheelEvent(QWheelEvent* event) { · 648 unmodified lines
13191320 }
13201321
13211322 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−
13261323 unsigned char pingPacket[MAX_PACKET_SIZE];
13271324 int length = NodeList::getInstance()->fillPingPacket(pingPacket);
13281325
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);
13311330 }
13321331
13331332 // Every second, check the frame rates and other stuff
@@ -2369,9 +2368,8 @@ void Application::updateAvatar(float deltaTime) { · 1035 unmodified lines
23692368
23702369 endOfBroadcastStringWrite += _myAvatar.getBroadcastData(endOfBroadcastStringWrite);
23712370
2372− const char nodeTypesOfInterest[] = { NODE_TYPE_AVATAR_MIXER };
23732371 controlledBroadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString,
2374− nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
2372+ QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER);
23752373
23762374 // Update _viewFrustum with latest camera and view frustum data...
23772375 // 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
39113909 return statsMessageLength;
39123910 }
39133911
3914−void Application::packetSentNotification(ssize_t length) {
3912+void Application::packetSent(quint64 length) {
39153913 _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(length);
39163914 }
39173915

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