Showing the changes to interface/src/Application.cpp (1 of 64 files). Show all
Unified · Split
| @@ -131,6 +131,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 130 unmodified lines | ||
| 131 | 131 | _voxelProcessor(), |
| 132 | 132 | _voxelHideShowThread(&_voxels), |
| 133 | 133 | _voxelEditSender(this), |
| 134 | + _particleEditSender(this), | |
| 134 | 135 | _packetCount(0), |
| 135 | 136 | _packetsPerSecond(0), |
| 136 | 137 | _bytesPerSecond(0), |
| @@ -206,7 +207,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 69 unmodified lines | ||
| 206 | 207 | #endif |
| 207 | 208 | |
| 208 | 209 | // tell the NodeList instance who to tell the domain server we care about |
| 209 | − const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER}; | |
| 210 | + const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER, | |
| 211 | + NODE_TYPE_PARTICLE_SERVER}; | |
| 210 | 212 | nodeList->setNodeTypesOfInterest(nodeTypesOfInterest, sizeof(nodeTypesOfInterest)); |
| 211 | 213 | |
| 212 | 214 | QTimer* silentNodeTimer = new QTimer(this); |
| @@ -232,6 +234,12 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 19 unmodified lines | ||
| 232 | 234 | |
| 233 | 235 | // Tell our voxel edit sender about our known jurisdictions |
| 234 | 236 | _voxelEditSender.setVoxelServerJurisdictions(&_voxelServerJurisdictions); |
| 237 | + _particleEditSender.setServerJurisdictions(&_particleServerJurisdictions); | |
| 238 | + | |
| 239 | + // For now we're going to set the PPS for outbound packets to be super high, this is | |
| 240 | + // probably not the right long term solution. But for now, we're going to do this to | |
| 241 | + // allow you to move a particle around in your hand | |
| 242 | + _particleEditSender.setPacketsPerSecond(3000); // super high!! | |
| 235 | 243 | } |
| 236 | 244 | |
| 237 | 245 | Application::~Application() { |
| @@ -319,6 +327,7 @@ void Application::initializeGL() { · 81 unmodified lines | ||
| 319 | 327 | _voxelProcessor.initialize(_enableProcessVoxelsThread); |
| 320 | 328 | _voxelEditSender.initialize(_enableProcessVoxelsThread); |
| 321 | 329 | _voxelHideShowThread.initialize(_enableProcessVoxelsThread); |
| 330 | + _particleEditSender.initialize(_enableProcessVoxelsThread); | |
| 322 | 331 | if (_enableProcessVoxelsThread) { |
| 323 | 332 | qDebug("Voxel parsing thread created.\n"); |
| 324 | 333 | } |
| @@ -620,6 +629,9 @@ void Application::keyPressEvent(QKeyEvent* event) { · 295 unmodified lines | ||
| 620 | 629 | bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier); |
| 621 | 630 | bool isMeta = event->modifiers().testFlag(Qt::ControlModifier); |
| 622 | 631 | switch (event->key()) { |
| 632 | + case Qt::Key_N: | |
| 633 | + shootParticle(); | |
| 634 | + break; | |
| 623 | 635 | case Qt::Key_Shift: |
| 624 | 636 | if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode)) { |
| 625 | 637 | _pasteMode = true; |
| @@ -1229,7 +1241,8 @@ void Application::wheelEvent(QWheelEvent* event) { · 603 unmodified lines | ||
| 1229 | 1241 | |
| 1230 | 1242 | void Application::sendPingPackets() { |
| 1231 | 1243 | |
| 1232 | − const char nodesToPing[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER}; | |
| 1244 | + const char nodesToPing[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_PARTICLE_SERVER, | |
| 1245 | + NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER}; | |
| 1233 | 1246 | |
| 1234 | 1247 | uint64_t currentTime = usecTimestampNow(); |
| 1235 | 1248 | unsigned char pingPacket[numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_PING) + sizeof(currentTime)]; |
| @@ -1383,6 +1396,7 @@ void Application::terminate() { · 147 unmodified lines | ||
| 1383 | 1396 | _voxelProcessor.terminate(); |
| 1384 | 1397 | _voxelHideShowThread.terminate(); |
| 1385 | 1398 | _voxelEditSender.terminate(); |
| 1399 | + _particleEditSender.terminate(); | |
| 1386 | 1400 | } |
| 1387 | 1401 | |
| 1388 | 1402 | static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) { |
| @@ -1485,6 +1499,46 @@ void Application::removeVoxel(glm::vec3 position, · 96 unmodified lines | ||
| 1485 | 1499 | _voxels.deleteVoxelAt(voxel.x, voxel.y, voxel.z, voxel.s); |
| 1486 | 1500 | } |
| 1487 | 1501 | |
| 1502 | +void Application::shootParticle() { | |
| 1503 | + | |
| 1504 | + glm::vec3 position = _viewFrustum.getPosition(); | |
| 1505 | + glm::vec3 direction = _viewFrustum.getDirection(); | |
| 1506 | + const float LINEAR_VELOCITY = 5.f; | |
| 1507 | + glm::vec3 lookingAt = position + (direction * LINEAR_VELOCITY); | |
| 1508 | + | |
| 1509 | + const float radius = 0.125 / TREE_SCALE; | |
| 1510 | + xColor color = { 0, 255, 255}; | |
| 1511 | + glm::vec3 velocity = lookingAt - position; | |
| 1512 | + glm::vec3 gravity = DEFAULT_GRAVITY * 0.f; | |
| 1513 | + float damping = DEFAULT_DAMPING * 0.01f; | |
| 1514 | + QString updateScript(""); | |
| 1515 | + | |
| 1516 | + ParticleEditHandle* particleEditHandle = makeParticle(position / (float)TREE_SCALE, radius, color, | |
| 1517 | + velocity / (float)TREE_SCALE, gravity, damping, updateScript); | |
| 1518 | + | |
| 1519 | + // If we wanted to be able to edit this particle after shooting, then we could store this value | |
| 1520 | + // and use it for editing later. But we don't care about that for "shooting" and therefore we just | |
| 1521 | + // clean up our memory now. deleting a ParticleEditHandle does not effect the underlying particle, | |
| 1522 | + // it just removes your ability to edit that particle later. | |
| 1523 | + delete particleEditHandle; | |
| 1524 | +} | |
| 1525 | + | |
| 1526 | +// Caller is responsible for managing this EditableParticle | |
| 1527 | +ParticleEditHandle* Application::newParticleEditHandle(uint32_t id) { | |
| 1528 | + ParticleEditHandle* particleEditHandle = new ParticleEditHandle(&_particleEditSender, _particles.getTree()); | |
| 1529 | + return particleEditHandle; | |
| 1530 | +} | |
| 1531 | + | |
| 1532 | +// Caller is responsible for managing this EditableParticle | |
| 1533 | +ParticleEditHandle* Application::makeParticle(glm::vec3 position, float radius, xColor color, glm::vec3 velocity, | |
| 1534 | + glm::vec3 gravity, float damping, QString updateScript) { | |
| 1535 | + | |
| 1536 | + ParticleEditHandle* particleEditHandle = newParticleEditHandle(); | |
| 1537 | + particleEditHandle->createParticle(position, radius, color, velocity, gravity, damping, updateScript); | |
| 1538 | + return particleEditHandle; | |
| 1539 | +} | |
| 1540 | + | |
| 1541 | + | |
| 1488 | 1542 | void Application::makeVoxel(glm::vec3 position, |
| 1489 | 1543 | float scale, |
| 1490 | 1544 | unsigned char red, |
| @@ -1507,18 +1561,7 @@ void Application::makeVoxel(glm::vec3 position, · 16 unmodified lines | ||
| 1507 | 1561 | _voxels.createVoxel(voxel.x, voxel.y, voxel.z, voxel.s, |
| 1508 | 1562 | voxel.red, voxel.green, voxel.blue, |
| 1509 | 1563 | isDestructive); |
| 1510 | − | |
| 1511 | − // Implement voxel fade effect | |
| 1512 | − VoxelFade fade(VoxelFade::FADE_OUT, 1.0f, 1.0f, 1.0f); | |
| 1513 | − const float VOXEL_BOUNDS_ADJUST = 0.01f; | |
| 1514 | − float slightlyBigger = voxel.s * VOXEL_BOUNDS_ADJUST; | |
| 1515 | − fade.voxelDetails.x = voxel.x - slightlyBigger; | |
| 1516 | − fade.voxelDetails.y = voxel.y - slightlyBigger; | |
| 1517 | − fade.voxelDetails.z = voxel.z - slightlyBigger; | |
| 1518 | − fade.voxelDetails.s = voxel.s + slightlyBigger + slightlyBigger; | |
| 1519 | − _voxelFades.push_back(fade); | |
| 1520 | − | |
| 1521 | −} | |
| 1564 | + } | |
| 1522 | 1565 | |
| 1523 | 1566 | const glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail _mouseVoxel) { |
| 1524 | 1567 | return glm::vec3((_mouseVoxel.x + _mouseVoxel.s / 2.f) * TREE_SCALE, |
| @@ -1802,6 +1845,9 @@ void Application::init() { · 277 unmodified lines | ||
| 1802 | 1845 | _voxels.setVoxelsAsPoints(Menu::getInstance()->isOptionChecked(MenuOption::VoxelsAsPoints)); |
| 1803 | 1846 | _voxels.setDisableFastVoxelPipeline(false); |
| 1804 | 1847 | _voxels.init(); |
| 1848 | + | |
| 1849 | + _particles.init(); | |
| 1850 | + _particles.setViewFrustum(getViewFrustum()); | |
| 1805 | 1851 | |
| 1806 | 1852 | _metavoxels.init(); |
| 1807 | 1853 | |
| @@ -2290,6 +2336,7 @@ void Application::updateThreads(float deltaTime) { · 482 unmodified lines | ||
| 2290 | 2336 | _voxelProcessor.threadRoutine(); |
| 2291 | 2337 | _voxelHideShowThread.threadRoutine(); |
| 2292 | 2338 | _voxelEditSender.threadRoutine(); |
| 2339 | + _particleEditSender.threadRoutine(); | |
| 2293 | 2340 | } |
| 2294 | 2341 | } |
| 2295 | 2342 | |
| @@ -2480,6 +2527,8 @@ void Application::update(float deltaTime) { · 184 unmodified lines | ||
| 2480 | 2527 | updateDialogs(deltaTime); // update various stats dialogs if present |
| 2481 | 2528 | updateAudio(deltaTime); // Update audio stats for procedural sounds |
| 2482 | 2529 | updateCursor(deltaTime); // Handle cursor updates |
| 2530 | + | |
| 2531 | + _particles.update(); // update the particles... | |
| 2483 | 2532 | } |
| 2484 | 2533 | |
| 2485 | 2534 | void Application::updateAvatar(float deltaTime) { |
| @@ -2492,7 +2541,10 @@ void Application::updateAvatar(float deltaTime) { · 6 unmodified lines | ||
| 2492 | 2541 | _yawFromTouch = 0.f; |
| 2493 | 2542 | |
| 2494 | 2543 | // apply pitch from touch |
| 2495 | − _myAvatar.getHead().setMousePitch(_myAvatar.getHead().getMousePitch() + _pitchFromTouch); | |
| 2544 | + _myAvatar.getHead().setMousePitch(_myAvatar.getHead().getMousePitch() + | |
| 2545 | + _myAvatar.getHand().getPitchUpdate() + | |
| 2546 | + _pitchFromTouch); | |
| 2547 | + _myAvatar.getHand().setPitchUpdate(0.f); | |
| 2496 | 2548 | _pitchFromTouch = 0.0f; |
| 2497 | 2549 | |
| 2498 | 2550 | // Update my avatar's state from gyros and/or webcam |
| @@ -2592,10 +2644,11 @@ void Application::updateAvatar(float deltaTime) { · 93 unmodified lines | ||
| 2592 | 2644 | loadViewFrustum(_myCamera, _viewFrustum); |
| 2593 | 2645 | |
| 2594 | 2646 | // Update my voxel servers with my current voxel query... |
| 2595 | − queryVoxels(); | |
| 2647 | + queryOctree(NODE_TYPE_VOXEL_SERVER, PACKET_TYPE_VOXEL_QUERY, _voxelServerJurisdictions); | |
| 2648 | + queryOctree(NODE_TYPE_PARTICLE_SERVER, PACKET_TYPE_PARTICLE_QUERY, _particleServerJurisdictions); | |
| 2596 | 2649 | } |
| 2597 | 2650 | |
| 2598 | −void Application::queryVoxels() { | |
| 2651 | +void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, NodeToJurisdictionMap& jurisdictions) { | |
| 2599 | 2652 | |
| 2600 | 2653 | // if voxels are disabled, then don't send this at all... |
| 2601 | 2654 | if (!Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { |
| @@ -2631,8 +2684,9 @@ void Application::queryVoxels() { · 29 unmodified lines | ||
| 2631 | 2684 | int unknownJurisdictionServers = 0; |
| 2632 | 2685 | |
| 2633 | 2686 | for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| 2634 | − // only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER | |
| 2635 | − if (node->getActiveSocket() != NULL && node->getType() == NODE_TYPE_VOXEL_SERVER) { | |
| 2687 | + | |
| 2688 | + // only send to the NodeTypes that are serverType | |
| 2689 | + if (node->getActiveSocket() != NULL && node->getType() == serverType) { | |
| 2636 | 2690 | totalServers++; |
| 2637 | 2691 | |
| 2638 | 2692 | // get the server bounds for this server |
| @@ -2640,10 +2694,10 @@ void Application::queryVoxels() { · 1 unmodified line | ||
| 2640 | 2694 | |
| 2641 | 2695 | // if we haven't heard from this voxel server, go ahead and send it a query, so we |
| 2642 | 2696 | // can get the jurisdiction... |
| 2643 | − if (_voxelServerJurisdictions.find(nodeUUID) == _voxelServerJurisdictions.end()) { | |
| 2697 | + if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { | |
| 2644 | 2698 | unknownJurisdictionServers++; |
| 2645 | 2699 | } else { |
| 2646 | − const JurisdictionMap& map = (_voxelServerJurisdictions)[nodeUUID]; | |
| 2700 | + const JurisdictionMap& map = (jurisdictions)[nodeUUID]; | |
| 2647 | 2701 | |
| 2648 | 2702 | unsigned char* rootCode = map.getRootOctalCode(); |
| 2649 | 2703 | |
| @@ -2662,7 +2716,7 @@ void Application::queryVoxels() { · 12 unmodified lines | ||
| 2662 | 2716 | } |
| 2663 | 2717 | } |
| 2664 | 2718 | } |
| 2665 | − | |
| 2719 | + | |
| 2666 | 2720 | if (wantExtraDebugging && unknownJurisdictionServers > 0) { |
| 2667 | 2721 | qDebug("Servers: total %d, in view %d, unknown jurisdiction %d \n", |
| 2668 | 2722 | totalServers, inViewServers, unknownJurisdictionServers); |
| @@ -2689,8 +2743,8 @@ void Application::queryVoxels() { · 20 unmodified lines | ||
| 2689 | 2743 | } |
| 2690 | 2744 | |
| 2691 | 2745 | for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| 2692 | − // only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER | |
| 2693 | − if (node->getActiveSocket() != NULL && node->getType() == NODE_TYPE_VOXEL_SERVER) { | |
| 2746 | + // only send to the NodeTypes that are serverType | |
| 2747 | + if (node->getActiveSocket() != NULL && node->getType() == serverType) { | |
| 2694 | 2748 | |
| 2695 | 2749 | |
| 2696 | 2750 | // get the server bounds for this server |
| @@ -2701,13 +2755,13 @@ void Application::queryVoxels() { · 4 unmodified lines | ||
| 2701 | 2755 | |
| 2702 | 2756 | // if we haven't heard from this voxel server, go ahead and send it a query, so we |
| 2703 | 2757 | // can get the jurisdiction... |
| 2704 | − if (_voxelServerJurisdictions.find(nodeUUID) == _voxelServerJurisdictions.end()) { | |
| 2758 | + if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { | |
| 2705 | 2759 | unknownView = true; // assume it's in view |
| 2706 | 2760 | if (wantExtraDebugging) { |
| 2707 | 2761 | qDebug() << "no known jurisdiction for node " << *node << ", assume it's visible.\n"; |
| 2708 | 2762 | } |
| 2709 | 2763 | } else { |
| 2710 | − const JurisdictionMap& map = (_voxelServerJurisdictions)[nodeUUID]; | |
| 2764 | + const JurisdictionMap& map = (jurisdictions)[nodeUUID]; | |
| 2711 | 2765 | |
| 2712 | 2766 | unsigned char* rootCode = map.getRootOctalCode(); |
| 2713 | 2767 | |
| @@ -2763,7 +2817,7 @@ void Application::queryVoxels() { · 49 unmodified lines | ||
| 2763 | 2817 | unsigned char* endOfVoxelQueryPacket = voxelQueryPacket; |
| 2764 | 2818 | |
| 2765 | 2819 | // insert packet type/version and node UUID |
| 2766 | − endOfVoxelQueryPacket += populateTypeAndVersion(endOfVoxelQueryPacket, PACKET_TYPE_VOXEL_QUERY); | |
| 2820 | + endOfVoxelQueryPacket += populateTypeAndVersion(endOfVoxelQueryPacket, packetType); | |
| 2767 | 2821 | QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122(); |
| 2768 | 2822 | memcpy(endOfVoxelQueryPacket, ownerUUID.constData(), ownerUUID.size()); |
| 2769 | 2823 | endOfVoxelQueryPacket += ownerUUID.size(); |
| @@ -3016,7 +3070,10 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 246 unmodified lines | ||
| 3016 | 3070 | "Application::displaySide() ... metavoxels..."); |
| 3017 | 3071 | _metavoxels.render(); |
| 3018 | 3072 | } |
| 3019 | − | |
| 3073 | + | |
| 3074 | + // render particles... | |
| 3075 | + _particles.render(); | |
| 3076 | + | |
| 3020 | 3077 | // render the ambient occlusion effect if enabled |
| 3021 | 3078 | if (Menu::getInstance()->isOptionChecked(MenuOption::AmbientOcclusion)) { |
| 3022 | 3079 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| @@ -4078,6 +4135,7 @@ void Application::domainChanged(QString domain) { · 1055 unmodified lines | ||
| 4078 | 4135 | // reset our node to stats and node to jurisdiction maps... since these must be changing... |
| 4079 | 4136 | _voxelServerJurisdictions.clear(); |
| 4080 | 4137 | _voxelServerSceneStats.clear(); |
| 4138 | + _particleServerJurisdictions.clear(); | |
| 4081 | 4139 | } |
| 4082 | 4140 | |
| 4083 | 4141 | void Application::nodeAdded(Node* node) { |
| @@ -4116,6 +4174,37 @@ void Application::nodeKilled(Node* node) { · 32 unmodified lines | ||
| 4116 | 4174 | } |
| 4117 | 4175 | _voxelSceneStatsLock.unlock(); |
| 4118 | 4176 | |
| 4177 | + } else if (node->getType() == NODE_TYPE_PARTICLE_SERVER) { | |
| 4178 | + QUuid nodeUUID = node->getUUID(); | |
| 4179 | + // see if this is the first we've heard of this node... | |
| 4180 | + if (_particleServerJurisdictions.find(nodeUUID) != _particleServerJurisdictions.end()) { | |
| 4181 | + unsigned char* rootCode = _particleServerJurisdictions[nodeUUID].getRootOctalCode(); | |
| 4182 | + VoxelPositionSize rootDetails; | |
| 4183 | + voxelDetailsForCode(rootCode, rootDetails); | |
| 4184 | + | |
| 4185 | + printf("particle server going away...... v[%f, %f, %f, %f]\n", | |
| 4186 | + rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s); | |
| 4187 | + | |
| 4188 | + // Add the jurisditionDetails object to the list of "fade outs" | |
| 4189 | + if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) { | |
| 4190 | + VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE); | |
| 4191 | + fade.voxelDetails = rootDetails; | |
| 4192 | + const float slightly_smaller = 0.99; | |
| 4193 | + fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller; | |
| 4194 | + _voxelFades.push_back(fade); | |
| 4195 | + } | |
| 4196 | + | |
| 4197 | + // If the voxel server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server | |
| 4198 | + _particleServerJurisdictions.erase(nodeUUID); | |
| 4199 | + } | |
| 4200 | + | |
| 4201 | + // also clean up scene stats for that server | |
| 4202 | + _voxelSceneStatsLock.lockForWrite(); | |
| 4203 | + if (_voxelServerSceneStats.find(nodeUUID) != _voxelServerSceneStats.end()) { | |
| 4204 | + _voxelServerSceneStats.erase(nodeUUID); | |
| 4205 | + } | |
| 4206 | + _voxelSceneStatsLock.unlock(); | |
| 4207 | + | |
| 4119 | 4208 | } else if (node->getType() == NODE_TYPE_AGENT) { |
| 4120 | 4209 | Avatar* avatar = static_cast<Avatar*>(node->getLinkedData()); |
| 4121 | 4210 | if (avatar == _lookatTargetAvatar) { |
| @@ -4147,10 +4236,10 @@ void Application::trackIncomingVoxelPacket(unsigned char* messageData, ssize_t m · 25 unmodified lines | ||
| 4147 | 4236 | } |
| 4148 | 4237 | } |
| 4149 | 4238 | |
| 4150 | −int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLength, const HifiSockAddr& senderSockAddr) { | |
| 4239 | +int Application::parseOctreeStats(unsigned char* messageData, ssize_t messageLength, const HifiSockAddr& senderSockAddr) { | |
| 4151 | 4240 | |
| 4152 | 4241 | // But, also identify the sender, and keep track of the contained jurisdiction root for this server |
| 4153 | − Node* voxelServer = NodeList::getInstance()->nodeWithAddress(senderSockAddr); | |
| 4242 | + Node* server = NodeList::getInstance()->nodeWithAddress(senderSockAddr); | |
| 4154 | 4243 | |
| 4155 | 4244 | // parse the incoming stats datas stick it in a temporary object for now, while we |
| 4156 | 4245 | // determine which server it belongs to |
| @@ -4158,8 +4247,8 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng · 1 unmodified line | ||
| 4158 | 4247 | int statsMessageLength = temp.unpackFromMessage(messageData, messageLength); |
| 4159 | 4248 | |
| 4160 | 4249 | // quick fix for crash... why would voxelServer be NULL? |
| 4161 | − if (voxelServer) { | |
| 4162 | − QUuid nodeUUID = voxelServer->getUUID(); | |
| 4250 | + if (server) { | |
| 4251 | + QUuid nodeUUID = server->getUUID(); | |
| 4163 | 4252 | |
| 4164 | 4253 | // now that we know the node ID, let's add these stats to the stats for that node... |
| 4165 | 4254 | _voxelSceneStatsLock.lockForWrite(); |
| @@ -4174,8 +4263,16 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng · 8 unmodified lines | ||
| 4174 | 4263 | voxelDetailsForCode(temp.getJurisdictionRoot(), rootDetails); |
| 4175 | 4264 | |
| 4176 | 4265 | // see if this is the first we've heard of this node... |
| 4177 | − if (_voxelServerJurisdictions.find(nodeUUID) == _voxelServerJurisdictions.end()) { | |
| 4178 | − printf("stats from new voxel server... v[%f, %f, %f, %f]\n", | |
| 4266 | + NodeToJurisdictionMap* jurisdiction = NULL; | |
| 4267 | + if (server->getType() == NODE_TYPE_VOXEL_SERVER) { | |
| 4268 | + jurisdiction = &_voxelServerJurisdictions; | |
| 4269 | + } else { | |
| 4270 | + jurisdiction = &_particleServerJurisdictions; | |
| 4271 | + } | |
| 4272 | + | |
| 4273 | + | |
| 4274 | + if (jurisdiction->find(nodeUUID) == jurisdiction->end()) { | |
| 4275 | + printf("stats from new server... v[%f, %f, %f, %f]\n", | |
| 4179 | 4276 | rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s); |
| 4180 | 4277 | |
| 4181 | 4278 | // Add the jurisditionDetails object to the list of "fade outs" |
| @@ -4193,7 +4290,7 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng · 11 unmodified lines | ||
| 4193 | 4290 | // details from the VoxelSceneStats to construct the JurisdictionMap |
| 4194 | 4291 | JurisdictionMap jurisdictionMap; |
| 4195 | 4292 | jurisdictionMap.copyContents(temp.getJurisdictionRoot(), temp.getJurisdictionEndNodes()); |
| 4196 | − _voxelServerJurisdictions[nodeUUID] = jurisdictionMap; | |
| 4293 | + (*jurisdiction)[nodeUUID] = jurisdictionMap; | |
| 4197 | 4294 | } |
| 4198 | 4295 | return statsMessageLength; |
| 4199 | 4296 | } |
| @@ -4229,6 +4326,13 @@ void* Application::networkReceive(void* args) { · 29 unmodified lines | ||
| 4229 | 4326 | QMetaObject::invokeMethod(&app->_audio, "addReceivedAudioToBuffer", Qt::QueuedConnection, |
| 4230 | 4327 | Q_ARG(QByteArray, QByteArray((char*) app->_incomingPacket, bytesReceived))); |
| 4231 | 4328 | break; |
| 4329 | + | |
| 4330 | + case PACKET_TYPE_PARTICLE_ADD_RESPONSE: | |
| 4331 | + // look up our ParticleEditHanders.... | |
| 4332 | + ParticleEditHandle::handleAddResponse(app->_incomingPacket, bytesReceived); | |
| 4333 | + break; | |
| 4334 | + | |
| 4335 | + case PACKET_TYPE_PARTICLE_DATA: | |
| 4232 | 4336 | case PACKET_TYPE_VOXEL_DATA: |
| 4233 | 4337 | case PACKET_TYPE_VOXEL_ERASE: |
| 4234 | 4338 | case PACKET_TYPE_OCTREE_STATS: |