History

cleanup Node types, closes #1726

Stephen Birarda committed 12 years ago

Commit 4de270b1 parent fe410ae44 files · +176 −184Browse files

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

Unified · Split

interface/src/Application.cpp+27−27
@@ -182,7 +182,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 181 unmodified lines
182 _nodeThread->setPriority(QThread::TimeCriticalPriority);182 _nodeThread->setPriority(QThread::TimeCriticalPriority);
183 183
184 // put the NodeList and datagram processing on the node thread184 // put the NodeList and datagram processing on the node thread
185 NodeList* nodeList = NodeList::createInstance(NODE_TYPE_AGENT, listenPort);185 NodeList* nodeList = NodeList::createInstance(NodeType::Agent, listenPort);
186 186
187 nodeList->moveToThread(_nodeThread);187 nodeList->moveToThread(_nodeThread);
188 _datagramProcessor.moveToThread(_nodeThread);188 _datagramProcessor.moveToThread(_nodeThread);
@@ -229,9 +229,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 40 unmodified lines
229 #endif229 #endif
230 230
231 // tell the NodeList instance who to tell the domain server we care about231 // tell the NodeList instance who to tell the domain server we care about
232 nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NODE_TYPE>() << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER232 nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NodeType_t>() << NodeType::AudioMixer << NodeType::AvatarMixer
233 << NODE_TYPE_VOXEL_SERVER << NODE_TYPE_PARTICLE_SERVER233 << NodeType::VoxelServer << NodeType::ParticleServer
234 << NODE_TYPE_METAVOXEL_SERVER);234 << NodeType::MetavoxelServer);
235 235
236 // connect to the packet sent signal of the _voxelEditSender and the _particleEditSender236 // connect to the packet sent signal of the _voxelEditSender and the _particleEditSender
237 connect(&_voxelEditSender, &VoxelEditPacketSender::packetSent, this, &Application::packetSent);237 connect(&_voxelEditSender, &VoxelEditPacketSender::packetSent, this, &Application::packetSent);
@@ -649,24 +649,24 @@ void Application::resetProfile(const QString& username) { · 411 unmodified lines
649}649}
650 650
651void Application::controlledBroadcastToNodes(const QByteArray& packet,651void Application::controlledBroadcastToNodes(const QByteArray& packet,
652 const QSet<NODE_TYPE>& destinationNodeTypes) {652 const QSet<NodeType_t>& destinationNodeTypes) {
653 foreach(NODE_TYPE type, destinationNodeTypes) {653 foreach(NodeType_t type, destinationNodeTypes) {
654 // Intercept data to voxel server when voxels are disabled654 // Intercept data to voxel server when voxels are disabled
655 if (type == NODE_TYPE_VOXEL_SERVER && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {655 if (type == NodeType::VoxelServer && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
656 continue;656 continue;
657 }657 }
658 658
659 // Perform the broadcast for one type659 // Perform the broadcast for one type
660 int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, QSet<NODE_TYPE>() << type);660 int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, QSet<NodeType_t>() << type);
661 661
662 // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)662 // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)
663 BandwidthMeter::ChannelIndex channel;663 BandwidthMeter::ChannelIndex channel;
664 switch (type) {664 switch (type) {
665 case NODE_TYPE_AGENT:665 case NodeType::Agent:
666 case NODE_TYPE_AVATAR_MIXER:666 case NodeType::AvatarMixer:
667 channel = BandwidthMeter::AVATARS;667 channel = BandwidthMeter::AVATARS;
668 break;668 break;
669 case NODE_TYPE_VOXEL_SERVER:669 case NodeType::VoxelServer:
670 channel = BandwidthMeter::VOXELS;670 channel = BandwidthMeter::VOXELS;
671 break;671 break;
672 default:672 default:
@@ -1332,10 +1332,10 @@ void Application::wheelEvent(QWheelEvent* event) { · 659 unmodified lines
1332 1332
1333void Application::sendPingPackets() {1333void Application::sendPingPackets() {
1334 QByteArray pingPacket = NodeList::getInstance()->constructPingPacket();1334 QByteArray pingPacket = NodeList::getInstance()->constructPingPacket();
1335 getInstance()->controlledBroadcastToNodes(pingPacket, QSet<NODE_TYPE>() << NODE_TYPE_VOXEL_SERVER1335 getInstance()->controlledBroadcastToNodes(pingPacket, QSet<NodeType_t>() << NodeType::VoxelServer
1336 << NODE_TYPE_PARTICLE_SERVER1336 << NodeType::ParticleServer
1337 << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER1337 << NodeType::AudioMixer << NodeType::AvatarMixer
1338 << NODE_TYPE_METAVOXEL_SERVER);1338 << NodeType::MetavoxelServer);
1339}1339}
1340 1340
1341// Every second, check the frame rates and other stuff1341// Every second, check the frame rates and other stuff
@@ -2363,7 +2363,7 @@ void Application::updateAvatar(float deltaTime) { · 1021 unmodified lines
2363 QByteArray avatarData = byteArrayWithPopluatedHeader(PacketTypeAvatarData);2363 QByteArray avatarData = byteArrayWithPopluatedHeader(PacketTypeAvatarData);
2364 avatarData.append(_myAvatar.toByteArray());2364 avatarData.append(_myAvatar.toByteArray());
2365 2365
2366 controlledBroadcastToNodes(avatarData, QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER);2366 controlledBroadcastToNodes(avatarData, QSet<NodeType_t>() << NodeType::AvatarMixer);
2367 2367
2368 // Update _viewFrustum with latest camera and view frustum data...2368 // Update _viewFrustum with latest camera and view frustum data...
2369 // NOTE: we get this from the view frustum, to make it simpler, since the2369 // NOTE: we get this from the view frustum, to make it simpler, since the
@@ -2374,11 +2374,11 @@ void Application::updateAvatar(float deltaTime) { · 4 unmodified lines
2374 loadViewFrustum(_myCamera, _viewFrustum);2374 loadViewFrustum(_myCamera, _viewFrustum);
2375 2375
2376 // Update my voxel servers with my current voxel query...2376 // Update my voxel servers with my current voxel query...
2377 queryOctree(NODE_TYPE_VOXEL_SERVER, PacketTypeVoxelQuery, _voxelServerJurisdictions);2377 queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions);
2378 queryOctree(NODE_TYPE_PARTICLE_SERVER, PacketTypeParticleQuery, _particleServerJurisdictions);2378 queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions);
2379}2379}
2380 2380
2381void Application::queryOctree(NODE_TYPE serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {2381void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
2382 2382
2383 // if voxels are disabled, then don't send this at all...2383 // if voxels are disabled, then don't send this at all...
2384 if (!Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {2384 if (!Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
@@ -3192,8 +3192,8 @@ void Application::displayStats() { · 807 unmodified lines
3192 int pingAudio = 0, pingAvatar = 0, pingVoxel = 0, pingVoxelMax = 0;3192 int pingAudio = 0, pingAvatar = 0, pingVoxel = 0, pingVoxelMax = 0;
3193 3193
3194 NodeList* nodeList = NodeList::getInstance();3194 NodeList* nodeList = NodeList::getInstance();
3195 SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);3195 SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
3196 SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);3196 SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NodeType::AvatarMixer);
3197 3197
3198 pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : 0;3198 pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : 0;
3199 pingAvatar = avatarMixerNode ? avatarMixerNode->getPingMs() : 0;3199 pingAvatar = avatarMixerNode ? avatarMixerNode->getPingMs() : 0;
@@ -3203,7 +3203,7 @@ void Application::displayStats() { · 3 unmodified lines
3203 int voxelServerCount = 0;3203 int voxelServerCount = 0;
3204 3204
3205 foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {3205 foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
3206 if (node->getType() == NODE_TYPE_VOXEL_SERVER) {3206 if (node->getType() == NodeType::VoxelServer) {
3207 totalPingVoxel += node->getPingMs();3207 totalPingVoxel += node->getPingMs();
3208 voxelServerCount++;3208 voxelServerCount++;
3209 if (pingVoxelMax < node->getPingMs()) {3209 if (pingVoxelMax < node->getPingMs()) {
@@ -3274,7 +3274,7 @@ void Application::displayStats() { · 64 unmodified lines
3274 drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, avatarBodyYaw, .93f, .93f, .93f);3274 drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, avatarBodyYaw, .93f, .93f, .93f);
3275 3275
3276 if (_statsExpanded) {3276 if (_statsExpanded) {
3277 SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);3277 SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NodeType::AvatarMixer);
3278 if (avatarMixer) {3278 if (avatarMixer) {
3279 sprintf(avatarMixerStats, "Avatar Mixer: %.f kbps, %.f pps",3279 sprintf(avatarMixerStats, "Avatar Mixer: %.f kbps, %.f pps",
3280 roundf(avatarMixer->getAverageKilobitsPerSecond()),3280 roundf(avatarMixer->getAverageKilobitsPerSecond()),
@@ -3952,7 +3952,7 @@ void Application::domainChanged(const QString& domainHostname) { · 671 unmodified lines
3952}3952}
3953 3953
3954void Application::nodeKilled(SharedNodePointer node) {3954void Application::nodeKilled(SharedNodePointer node) {
3955 if (node->getType() == NODE_TYPE_VOXEL_SERVER) {3955 if (node->getType() == NodeType::VoxelServer) {
3956 QUuid nodeUUID = node->getUUID();3956 QUuid nodeUUID = node->getUUID();
3957 // see if this is the first we've heard of this node...3957 // see if this is the first we've heard of this node...
3958 if (_voxelServerJurisdictions.find(nodeUUID) != _voxelServerJurisdictions.end()) {3958 if (_voxelServerJurisdictions.find(nodeUUID) != _voxelServerJurisdictions.end()) {
@@ -3983,7 +3983,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 24 unmodified lines
3983 }3983 }
3984 _voxelSceneStatsLock.unlock();3984 _voxelSceneStatsLock.unlock();
3985 3985
3986 } else if (node->getType() == NODE_TYPE_PARTICLE_SERVER) {3986 } else if (node->getType() == NodeType::ParticleServer) {
3987 QUuid nodeUUID = node->getUUID();3987 QUuid nodeUUID = node->getUUID();
3988 // see if this is the first we've heard of this node...3988 // see if this is the first we've heard of this node...
3989 if (_particleServerJurisdictions.find(nodeUUID) != _particleServerJurisdictions.end()) {3989 if (_particleServerJurisdictions.find(nodeUUID) != _particleServerJurisdictions.end()) {
@@ -4014,7 +4014,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 24 unmodified lines
4014 }4014 }
4015 _voxelSceneStatsLock.unlock();4015 _voxelSceneStatsLock.unlock();
4016 4016
4017 } else if (node->getType() == NODE_TYPE_AVATAR_MIXER) {4017 } else if (node->getType() == NodeType::AvatarMixer) {
4018 // our avatar mixer has gone away - clear the hash of avatars4018 // our avatar mixer has gone away - clear the hash of avatars
4019 _avatarManager.clearHash();4019 _avatarManager.clearHash();
4020 }4020 }
@@ -4066,7 +4066,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const HifiSockAddr& · 45 unmodified lines
4066 4066
4067 // see if this is the first we've heard of this node...4067 // see if this is the first we've heard of this node...
4068 NodeToJurisdictionMap* jurisdiction = NULL;4068 NodeToJurisdictionMap* jurisdiction = NULL;
4069 if (server->getType() == NODE_TYPE_VOXEL_SERVER) {4069 if (server->getType() == NodeType::VoxelServer) {
4070 jurisdiction = &_voxelServerJurisdictions;4070 jurisdiction = &_voxelServerJurisdictions;
4071 } else {4071 } else {
4072 jurisdiction = &_particleServerJurisdictions;4072 jurisdiction = &_particleServerJurisdictions;

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