Showing the changes to interface/src/Application.cpp (1 of 65 files). Show all
Unified · Split
| @@ -169,7 +169,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 168 unmodified lines | ||
| 169 | 169 | _isTouchPressed(false), |
| 170 | 170 | _mousePressed(false), |
| 171 | 171 | _audio(), |
| 172 | − _enableProcessVoxelsThread(true), | |
| 172 | + _enableProcessOctreeThread(true), | |
| 173 | 173 | _octreeProcessor(), |
| 174 | 174 | _packetsPerSecond(0), |
| 175 | 175 | _bytesPerSecond(0), |
| @@ -311,7 +311,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 135 unmodified lines | ||
| 311 | 311 | |
| 312 | 312 | // tell the NodeList instance who to tell the domain server we care about |
| 313 | 313 | nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer |
| 314 | − << NodeType::VoxelServer << NodeType::EntityServer | |
| 314 | + << NodeType::EntityServer | |
| 315 | 315 | << NodeType::MetavoxelServer); |
| 316 | 316 | |
| 317 | 317 | // connect to the packet sent signal of the _entityEditSender |
| @@ -539,9 +539,9 @@ void Application::initializeGL() { · 221 unmodified lines | ||
| 539 | 539 | init(); |
| 540 | 540 | qDebug( "init() complete."); |
| 541 | 541 | |
| 542 | − // create thread for parsing of voxel data independent of the main network and rendering threads | |
| 543 | − _octreeProcessor.initialize(_enableProcessVoxelsThread); | |
| 544 | − _entityEditSender.initialize(_enableProcessVoxelsThread); | |
| 542 | + // create thread for parsing of octee data independent of the main network and rendering threads | |
| 543 | + _octreeProcessor.initialize(_enableProcessOctreeThread); | |
| 544 | + _entityEditSender.initialize(_enableProcessOctreeThread); | |
| 545 | 545 | |
| 546 | 546 | // call our timer function every second |
| 547 | 547 | QTimer* timer = new QTimer(this); |
| @@ -1731,20 +1731,14 @@ void Application::init() { · 1183 unmodified lines | ||
| 1731 | 1731 | _entities.setViewFrustum(getViewFrustum()); |
| 1732 | 1732 | |
| 1733 | 1733 | EntityTree* entityTree = _entities.getTree(); |
| 1734 | − _entityCollisionSystem.init(&_entityEditSender, entityTree, NULL, &_audio, &_avatarManager); | |
| 1734 | + _entityCollisionSystem.init(&_entityEditSender, entityTree, &_audio, &_avatarManager); | |
| 1735 | 1735 | entityTree->setSimulation(&_entityCollisionSystem); |
| 1736 | 1736 | |
| 1737 | − // connect the _entityCollisionSystem to our script engine's EntityScriptingInterface | |
| 1738 | − connect(&_entityCollisionSystem, &EntityCollisionSystem::entityCollisionWithVoxel, | |
| 1739 | − ScriptEngine::getEntityScriptingInterface(), &EntityScriptingInterface::entityCollisionWithVoxel); | |
| 1740 | 1737 | |
| 1741 | 1738 | connect(&_entityCollisionSystem, &EntityCollisionSystem::entityCollisionWithEntity, |
| 1742 | 1739 | ScriptEngine::getEntityScriptingInterface(), &EntityScriptingInterface::entityCollisionWithEntity); |
| 1743 | 1740 | |
| 1744 | 1741 | // connect the _entityCollisionSystem to our EntityTreeRenderer since that's what handles running entity scripts |
| 1745 | − connect(&_entityCollisionSystem, &EntityCollisionSystem::entityCollisionWithVoxel, | |
| 1746 | − &_entities, &EntityTreeRenderer::entityCollisionWithVoxel); | |
| 1747 | − | |
| 1748 | 1742 | connect(&_entityCollisionSystem, &EntityCollisionSystem::entityCollisionWithEntity, |
| 1749 | 1743 | &_entities, &EntityTreeRenderer::entityCollisionWithEntity); |
| 1750 | 1744 | |
| @@ -1951,10 +1945,8 @@ void Application::updateThreads(float deltaTime) { · 200 unmodified lines | ||
| 1951 | 1945 | PerformanceWarning warn(showWarnings, "Application::updateThreads()"); |
| 1952 | 1946 | |
| 1953 | 1947 | // parse voxel packets |
| 1954 | − if (!_enableProcessVoxelsThread) { | |
| 1948 | + if (!_enableProcessOctreeThread) { | |
| 1955 | 1949 | _octreeProcessor.threadRoutine(); |
| 1956 | − _voxelHideShowThread.threadRoutine(); | |
| 1957 | − _voxelEditSender.threadRoutine(); | |
| 1958 | 1950 | _entityEditSender.threadRoutine(); |
| 1959 | 1951 | } |
| 1960 | 1952 | } |
| @@ -2134,9 +2126,6 @@ void Application::update(float deltaTime) { · 173 unmodified lines | ||
| 2134 | 2126 | if (queryIsDue || viewIsDifferentEnough) { |
| 2135 | 2127 | _lastQueriedTime = now; |
| 2136 | 2128 | |
| 2137 | − if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { | |
| 2138 | − queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions); | |
| 2139 | − } | |
| 2140 | 2129 | if (Menu::getInstance()->isOptionChecked(MenuOption::Entities)) { |
| 2141 | 2130 | queryOctree(NodeType::EntityServer, PacketTypeEntityQuery, _entityServerJurisdictions); |
| 2142 | 2131 | } |
| @@ -2837,14 +2826,6 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr · 694 unmodified lines | ||
| 2837 | 2826 | glColor3f(1,0,0); |
| 2838 | 2827 | DependencyManager::get<GeometryCache>()->renderSphere(originSphereRadius, 15, 15); |
| 2839 | 2828 | |
| 2840 | − // Draw voxels | |
| 2841 | − if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { | |
| 2842 | − PerformanceTimer perfTimer("voxels"); | |
| 2843 | − PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | |
| 2844 | − "Application::displaySide() ... voxels..."); | |
| 2845 | − _voxels.render(); | |
| 2846 | − } | |
| 2847 | − | |
| 2848 | 2829 | // also, metavoxels |
| 2849 | 2830 | if (Menu::getInstance()->isOptionChecked(MenuOption::Metavoxels)) { |
| 2850 | 2831 | PerformanceTimer perfTimer("metavoxels"); |
| @@ -3308,20 +3289,6 @@ void Application::renderViewFrustum(ViewFrustum& viewFrustum) { · 457 unmodified lines | ||
| 3308 | 3289 | } |
| 3309 | 3290 | } |
| 3310 | 3291 | |
| 3311 | −void Application::deleteVoxels(const VoxelDetail& voxel) { | |
| 3312 | − deleteVoxelAt(voxel); | |
| 3313 | −} | |
| 3314 | − | |
| 3315 | −void Application::deleteVoxelAt(const VoxelDetail& voxel) { | |
| 3316 | − if (voxel.s != 0) { | |
| 3317 | − // sending delete to the server is sufficient, server will send new version so we see updates soon enough | |
| 3318 | − _voxelEditSender.sendVoxelEditMessage(PacketTypeVoxelErase, voxel); | |
| 3319 | − | |
| 3320 | − // delete it locally to see the effect immediately (and in case no voxel server is present) | |
| 3321 | − _voxels.getTree()->deleteVoxelAt(voxel.x, voxel.y, voxel.z, voxel.s); | |
| 3322 | − } | |
| 3323 | −} | |
| 3324 | − | |
| 3325 | 3292 | void Application::resetSensors() { |
| 3326 | 3293 | DependencyManager::get<Faceshift>()->reset(); |
| 3327 | 3294 | DependencyManager::get<Visage>()->reset(); |
| @@ -3422,10 +3389,6 @@ void Application::clearDomainOctreeDetails() { · 94 unmodified lines | ||
| 3422 | 3389 | _environment.resetToDefault(); |
| 3423 | 3390 | |
| 3424 | 3391 | // reset our node to stats and node to jurisdiction maps... since these must be changing... |
| 3425 | − _voxelServerJurisdictions.lockForWrite(); | |
| 3426 | − _voxelServerJurisdictions.clear(); | |
| 3427 | − _voxelServerJurisdictions.unlock(); | |
| 3428 | − | |
| 3429 | 3392 | _entityServerJurisdictions.lockForWrite(); |
| 3430 | 3393 | _entityServerJurisdictions.clear(); |
| 3431 | 3394 | _entityServerJurisdictions.unlock(); |
| @@ -3437,8 +3400,6 @@ void Application::clearDomainOctreeDetails() { · 5 unmodified lines | ||
| 3437 | 3400 | // reset the model renderer |
| 3438 | 3401 | _entities.clear(); |
| 3439 | 3402 | |
| 3440 | − // reset the voxels renderer | |
| 3441 | − _voxels.killLocalVoxels(); | |
| 3442 | 3403 | } |
| 3443 | 3404 | |
| 3444 | 3405 | void Application::domainChanged(const QString& domainHostname) { |
| @@ -3475,51 +3436,13 @@ void Application::nodeKilled(SharedNodePointer node) { · 30 unmodified lines | ||
| 3475 | 3436 | |
| 3476 | 3437 | _octreeProcessor.nodeKilled(node); |
| 3477 | 3438 | |
| 3478 | − _voxelEditSender.nodeKilled(node); | |
| 3479 | 3439 | _entityEditSender.nodeKilled(node); |
| 3480 | 3440 | |
| 3481 | 3441 | if (node->getType() == NodeType::AudioMixer) { |
| 3482 | 3442 | QMetaObject::invokeMethod(&_audio, "audioMixerKilled"); |
| 3483 | 3443 | } |
| 3484 | 3444 | |
| 3485 | − if (node->getType() == NodeType::VoxelServer) { | |
| 3486 | − QUuid nodeUUID = node->getUUID(); | |
| 3487 | − // see if this is the first we've heard of this node... | |
| 3488 | − _voxelServerJurisdictions.lockForRead(); | |
| 3489 | − if (_voxelServerJurisdictions.find(nodeUUID) != _voxelServerJurisdictions.end()) { | |
| 3490 | − unsigned char* rootCode = _voxelServerJurisdictions[nodeUUID].getRootOctalCode(); | |
| 3491 | − VoxelPositionSize rootDetails; | |
| 3492 | − voxelDetailsForCode(rootCode, rootDetails); | |
| 3493 | − _voxelServerJurisdictions.unlock(); | |
| 3494 | − | |
| 3495 | − qDebug("voxel server going away...... v[%f, %f, %f, %f]", | |
| 3496 | − rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s); | |
| 3497 | − | |
| 3498 | − // Add the jurisditionDetails object to the list of "fade outs" | |
| 3499 | − if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) { | |
| 3500 | − VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE); | |
| 3501 | − fade.voxelDetails = rootDetails; | |
| 3502 | − const float slightly_smaller = 0.99f; | |
| 3503 | − fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller; | |
| 3504 | − _voxelFadesLock.lockForWrite(); | |
| 3505 | − _voxelFades.push_back(fade); | |
| 3506 | − _voxelFadesLock.unlock(); | |
| 3507 | − } | |
| 3508 | − | |
| 3509 | − // If the voxel server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server | |
| 3510 | − _voxelServerJurisdictions.lockForWrite(); | |
| 3511 | − _voxelServerJurisdictions.erase(_voxelServerJurisdictions.find(nodeUUID)); | |
| 3512 | − } | |
| 3513 | − _voxelServerJurisdictions.unlock(); | |
| 3514 | − | |
| 3515 | − // also clean up scene stats for that server | |
| 3516 | − _octreeSceneStatsLock.lockForWrite(); | |
| 3517 | − if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) { | |
| 3518 | − _octreeServerSceneStats.erase(nodeUUID); | |
| 3519 | − } | |
| 3520 | − _octreeSceneStatsLock.unlock(); | |
| 3521 | − | |
| 3522 | − } else if (node->getType() == NodeType::EntityServer) { | |
| 3445 | + if (node->getType() == NodeType::EntityServer) { | |
| 3523 | 3446 | |
| 3524 | 3447 | QUuid nodeUUID = node->getUUID(); |
| 3525 | 3448 | // see if this is the first we've heard of this node... |
| @@ -3563,7 +3486,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 37 unmodified lines | ||
| 3563 | 3486 | } |
| 3564 | 3487 | } |
| 3565 | 3488 | |
| 3566 | −void Application::trackIncomingVoxelPacket(const QByteArray& packet, const SharedNodePointer& sendingNode, bool wasStatsPacket) { | |
| 3489 | +void Application::trackIncomingOctreePacket(const QByteArray& packet, const SharedNodePointer& sendingNode, bool wasStatsPacket) { | |
| 3567 | 3490 | |
| 3568 | 3491 | // Attempt to identify the sender from it's address. |
| 3569 | 3492 | if (sendingNode) { |
| @@ -3607,10 +3530,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin · 37 unmodified lines | ||
| 3607 | 3530 | // see if this is the first we've heard of this node... |
| 3608 | 3531 | NodeToJurisdictionMap* jurisdiction = NULL; |
| 3609 | 3532 | QString serverType; |
| 3610 | − if (sendingNode->getType() == NodeType::VoxelServer) { | |
| 3611 | − jurisdiction = &_voxelServerJurisdictions; | |
| 3612 | − serverType = "Voxel"; | |
| 3613 | − } else { | |
| 3533 | + if (sendingNode->getType() == NodeType::EntityServer) { | |
| 3614 | 3534 | jurisdiction = &_entityServerJurisdictions; |
| 3615 | 3535 | serverType = "Entity"; |
| 3616 | 3536 | } |
| @@ -3704,9 +3624,6 @@ void joystickFromScriptValue(const QScriptValue &object, Joystick* &out) { · 87 unmodified lines | ||
| 3704 | 3624 | void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scriptEngine) { |
| 3705 | 3625 | // setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so |
| 3706 | 3626 | // we can use the same ones from the application. |
| 3707 | − scriptEngine->getVoxelsScriptingInterface()->setPacketSender(&_voxelEditSender); | |
| 3708 | − scriptEngine->getVoxelsScriptingInterface()->setVoxelTree(_voxels.getTree()); | |
| 3709 | − scriptEngine->getVoxelsScriptingInterface()->setUndoStack(&_undoStack); | |
| 3710 | 3627 | scriptEngine->getEntityScriptingInterface()->setPacketSender(&_entityEditSender); |
| 3711 | 3628 | scriptEngine->getEntityScriptingInterface()->setEntityTree(_entities.getTree()); |
| 3712 | 3629 | |
| @@ -3968,10 +3885,6 @@ void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject · 255 unmodified lines | ||
| 3968 | 3885 | |
| 3969 | 3886 | qDebug() << "Voxel costs are" << satoshisPerVoxel << "per voxel and" << satoshisPerMeterCubed << "per meter cubed"; |
| 3970 | 3887 | qDebug() << "Destination wallet UUID for voxel payments is" << voxelWalletUUID; |
| 3971 | − | |
| 3972 | − _voxelEditSender.setSatoshisPerVoxel(satoshisPerVoxel); | |
| 3973 | − _voxelEditSender.setSatoshisPerMeterCubed(satoshisPerMeterCubed); | |
| 3974 | − _voxelEditSender.setDestinationWalletUUID(voxelWalletUUID); | |
| 3975 | 3888 | } |
| 3976 | 3889 | |
| 3977 | 3890 | QString Application::getPreviousScriptLocation() { |