Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all
Unified · Split
| @@ -165,7 +165,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 164 unmodified lines | |||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | NodeList* nodeList = NodeList::createInstance(NODE_TYPE_AGENT, listenPort); | 167 | NodeList* nodeList = NodeList::createInstance(NODE_TYPE_AGENT, listenPort); |
| 168 | 168 | ||
| 169 | // connect our processDatagrams slot to the QUDPSocket readyRead() signal | 169 | // connect our processDatagrams slot to the QUDPSocket readyRead() signal |
| 170 | connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(processDatagrams())); | 170 | connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(processDatagrams())); |
| 171 | 171 | ||
| @@ -176,7 +176,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 4 unmodified lines | |||
| 176 | connect(audioThread, SIGNAL(started()), &_audio, SLOT(start())); | 176 | connect(audioThread, SIGNAL(started()), &_audio, SLOT(start())); |
| 177 | 177 | ||
| 178 | audioThread->start(); | 178 | audioThread->start(); |
| 179 | 179 | ||
| 180 | connect(nodeList, SIGNAL(domainChanged(const QString&)), SLOT(domainChanged(const QString&))); | 180 | connect(nodeList, SIGNAL(domainChanged(const QString&)), SLOT(domainChanged(const QString&))); |
| 181 | 181 | ||
| 182 | connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer))); | 182 | connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer))); |
| @@ -209,7 +209,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 26 unmodified lines | |||
| 209 | #endif | 209 | #endif |
| 210 | 210 | ||
| 211 | // tell the NodeList instance who to tell the domain server we care about | 211 | // tell the NodeList instance who to tell the domain server we care about |
| 212 | const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER, | 212 | const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER, |
| 213 | NODE_TYPE_PARTICLE_SERVER, NODE_TYPE_METAVOXEL_SERVER}; | 213 | NODE_TYPE_PARTICLE_SERVER, NODE_TYPE_METAVOXEL_SERVER}; |
| 214 | nodeList->setNodeTypesOfInterest(nodeTypesOfInterest, sizeof(nodeTypesOfInterest)); | 214 | nodeList->setNodeTypesOfInterest(nodeTypesOfInterest, sizeof(nodeTypesOfInterest)); |
| 215 | 215 | ||
| @@ -1416,8 +1416,10 @@ void Application::terminate() { · 1200 unmodified lines | |||
| 1416 | _voxelHideShowThread.terminate(); | 1416 | _voxelHideShowThread.terminate(); |
| 1417 | _voxelEditSender.terminate(); | 1417 | _voxelEditSender.terminate(); |
| 1418 | _particleEditSender.terminate(); | 1418 | _particleEditSender.terminate(); |
| 1419 | _persistThread->terminate(); | 1419 | if (_persistThread) { |
| 1420 | _persistThread = NULL; | 1420 | _persistThread->terminate(); |
| 1421 | _persistThread = NULL; | ||
| 1422 | } | ||
| 1421 | } | 1423 | } |
| 1422 | 1424 | ||
| 1423 | static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) { | 1425 | static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) { |
| @@ -1966,12 +1968,12 @@ Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, con · 542 unmodified lines | |||
| 1966 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { | 1968 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| 1967 | Avatar* avatar = (Avatar*)node->getLinkedData(); | 1969 | Avatar* avatar = (Avatar*)node->getLinkedData(); |
| 1968 | float distance; | 1970 | float distance; |
| 1969 | 1971 | ||
| 1970 | if (avatar->findRayIntersection(mouseRayOrigin, mouseRayDirection, distance)) { | 1972 | if (avatar->findRayIntersection(mouseRayOrigin, mouseRayDirection, distance)) { |
| 1971 | // rescale to compensate for head embiggening | 1973 | // rescale to compensate for head embiggening |
| 1972 | eyePosition = (avatar->getHead().calculateAverageEyePosition() - avatar->getHead().getScalePivot()) * | 1974 | eyePosition = (avatar->getHead().calculateAverageEyePosition() - avatar->getHead().getScalePivot()) * |
| 1973 | (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot(); | 1975 | (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot(); |
| 1974 | 1976 | ||
| 1975 | _lookatIndicatorScale = avatar->getHead().getScale(); | 1977 | _lookatIndicatorScale = avatar->getHead().getScale(); |
| 1976 | _lookatOtherPosition = avatar->getHead().getPosition(); | 1978 | _lookatOtherPosition = avatar->getHead().getPosition(); |
| 1977 | nodeUUID = avatar->getOwningNode()->getUUID(); | 1979 | nodeUUID = avatar->getOwningNode()->getUUID(); |
| @@ -1979,7 +1981,7 @@ Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, con · 1 unmodified line | |||
| 1979 | } | 1981 | } |
| 1980 | } | 1982 | } |
| 1981 | } | 1983 | } |
| 1982 | 1984 | ||
| 1983 | return NULL; | 1985 | return NULL; |
| 1984 | } | 1986 | } |
| 1985 | 1987 | ||
| @@ -2021,7 +2023,7 @@ void Application::renderHighlightVoxel(VoxelDetail voxel) { · 35 unmodified lines | |||
| 2021 | void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) { | 2023 | void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) { |
| 2022 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 2024 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2023 | PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); | 2025 | PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); |
| 2024 | 2026 | ||
| 2025 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { | 2027 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 2026 | QMutexLocker(&node->getMutex()); | 2028 | QMutexLocker(&node->getMutex()); |
| 2027 | if (node->getLinkedData()) { | 2029 | if (node->getLinkedData()) { |
| @@ -2038,11 +2040,11 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 10 unmodified lines | |||
| 2038 | for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) { | 2040 | for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) { |
| 2039 | Avatar* avatar = *fade; | 2041 | Avatar* avatar = *fade; |
| 2040 | const float SHRINK_RATE = 0.9f; | 2042 | const float SHRINK_RATE = 0.9f; |
| 2041 | 2043 | ||
| 2042 | avatar->setTargetScale(avatar->getScale() * SHRINK_RATE); | 2044 | avatar->setTargetScale(avatar->getScale() * SHRINK_RATE); |
| 2043 | 2045 | ||
| 2044 | const float MIN_FADE_SCALE = 0.001; | 2046 | const float MIN_FADE_SCALE = 0.001; |
| 2045 | 2047 | ||
| 2046 | if (avatar->getTargetScale() < MIN_FADE_SCALE) { | 2048 | if (avatar->getTargetScale() < MIN_FADE_SCALE) { |
| 2047 | delete avatar; | 2049 | delete avatar; |
| 2048 | _avatarFades.erase(fade--); | 2050 | _avatarFades.erase(fade--); |
| @@ -2260,6 +2262,7 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 211 unmodified lines | |||
| 2260 | } | 2262 | } |
| 2261 | } | 2263 | } |
| 2262 | 2264 | ||
| 2265 | |||
| 2263 | void Application::updateHandAndTouch(float deltaTime) { | 2266 | void Application::updateHandAndTouch(float deltaTime) { |
| 2264 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 2267 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2265 | PerformanceWarning warn(showWarnings, "Application::updateHandAndTouch()"); | 2268 | PerformanceWarning warn(showWarnings, "Application::updateHandAndTouch()"); |
| @@ -2303,7 +2306,9 @@ void Application::updateThreads(float deltaTime) { · 37 unmodified lines | |||
| 2303 | _voxelHideShowThread.threadRoutine(); | 2306 | _voxelHideShowThread.threadRoutine(); |
| 2304 | _voxelEditSender.threadRoutine(); | 2307 | _voxelEditSender.threadRoutine(); |
| 2305 | _particleEditSender.threadRoutine(); | 2308 | _particleEditSender.threadRoutine(); |
| 2306 | _persistThread->threadRoutine(); | 2309 | if (_persistThread) { |
| 2310 | _persistThread->threadRoutine(); | ||
| 2311 | } | ||
| 2307 | } | 2312 | } |
| 2308 | } | 2313 | } |
| 2309 | 2314 | ||
| @@ -2613,32 +2618,32 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 303 unmodified lines | |||
| 2613 | int totalServers = 0; | 2618 | int totalServers = 0; |
| 2614 | int inViewServers = 0; | 2619 | int inViewServers = 0; |
| 2615 | int unknownJurisdictionServers = 0; | 2620 | int unknownJurisdictionServers = 0; |
| 2616 | 2621 | ||
| 2617 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { | 2622 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 2618 | // only send to the NodeTypes that are serverType | 2623 | // only send to the NodeTypes that are serverType |
| 2619 | if (node->getActiveSocket() != NULL && node->getType() == serverType) { | 2624 | if (node->getActiveSocket() != NULL && node->getType() == serverType) { |
| 2620 | totalServers++; | 2625 | totalServers++; |
| 2621 | 2626 | ||
| 2622 | // get the server bounds for this server | 2627 | // get the server bounds for this server |
| 2623 | QUuid nodeUUID = node->getUUID(); | 2628 | QUuid nodeUUID = node->getUUID(); |
| 2624 | 2629 | ||
| 2625 | // if we haven't heard from this voxel server, go ahead and send it a query, so we | 2630 | // if we haven't heard from this voxel server, go ahead and send it a query, so we |
| 2626 | // can get the jurisdiction... | 2631 | // can get the jurisdiction... |
| 2627 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { | 2632 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { |
| 2628 | unknownJurisdictionServers++; | 2633 | unknownJurisdictionServers++; |
| 2629 | } else { | 2634 | } else { |
| 2630 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; | 2635 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; |
| 2631 | 2636 | ||
| 2632 | unsigned char* rootCode = map.getRootOctalCode(); | 2637 | unsigned char* rootCode = map.getRootOctalCode(); |
| 2633 | 2638 | ||
| 2634 | if (rootCode) { | 2639 | if (rootCode) { |
| 2635 | VoxelPositionSize rootDetails; | 2640 | VoxelPositionSize rootDetails; |
| 2636 | voxelDetailsForCode(rootCode, rootDetails); | 2641 | voxelDetailsForCode(rootCode, rootDetails); |
| 2637 | AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s); | 2642 | AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s); |
| 2638 | serverBounds.scale(TREE_SCALE); | 2643 | serverBounds.scale(TREE_SCALE); |
| 2639 | 2644 | ||
| 2640 | ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds); | 2645 | ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds); |
| 2641 | 2646 | ||
| 2642 | if (serverFrustumLocation != ViewFrustum::OUTSIDE) { | 2647 | if (serverFrustumLocation != ViewFrustum::OUTSIDE) { |
| 2643 | inViewServers++; | 2648 | inViewServers++; |
| 2644 | } | 2649 | } |
| @@ -2671,20 +2676,20 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 26 unmodified lines | |||
| 2671 | if (wantExtraDebugging && unknownJurisdictionServers > 0) { | 2676 | if (wantExtraDebugging && unknownJurisdictionServers > 0) { |
| 2672 | qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer); | 2677 | qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer); |
| 2673 | } | 2678 | } |
| 2674 | 2679 | ||
| 2675 | NodeList* nodeList = NodeList::getInstance(); | 2680 | NodeList* nodeList = NodeList::getInstance(); |
| 2676 | 2681 | ||
| 2677 | foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { | 2682 | foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { |
| 2678 | // only send to the NodeTypes that are serverType | 2683 | // only send to the NodeTypes that are serverType |
| 2679 | if (node->getActiveSocket() != NULL && node->getType() == serverType) { | 2684 | if (node->getActiveSocket() != NULL && node->getType() == serverType) { |
| 2680 | 2685 | ||
| 2681 | 2686 | ||
| 2682 | // get the server bounds for this server | 2687 | // get the server bounds for this server |
| 2683 | QUuid nodeUUID = node->getUUID(); | 2688 | QUuid nodeUUID = node->getUUID(); |
| 2684 | 2689 | ||
| 2685 | bool inView = false; | 2690 | bool inView = false; |
| 2686 | bool unknownView = false; | 2691 | bool unknownView = false; |
| 2687 | 2692 | ||
| 2688 | // if we haven't heard from this voxel server, go ahead and send it a query, so we | 2693 | // if we haven't heard from this voxel server, go ahead and send it a query, so we |
| 2689 | // can get the jurisdiction... | 2694 | // can get the jurisdiction... |
| 2690 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { | 2695 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { |
| @@ -2694,15 +2699,15 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 3 unmodified lines | |||
| 2694 | } | 2699 | } |
| 2695 | } else { | 2700 | } else { |
| 2696 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; | 2701 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; |
| 2697 | 2702 | ||
| 2698 | unsigned char* rootCode = map.getRootOctalCode(); | 2703 | unsigned char* rootCode = map.getRootOctalCode(); |
| 2699 | 2704 | ||
| 2700 | if (rootCode) { | 2705 | if (rootCode) { |
| 2701 | VoxelPositionSize rootDetails; | 2706 | VoxelPositionSize rootDetails; |
| 2702 | voxelDetailsForCode(rootCode, rootDetails); | 2707 | voxelDetailsForCode(rootCode, rootDetails); |
| 2703 | AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s); | 2708 | AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s); |
| 2704 | serverBounds.scale(TREE_SCALE); | 2709 | serverBounds.scale(TREE_SCALE); |
| 2705 | 2710 | ||
| 2706 | ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds); | 2711 | ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds); |
| 2707 | if (serverFrustumLocation != ViewFrustum::OUTSIDE) { | 2712 | if (serverFrustumLocation != ViewFrustum::OUTSIDE) { |
| 2708 | inView = true; | 2713 | inView = true; |
| @@ -2715,7 +2720,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 6 unmodified lines | |||
| 2715 | } | 2720 | } |
| 2716 | } | 2721 | } |
| 2717 | } | 2722 | } |
| 2718 | 2723 | ||
| 2719 | if (inView) { | 2724 | if (inView) { |
| 2720 | _voxelQuery.setMaxOctreePacketsPerSecond(perServerPPS); | 2725 | _voxelQuery.setMaxOctreePacketsPerSecond(perServerPPS); |
| 2721 | } else if (unknownView) { | 2726 | } else if (unknownView) { |
| @@ -2723,7 +2728,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 1 unmodified line | |||
| 2723 | qDebug() << "no known jurisdiction for node " << *node << ", give it budget of " | 2728 | qDebug() << "no known jurisdiction for node " << *node << ", give it budget of " |
| 2724 | << perUnknownServer << " to send us jurisdiction."; | 2729 | << perUnknownServer << " to send us jurisdiction."; |
| 2725 | } | 2730 | } |
| 2726 | 2731 | ||
| 2727 | // set the query's position/orientation to be degenerate in a manner that will get the scene quickly | 2732 | // set the query's position/orientation to be degenerate in a manner that will get the scene quickly |
| 2728 | // If there's only one server, then don't do this, and just let the normal voxel query pass through | 2733 | // If there's only one server, then don't do this, and just let the normal voxel query pass through |
| 2729 | // as expected... this way, we will actually get a valid scene if there is one to be seen | 2734 | // as expected... this way, we will actually get a valid scene if there is one to be seen |
| @@ -2747,24 +2752,24 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 17 unmodified lines | |||
| 2747 | } | 2752 | } |
| 2748 | // set up the packet for sending... | 2753 | // set up the packet for sending... |
| 2749 | unsigned char* endOfVoxelQueryPacket = voxelQueryPacket; | 2754 | unsigned char* endOfVoxelQueryPacket = voxelQueryPacket; |
| 2750 | 2755 | ||
| 2751 | // insert packet type/version and node UUID | 2756 | // insert packet type/version and node UUID |
| 2752 | endOfVoxelQueryPacket += populateTypeAndVersion(endOfVoxelQueryPacket, packetType); | 2757 | endOfVoxelQueryPacket += populateTypeAndVersion(endOfVoxelQueryPacket, packetType); |
| 2753 | QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122(); | 2758 | QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122(); |
| 2754 | memcpy(endOfVoxelQueryPacket, ownerUUID.constData(), ownerUUID.size()); | 2759 | memcpy(endOfVoxelQueryPacket, ownerUUID.constData(), ownerUUID.size()); |
| 2755 | endOfVoxelQueryPacket += ownerUUID.size(); | 2760 | endOfVoxelQueryPacket += ownerUUID.size(); |
| 2756 | 2761 | ||
| 2757 | // encode the query data... | 2762 | // encode the query data... |
| 2758 | endOfVoxelQueryPacket += _voxelQuery.getBroadcastData(endOfVoxelQueryPacket); | 2763 | endOfVoxelQueryPacket += _voxelQuery.getBroadcastData(endOfVoxelQueryPacket); |
| 2759 | 2764 | ||
| 2760 | int packetLength = endOfVoxelQueryPacket - voxelQueryPacket; | 2765 | int packetLength = endOfVoxelQueryPacket - voxelQueryPacket; |
| 2761 | 2766 | ||
| 2762 | // make sure we still have an active socket | 2767 | // make sure we still have an active socket |
| 2763 | if (node->getActiveSocket()) { | 2768 | if (node->getActiveSocket()) { |
| 2764 | nodeList->getNodeSocket().writeDatagram((char*) voxelQueryPacket, packetLength, | 2769 | nodeList->getNodeSocket().writeDatagram((char*) voxelQueryPacket, packetLength, |
| 2765 | node->getActiveSocket()->getAddress(), node->getActiveSocket()->getPort()); | 2770 | node->getActiveSocket()->getAddress(), node->getActiveSocket()->getPort()); |
| 2766 | } | 2771 | } |
| 2767 | 2772 | ||
| 2768 | // Feed number of bytes to corresponding channel of the bandwidth meter | 2773 | // Feed number of bytes to corresponding channel of the bandwidth meter |
| 2769 | _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength); | 2774 | _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength); |
| 2770 | } | 2775 | } |
| @@ -3244,7 +3249,7 @@ void Application::displayOverlay() { · 473 unmodified lines | |||
| 3244 | char nodes[100]; | 3249 | char nodes[100]; |
| 3245 | 3250 | ||
| 3246 | int totalAvatars = 0, totalServers = 0; | 3251 | int totalAvatars = 0, totalServers = 0; |
| 3247 | 3252 | ||
| 3248 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { | 3253 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 3249 | node->getType() == NODE_TYPE_AGENT ? totalAvatars++ : totalServers++; | 3254 | node->getType() == NODE_TYPE_AGENT ? totalAvatars++ : totalServers++; |
| 3250 | } | 3255 | } |
| @@ -3358,7 +3363,7 @@ void Application::displayStats() { · 107 unmodified lines | |||
| 3358 | // Now handle voxel servers, since there could be more than one, we average their ping times | 3363 | // Now handle voxel servers, since there could be more than one, we average their ping times |
| 3359 | unsigned long totalPingVoxel = 0; | 3364 | unsigned long totalPingVoxel = 0; |
| 3360 | int voxelServerCount = 0; | 3365 | int voxelServerCount = 0; |
| 3361 | 3366 | ||
| 3362 | foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { | 3367 | foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { |
| 3363 | if (node->getType() == NODE_TYPE_VOXEL_SERVER) { | 3368 | if (node->getType() == NODE_TYPE_VOXEL_SERVER) { |
| 3364 | totalPingVoxel += node->getPingMs(); | 3369 | totalPingVoxel += node->getPingMs(); |
| @@ -3368,7 +3373,7 @@ void Application::displayStats() { · 3 unmodified lines | |||
| 3368 | } | 3373 | } |
| 3369 | } | 3374 | } |
| 3370 | } | 3375 | } |
| 3371 | 3376 | ||
| 3372 | if (voxelServerCount) { | 3377 | if (voxelServerCount) { |
| 3373 | pingVoxel = totalPingVoxel/voxelServerCount; | 3378 | pingVoxel = totalPingVoxel/voxelServerCount; |
| 3374 | } | 3379 | } |
| @@ -3704,10 +3709,10 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) { · 329 unmodified lines | |||
| 3704 | if (!selfAvatarOnly) { | 3709 | if (!selfAvatarOnly) { |
| 3705 | // Render avatars of other nodes | 3710 | // Render avatars of other nodes |
| 3706 | NodeList* nodeList = NodeList::getInstance(); | 3711 | NodeList* nodeList = NodeList::getInstance(); |
| 3707 | 3712 | ||
| 3708 | foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { | 3713 | foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { |
| 3709 | QMutexLocker(&node->getMutex()); | 3714 | QMutexLocker(&node->getMutex()); |
| 3710 | 3715 | ||
| 3711 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { | 3716 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| 3712 | Avatar *avatar = (Avatar *)node->getLinkedData(); | 3717 | Avatar *avatar = (Avatar *)node->getLinkedData(); |
| 3713 | if (!avatar->isInitialized()) { | 3718 | if (!avatar->isInitialized()) { |
| @@ -4205,28 +4210,28 @@ void Application::processDatagrams() { · 491 unmodified lines | |||
| 4205 | MAX_PACKET_SIZE, | 4210 | MAX_PACKET_SIZE, |
| 4206 | senderSockAddr.getAddressPointer(), | 4211 | senderSockAddr.getAddressPointer(), |
| 4207 | senderSockAddr.getPortPointer()))) { | 4212 | senderSockAddr.getPortPointer()))) { |
| 4208 | 4213 | ||
| 4209 | _packetCount++; | 4214 | _packetCount++; |
| 4210 | _bytesCount += bytesReceived; | 4215 | _bytesCount += bytesReceived; |
| 4211 | 4216 | ||
| 4212 | if (packetVersionMatch(_incomingPacket)) { | 4217 | if (packetVersionMatch(_incomingPacket)) { |
| 4213 | // only process this packet if we have a match on the packet version | 4218 | // only process this packet if we have a match on the packet version |
| 4214 | switch (_incomingPacket[0]) { | 4219 | switch (_incomingPacket[0]) { |
| 4215 | case PACKET_TYPE_TRANSMITTER_DATA_V2: | 4220 | case PACKET_TYPE_TRANSMITTER_DATA_V2: |
| 4216 | // V2 = IOS transmitter app | 4221 | // V2 = IOS transmitter app |
| 4217 | _myTransmitter.processIncomingData(_incomingPacket, bytesReceived); | 4222 | _myTransmitter.processIncomingData(_incomingPacket, bytesReceived); |
| 4218 | 4223 | ||
| 4219 | break; | 4224 | break; |
| 4220 | case PACKET_TYPE_MIXED_AUDIO: | 4225 | case PACKET_TYPE_MIXED_AUDIO: |
| 4221 | QMetaObject::invokeMethod(&_audio, "addReceivedAudioToBuffer", Qt::QueuedConnection, | 4226 | QMetaObject::invokeMethod(&_audio, "addReceivedAudioToBuffer", Qt::QueuedConnection, |
| 4222 | Q_ARG(QByteArray, QByteArray((char*) _incomingPacket, bytesReceived))); | 4227 | Q_ARG(QByteArray, QByteArray((char*) _incomingPacket, bytesReceived))); |
| 4223 | break; | 4228 | break; |
| 4224 | 4229 | ||
| 4225 | case PACKET_TYPE_PARTICLE_ADD_RESPONSE: | 4230 | case PACKET_TYPE_PARTICLE_ADD_RESPONSE: |
| 4226 | // look up our ParticleEditHanders.... | 4231 | // look up our ParticleEditHanders.... |
| 4227 | ParticleEditHandle::handleAddResponse(_incomingPacket, bytesReceived); | 4232 | ParticleEditHandle::handleAddResponse(_incomingPacket, bytesReceived); |
| 4228 | break; | 4233 | break; |
| 4229 | 4234 | ||
| 4230 | case PACKET_TYPE_PARTICLE_DATA: | 4235 | case PACKET_TYPE_PARTICLE_DATA: |
| 4231 | case PACKET_TYPE_VOXEL_DATA: | 4236 | case PACKET_TYPE_VOXEL_DATA: |
| 4232 | case PACKET_TYPE_VOXEL_ERASE: | 4237 | case PACKET_TYPE_VOXEL_ERASE: |
| @@ -4234,7 +4239,7 @@ void Application::processDatagrams() { · 1 unmodified line | |||
| 4234 | case PACKET_TYPE_ENVIRONMENT_DATA: { | 4239 | case PACKET_TYPE_ENVIRONMENT_DATA: { |
| 4235 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 4240 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 4236 | "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()"); | 4241 | "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()"); |
| 4237 | 4242 | ||
| 4238 | bool wantExtraDebugging = getLogger()->extraDebugging(); | 4243 | bool wantExtraDebugging = getLogger()->extraDebugging(); |
| 4239 | if (wantExtraDebugging && _incomingPacket[0] == PACKET_TYPE_VOXEL_DATA) { | 4244 | if (wantExtraDebugging && _incomingPacket[0] == PACKET_TYPE_VOXEL_DATA) { |
| 4240 | int numBytesPacketHeader = numBytesForPacketHeader(_incomingPacket); | 4245 | int numBytesPacketHeader = numBytesForPacketHeader(_incomingPacket); |
| @@ -4246,10 +4251,10 @@ void Application::processDatagrams() { · 5 unmodified lines | |||
| 4246 | dataAt += sizeof(VOXEL_PACKET_SENT_TIME); | 4251 | dataAt += sizeof(VOXEL_PACKET_SENT_TIME); |
| 4247 | VOXEL_PACKET_SENT_TIME arrivedAt = usecTimestampNow(); | 4252 | VOXEL_PACKET_SENT_TIME arrivedAt = usecTimestampNow(); |
| 4248 | int flightTime = arrivedAt - sentAt; | 4253 | int flightTime = arrivedAt - sentAt; |
| 4249 | 4254 | ||
| 4250 | printf("got PACKET_TYPE_VOXEL_DATA, sequence:%d flightTime:%d\n", sequence, flightTime); | 4255 | printf("got PACKET_TYPE_VOXEL_DATA, sequence:%d flightTime:%d\n", sequence, flightTime); |
| 4251 | } | 4256 | } |
| 4252 | 4257 | ||
| 4253 | // add this packet to our list of voxel packets and process them on the voxel processing | 4258 | // add this packet to our list of voxel packets and process them on the voxel processing |
| 4254 | _voxelProcessor.queueReceivedPacket(senderSockAddr, _incomingPacket, bytesReceived); | 4259 | _voxelProcessor.queueReceivedPacket(senderSockAddr, _incomingPacket, bytesReceived); |
| 4255 | break; | 4260 | break; |
| @@ -4392,10 +4397,13 @@ void Application::updateLocalOctreeCache(bool firstTime) { · 136 unmodified lines | |||
| 4392 | 4397 | ||
| 4393 | QString localVoxelCacheFileName = getLocalVoxelCacheFileName(); | 4398 | QString localVoxelCacheFileName = getLocalVoxelCacheFileName(); |
| 4394 | const int LOCAL_CACHE_PERSIST_INTERVAL = 1000 * 10; // every 10 seconds | 4399 | const int LOCAL_CACHE_PERSIST_INTERVAL = 1000 * 10; // every 10 seconds |
| 4395 | _persistThread = new OctreePersistThread(_voxels.getTree(), | ||
| 4396 | localVoxelCacheFileName.toLocal8Bit().constData(),LOCAL_CACHE_PERSIST_INTERVAL); | ||
| 4397 | 4400 | ||
| 4398 | qDebug() << "updateLocalOctreeCache()... localVoxelCacheFileName=" << localVoxelCacheFileName; | 4401 | if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableLocalVoxelCache)) { |
| 4402 | _persistThread = new OctreePersistThread(_voxels.getTree(), | ||
| 4403 | localVoxelCacheFileName.toLocal8Bit().constData(),LOCAL_CACHE_PERSIST_INTERVAL); | ||
| 4404 | |||
| 4405 | qDebug() << "updateLocalOctreeCache()... localVoxelCacheFileName=" << localVoxelCacheFileName; | ||
| 4406 | } | ||
| 4399 | 4407 | ||
| 4400 | if (_persistThread) { | 4408 | if (_persistThread) { |
| 4401 | _voxels.beginLoadingLocalVoxelCache(); // while local voxels are importing, don't do individual node VBO updates | 4409 | _voxels.beginLoadingLocalVoxelCache(); // while local voxels are importing, don't do individual node VBO updates |