Showing the changes to interface/src/Application.cpp (1 of 109 files). Show all
Unified · Split
| @@ -85,6 +85,8 @@ · 84 unmodified lines | |||
| 85 | #include "Util.h" | 85 | #include "Util.h" |
| 86 | 86 | ||
| 87 | #include "audio/AudioToolBox.h" | 87 | #include "audio/AudioToolBox.h" |
| 88 | #include "audio/AudioIOStatsRenderer.h" | ||
| 89 | #include "audio/AudioScope.h" | ||
| 88 | 90 | ||
| 89 | #include "devices/DdeFaceTracker.h" | 91 | #include "devices/DdeFaceTracker.h" |
| 90 | #include "devices/Faceshift.h" | 92 | #include "devices/Faceshift.h" |
| @@ -142,8 +144,42 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt · 51 unmodified lines | |||
| 142 | } | 144 | } |
| 143 | } | 145 | } |
| 144 | 146 | ||
| 147 | bool setupEssentials(int& argc, char** argv) { | ||
| 148 | unsigned int listenPort = 0; // bind to an ephemeral port by default | ||
| 149 | const char** constArgv = const_cast<const char**>(argv); | ||
| 150 | const char* portStr = getCmdOption(argc, constArgv, "--listenPort"); | ||
| 151 | if (portStr) { | ||
| 152 | listenPort = atoi(portStr); | ||
| 153 | } | ||
| 154 | |||
| 155 | DependencyManager::registerInheritance<LimitedNodeList, NodeList>(); | ||
| 156 | |||
| 157 | // Set dependencies | ||
| 158 | auto glCanvas = DependencyManager::set<GLCanvas>(); | ||
| 159 | auto addressManager = DependencyManager::set<AddressManager>(); | ||
| 160 | auto nodeList = DependencyManager::set<NodeList>(NodeType::Agent, listenPort); | ||
| 161 | auto geometryCache = DependencyManager::set<GeometryCache>(); | ||
| 162 | auto glowEffect = DependencyManager::set<GlowEffect>(); | ||
| 163 | auto faceshift = DependencyManager::set<Faceshift>(); | ||
| 164 | auto audio = DependencyManager::set<Audio>(); | ||
| 165 | auto audioScope = DependencyManager::set<AudioScope>(); | ||
| 166 | auto audioIOStatsRenderer = DependencyManager::set<AudioIOStatsRenderer>(); | ||
| 167 | auto deferredLightingEffect = DependencyManager::set<DeferredLightingEffect>(); | ||
| 168 | auto ambientOcclusionEffect = DependencyManager::set<AmbientOcclusionEffect>(); | ||
| 169 | auto textureCache = DependencyManager::set<TextureCache>(); | ||
| 170 | auto animationCache = DependencyManager::set<AnimationCache>(); | ||
| 171 | auto visage = DependencyManager::set<Visage>(); | ||
| 172 | auto ddeFaceTracker = DependencyManager::set<DdeFaceTracker>(); | ||
| 173 | auto modelBlender = DependencyManager::set<ModelBlender>(); | ||
| 174 | auto audioToolBox = DependencyManager::set<AudioToolBox>(); | ||
| 175 | |||
| 176 | return true; | ||
| 177 | } | ||
| 178 | |||
| 179 | |||
| 145 | Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : | 180 | Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : |
| 146 | QApplication(argc, argv), | 181 | QApplication(argc, argv), |
| 182 | _dependencyManagerIsSetup(setupEssentials(argc, argv)), | ||
| 147 | _window(new MainWindow(desktop())), | 183 | _window(new MainWindow(desktop())), |
| 148 | _toolWindow(NULL), | 184 | _toolWindow(NULL), |
| 149 | _nodeThread(new QThread(this)), | 185 | _nodeThread(new QThread(this)), |
| @@ -189,9 +225,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 39 unmodified lines | |||
| 189 | _isVSyncOn(true), | 225 | _isVSyncOn(true), |
| 190 | _aboutToQuit(false) | 226 | _aboutToQuit(false) |
| 191 | { | 227 | { |
| 192 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 228 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 229 | auto nodeList = DependencyManager::get<NodeList>(); | ||
| 193 | Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us | 230 | Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us |
| 194 | 231 | ||
| 232 | |||
| 195 | // read the ApplicationInfo.ini file for Name/Version/Domain information | 233 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| 196 | QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); | 234 | QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); |
| 197 | 235 | ||
| @@ -222,23 +260,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 24 unmodified lines | |||
| 222 | _window->setMenuBar(Menu::getInstance()); | 260 | _window->setMenuBar(Menu::getInstance()); |
| 223 | 261 | ||
| 224 | _runningScriptsWidget = new RunningScriptsWidget(_window); | 262 | _runningScriptsWidget = new RunningScriptsWidget(_window); |
| 225 | |||
| 226 | unsigned int listenPort = 0; // bind to an ephemeral port by default | ||
| 227 | const char** constArgv = const_cast<const char**>(argv); | ||
| 228 | const char* portStr = getCmdOption(argc, constArgv, "--listenPort"); | ||
| 229 | if (portStr) { | ||
| 230 | listenPort = atoi(portStr); | ||
| 231 | } | ||
| 232 | 263 | ||
| 233 | // start the nodeThread so its event loop is running | 264 | // start the nodeThread so its event loop is running |
| 234 | _nodeThread->start(); | 265 | _nodeThread->start(); |
| 235 | 266 | ||
| 236 | // make sure the node thread is given highest priority | 267 | // make sure the node thread is given highest priority |
| 237 | _nodeThread->setPriority(QThread::TimeCriticalPriority); | 268 | _nodeThread->setPriority(QThread::TimeCriticalPriority); |
| 238 | 269 | ||
| 239 | // put the NodeList and datagram processing on the node thread | 270 | // put the NodeList and datagram processing on the node thread |
| 240 | NodeList* nodeList = NodeList::createInstance(NodeType::Agent, listenPort); | ||
| 241 | |||
| 242 | nodeList->moveToThread(_nodeThread); | 271 | nodeList->moveToThread(_nodeThread); |
| 243 | _datagramProcessor.moveToThread(_nodeThread); | 272 | _datagramProcessor.moveToThread(_nodeThread); |
| 244 | 273 | ||
| @@ -248,7 +277,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 3 unmodified lines | |||
| 248 | // put the audio processing on a separate thread | 277 | // put the audio processing on a separate thread |
| 249 | QThread* audioThread = new QThread(this); | 278 | QThread* audioThread = new QThread(this); |
| 250 | 279 | ||
| 251 | Audio::SharedPointer audioIO = DependencyManager::get<Audio>(); | 280 | auto audioIO = DependencyManager::get<Audio>(); |
| 252 | audioIO->moveToThread(audioThread); | 281 | audioIO->moveToThread(audioThread); |
| 253 | connect(audioThread, &QThread::started, audioIO.data(), &Audio::start); | 282 | connect(audioThread, &QThread::started, audioIO.data(), &Audio::start); |
| 254 | 283 | ||
| @@ -271,11 +300,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 16 unmodified lines | |||
| 271 | connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer); | 300 | connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer); |
| 272 | locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS); | 301 | locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS); |
| 273 | 302 | ||
| 274 | connect(nodeList, &NodeList::nodeAdded, this, &Application::nodeAdded); | 303 | connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded); |
| 275 | connect(nodeList, &NodeList::nodeKilled, this, &Application::nodeKilled); | 304 | connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled); |
| 276 | connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer))); | 305 | connect(nodeList.data(), SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer))); |
| 277 | connect(nodeList, &NodeList::uuidChanged, _myAvatar, &MyAvatar::setSessionUUID); | 306 | connect(nodeList.data(), &NodeList::uuidChanged, _myAvatar, &MyAvatar::setSessionUUID); |
| 278 | connect(nodeList, &NodeList::limitOfSilentDomainCheckInsReached, nodeList, &NodeList::reset); | 307 | connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset); |
| 279 | 308 | ||
| 280 | // connect to appropriate slots on AccountManager | 309 | // connect to appropriate slots on AccountManager |
| 281 | AccountManager& accountManager = AccountManager::getInstance(); | 310 | AccountManager& accountManager = AccountManager::getInstance(); |
| @@ -301,7 +330,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 19 unmodified lines | |||
| 301 | // once the event loop has started, check and signal for an access token | 330 | // once the event loop has started, check and signal for an access token |
| 302 | QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection); | 331 | QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection); |
| 303 | 332 | ||
| 304 | AddressManager::SharedPointer addressManager = DependencyManager::get<AddressManager>(); | 333 | auto addressManager = DependencyManager::get<AddressManager>(); |
| 305 | 334 | ||
| 306 | // use our MyAvatar position and quat for address manager path | 335 | // use our MyAvatar position and quat for address manager path |
| 307 | addressManager->setPositionGetter(getPositionForPath); | 336 | addressManager->setPositionGetter(getPositionForPath); |
| @@ -325,7 +354,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 17 unmodified lines | |||
| 325 | 354 | ||
| 326 | // move the silentNodeTimer to the _nodeThread | 355 | // move the silentNodeTimer to the _nodeThread |
| 327 | QTimer* silentNodeTimer = new QTimer(); | 356 | QTimer* silentNodeTimer = new QTimer(); |
| 328 | connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes())); | 357 | connect(silentNodeTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes())); |
| 329 | silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS); | 358 | silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS); |
| 330 | silentNodeTimer->moveToThread(_nodeThread); | 359 | silentNodeTimer->moveToThread(_nodeThread); |
| 331 | 360 | ||
| @@ -444,7 +473,7 @@ Application::~Application() { · 112 unmodified lines | |||
| 444 | // kill any audio injectors that are still around | 473 | // kill any audio injectors that are still around |
| 445 | AudioScriptingInterface::getInstance().stopAllInjectors(); | 474 | AudioScriptingInterface::getInstance().stopAllInjectors(); |
| 446 | 475 | ||
| 447 | Audio::SharedPointer audioIO = DependencyManager::get<Audio>(); | 476 | auto audioIO = DependencyManager::get<Audio>(); |
| 448 | 477 | ||
| 449 | // stop the audio process | 478 | // stop the audio process |
| 450 | QMetaObject::invokeMethod(audioIO.data(), "stop", Qt::BlockingQueuedConnection); | 479 | QMetaObject::invokeMethod(audioIO.data(), "stop", Qt::BlockingQueuedConnection); |
| @@ -459,6 +488,8 @@ Application::~Application() { · 8 unmodified lines | |||
| 459 | Menu::getInstance()->deleteLater(); | 488 | Menu::getInstance()->deleteLater(); |
| 460 | 489 | ||
| 461 | _myAvatar = NULL; | 490 | _myAvatar = NULL; |
| 491 | |||
| 492 | DependencyManager::destroy<GLCanvas>(); | ||
| 462 | } | 493 | } |
| 463 | 494 | ||
| 464 | void Application::saveSettings() { | 495 | void Application::saveSettings() { |
| @@ -734,7 +765,7 @@ void Application::controlledBroadcastToNodes(const QByteArray& packet, const Nod · 269 unmodified lines | |||
| 734 | foreach(NodeType_t type, destinationNodeTypes) { | 765 | foreach(NodeType_t type, destinationNodeTypes) { |
| 735 | 766 | ||
| 736 | // Perform the broadcast for one type | 767 | // Perform the broadcast for one type |
| 737 | int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, NodeSet() << type); | 768 | int nReceivingNodes = DependencyManager::get<NodeList>()->broadcastToNodes(packet, NodeSet() << type); |
| 738 | 769 | ||
| 739 | // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise) | 770 | // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise) |
| 740 | BandwidthMeter::ChannelIndex channel; | 771 | BandwidthMeter::ChannelIndex channel; |
| @@ -953,7 +984,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 212 unmodified lines | |||
| 953 | if (isShifted) { | 984 | if (isShifted) { |
| 954 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f); | 985 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f); |
| 955 | if (TV3DManager::isConnected()) { | 986 | if (TV3DManager::isConnected()) { |
| 956 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 987 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 957 | TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | 988 | TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 958 | } | 989 | } |
| 959 | } else { | 990 | } else { |
| @@ -966,7 +997,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 6 unmodified lines | |||
| 966 | if (isShifted) { | 997 | if (isShifted) { |
| 967 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f); | 998 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f); |
| 968 | if (TV3DManager::isConnected()) { | 999 | if (TV3DManager::isConnected()) { |
| 969 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 1000 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 970 | TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | 1001 | TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 971 | } | 1002 | } |
| 972 | 1003 | ||
| @@ -1328,7 +1359,7 @@ void Application::dropEvent(QDropEvent *event) { · 355 unmodified lines | |||
| 1328 | SnapshotMetaData* snapshotData = Snapshot::parseSnapshotData(snapshotPath); | 1359 | SnapshotMetaData* snapshotData = Snapshot::parseSnapshotData(snapshotPath); |
| 1329 | if (snapshotData) { | 1360 | if (snapshotData) { |
| 1330 | if (!snapshotData->getDomain().isEmpty()) { | 1361 | if (!snapshotData->getDomain().isEmpty()) { |
| 1331 | NodeList::getInstance()->getDomainHandler().setHostnameAndPort(snapshotData->getDomain()); | 1362 | DependencyManager::get<NodeList>()->getDomainHandler().setHostnameAndPort(snapshotData->getDomain()); |
| 1332 | } | 1363 | } |
| 1333 | 1364 | ||
| 1334 | _myAvatar->setPosition(snapshotData->getLocation()); | 1365 | _myAvatar->setPosition(snapshotData->getLocation()); |
| @@ -1342,7 +1373,7 @@ void Application::dropEvent(QDropEvent *event) { · 7 unmodified lines | |||
| 1342 | } | 1373 | } |
| 1343 | 1374 | ||
| 1344 | void Application::sendPingPackets() { | 1375 | void Application::sendPingPackets() { |
| 1345 | QByteArray pingPacket = NodeList::getInstance()->constructPingPacket(); | 1376 | QByteArray pingPacket = DependencyManager::get<NodeList>()->constructPingPacket(); |
| 1346 | controlledBroadcastToNodes(pingPacket, NodeSet() | 1377 | controlledBroadcastToNodes(pingPacket, NodeSet() |
| 1347 | << NodeType::EntityServer | 1378 | << NodeType::EntityServer |
| 1348 | << NodeType::AudioMixer << NodeType::AvatarMixer | 1379 | << NodeType::AudioMixer << NodeType::AvatarMixer |
| @@ -1368,7 +1399,7 @@ void Application::timer() { · 19 unmodified lines | |||
| 1368 | _timerStart.start(); | 1399 | _timerStart.start(); |
| 1369 | 1400 | ||
| 1370 | // ask the node list to check in with the domain server | 1401 | // ask the node list to check in with the domain server |
| 1371 | NodeList::getInstance()->sendDomainServerCheckIn(); | 1402 | DependencyManager::get<NodeList>()->sendDomainServerCheckIn(); |
| 1372 | } | 1403 | } |
| 1373 | 1404 | ||
| 1374 | void Application::idle() { | 1405 | void Application::idle() { |
| @@ -1424,7 +1455,7 @@ void Application::idle() { · 49 unmodified lines | |||
| 1424 | 1455 | ||
| 1425 | void Application::checkBandwidthMeterClick() { | 1456 | void Application::checkBandwidthMeterClick() { |
| 1426 | // ... to be called upon button release | 1457 | // ... to be called upon button release |
| 1427 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 1458 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 1428 | if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) && | 1459 | if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) && |
| 1429 | Menu::getInstance()->isOptionChecked(MenuOption::Stats) && | 1460 | Menu::getInstance()->isOptionChecked(MenuOption::Stats) && |
| 1430 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) && | 1461 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) && |
| @@ -1460,7 +1491,7 @@ void Application::setFullscreen(bool fullscreen) { · 29 unmodified lines | |||
| 1460 | } | 1491 | } |
| 1461 | 1492 | ||
| 1462 | void Application::setEnable3DTVMode(bool enable3DTVMode) { | 1493 | void Application::setEnable3DTVMode(bool enable3DTVMode) { |
| 1463 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 1494 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 1464 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | 1495 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 1465 | } | 1496 | } |
| 1466 | 1497 | ||
| @@ -1486,7 +1517,7 @@ void Application::setEnableVRMode(bool enableVRMode) { · 19 unmodified lines | |||
| 1486 | _myCamera.setHmdRotation(glm::quat()); | 1517 | _myCamera.setHmdRotation(glm::quat()); |
| 1487 | } | 1518 | } |
| 1488 | 1519 | ||
| 1489 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 1520 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 1490 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | 1521 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 1491 | } | 1522 | } |
| 1492 | 1523 | ||
| @@ -1496,7 +1527,7 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) { · 3 unmodified lines | |||
| 1496 | 1527 | ||
| 1497 | bool Application::mouseOnScreen() const { | 1528 | bool Application::mouseOnScreen() const { |
| 1498 | if (OculusManager::isConnected()) { | 1529 | if (OculusManager::isConnected()) { |
| 1499 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 1530 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 1500 | return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() && | 1531 | return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() && |
| 1501 | getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight(); | 1532 | getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight(); |
| 1502 | } | 1533 | } |
| @@ -1538,9 +1569,9 @@ int Application::getMouseDragStartedY() const { · 35 unmodified lines | |||
| 1538 | } | 1569 | } |
| 1539 | 1570 | ||
| 1540 | FaceTracker* Application::getActiveFaceTracker() { | 1571 | FaceTracker* Application::getActiveFaceTracker() { |
| 1541 | Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>(); | 1572 | auto faceshift = DependencyManager::get<Faceshift>(); |
| 1542 | Visage::SharedPointer visage = DependencyManager::get<Visage>(); | 1573 | auto visage = DependencyManager::get<Visage>(); |
| 1543 | DdeFaceTracker::SharedPointer dde = DependencyManager::get<DdeFaceTracker>(); | 1574 | auto dde = DependencyManager::get<DdeFaceTracker>(); |
| 1544 | 1575 | ||
| 1545 | return (dde->isActive() ? static_cast<FaceTracker*>(dde.data()) : | 1576 | return (dde->isActive() ? static_cast<FaceTracker*>(dde.data()) : |
| 1546 | (faceshift->isActive() ? static_cast<FaceTracker*>(faceshift.data()) : | 1577 | (faceshift->isActive() ? static_cast<FaceTracker*>(faceshift.data()) : |
| @@ -1656,7 +1687,7 @@ void Application::init() { · 109 unmodified lines | |||
| 1656 | Leapmotion::init(); | 1687 | Leapmotion::init(); |
| 1657 | 1688 | ||
| 1658 | // fire off an immediate domain-server check in now that settings are loaded | 1689 | // fire off an immediate domain-server check in now that settings are loaded |
| 1659 | NodeList::getInstance()->sendDomainServerCheckIn(); | 1690 | DependencyManager::get<NodeList>()->sendDomainServerCheckIn(); |
| 1660 | 1691 | ||
| 1661 | _entities.init(); | 1692 | _entities.init(); |
| 1662 | _entities.setViewFrustum(getViewFrustum()); | 1693 | _entities.setViewFrustum(getViewFrustum()); |
| @@ -1684,7 +1715,7 @@ void Application::init() { · 21 unmodified lines | |||
| 1684 | 1715 | ||
| 1685 | _metavoxels.init(); | 1716 | _metavoxels.init(); |
| 1686 | 1717 | ||
| 1687 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 1718 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 1688 | _rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect, _settings); | 1719 | _rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect, _settings); |
| 1689 | 1720 | ||
| 1690 | connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); | 1721 | connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); |
| @@ -1774,7 +1805,7 @@ void Application::updateMouseRay() { · 83 unmodified lines | |||
| 1774 | void Application::updateFaceshift() { | 1805 | void Application::updateFaceshift() { |
| 1775 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1806 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1776 | PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); | 1807 | PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); |
| 1777 | Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>(); | 1808 | auto faceshift = DependencyManager::get<Faceshift>(); |
| 1778 | // Update faceshift | 1809 | // Update faceshift |
| 1779 | faceshift->update(); | 1810 | faceshift->update(); |
| 1780 | 1811 | ||
| @@ -2123,7 +2154,7 @@ int Application::sendNackPackets() { · 342 unmodified lines | |||
| 2123 | char packet[MAX_PACKET_SIZE]; | 2154 | char packet[MAX_PACKET_SIZE]; |
| 2124 | 2155 | ||
| 2125 | // iterates thru all nodes in NodeList | 2156 | // iterates thru all nodes in NodeList |
| 2126 | NodeList* nodeList = NodeList::getInstance(); | 2157 | auto nodeList = DependencyManager::get<NodeList>(); |
| 2127 | 2158 | ||
| 2128 | nodeList->eachNode([&](const SharedNodePointer& node){ | 2159 | nodeList->eachNode([&](const SharedNodePointer& node){ |
| 2129 | 2160 | ||
| @@ -2221,7 +2252,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 91 unmodified lines | |||
| 2221 | int inViewServers = 0; | 2252 | int inViewServers = 0; |
| 2222 | int unknownJurisdictionServers = 0; | 2253 | int unknownJurisdictionServers = 0; |
| 2223 | 2254 | ||
| 2224 | NodeList* nodeList = NodeList::getInstance(); | 2255 | auto nodeList = DependencyManager::get<NodeList>(); |
| 2225 | 2256 | ||
| 2226 | nodeList->eachNode([&](const SharedNodePointer& node) { | 2257 | nodeList->eachNode([&](const SharedNodePointer& node) { |
| 2227 | // only send to the NodeTypes that are serverType | 2258 | // only send to the NodeTypes that are serverType |
| @@ -2585,7 +2616,7 @@ void Application::updateShadowMap() { · 357 unmodified lines | |||
| 2585 | 2616 | ||
| 2586 | fbo->release(); | 2617 | fbo->release(); |
| 2587 | 2618 | ||
| 2588 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 2619 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 2589 | glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | 2620 | glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 2590 | } | 2621 | } |
| 2591 | 2622 | ||
| @@ -2921,7 +2952,7 @@ bool Application::getCascadeShadowsEnabled() { · 329 unmodified lines | |||
| 2921 | } | 2952 | } |
| 2922 | 2953 | ||
| 2923 | glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { | 2954 | glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { |
| 2924 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | 2955 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 2925 | float horizontalScale = glCanvas->getDeviceWidth() / 2.0f; | 2956 | float horizontalScale = glCanvas->getDeviceWidth() / 2.0f; |
| 2926 | float verticalScale = glCanvas->getDeviceHeight() / 2.0f; | 2957 | float verticalScale = glCanvas->getDeviceHeight() / 2.0f; |
| 2927 | 2958 | ||
| @@ -3107,7 +3138,7 @@ void Application::setMenuShortcutsEnabled(bool enabled) { · 179 unmodified lines | |||
| 3107 | void Application::updateWindowTitle(){ | 3138 | void Application::updateWindowTitle(){ |
| 3108 | 3139 | ||
| 3109 | QString buildVersion = " (build " + applicationVersion() + ")"; | 3140 | QString buildVersion = " (build " + applicationVersion() + ")"; |
| 3110 | NodeList* nodeList = NodeList::getInstance(); | 3141 | auto nodeList = DependencyManager::get<NodeList>(); |
| 3111 | 3142 | ||
| 3112 | QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) "; | 3143 | QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) "; |
| 3113 | QString username = AccountManager::getInstance().getAccountInfo().getUsername(); | 3144 | QString username = AccountManager::getInstance().getAccountInfo().getUsername(); |
| @@ -3124,7 +3155,7 @@ void Application::updateWindowTitle(){ · 10 unmodified lines | |||
| 3124 | void Application::updateLocationInServer() { | 3155 | void Application::updateLocationInServer() { |
| 3125 | 3156 | ||
| 3126 | AccountManager& accountManager = AccountManager::getInstance(); | 3157 | AccountManager& accountManager = AccountManager::getInstance(); |
| 3127 | DomainHandler& domainHandler = NodeList::getInstance()->getDomainHandler(); | 3158 | DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler(); |
| 3128 | 3159 | ||
| 3129 | if (accountManager.isLoggedIn() && domainHandler.isConnected() && !domainHandler.getUUID().isNull()) { | 3160 | if (accountManager.isLoggedIn() && domainHandler.isConnected() && !domainHandler.getUUID().isNull()) { |
| 3130 | 3161 | ||
| @@ -3175,7 +3206,7 @@ void Application::domainChanged(const QString& domainHostname) { · 44 unmodified lines | |||
| 3175 | 3206 | ||
| 3176 | void Application::connectedToDomain(const QString& hostname) { | 3207 | void Application::connectedToDomain(const QString& hostname) { |
| 3177 | AccountManager& accountManager = AccountManager::getInstance(); | 3208 | AccountManager& accountManager = AccountManager::getInstance(); |
| 3178 | const QUuid& domainID = NodeList::getInstance()->getDomainHandler().getUUID(); | 3209 | const QUuid& domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID(); |
| 3179 | 3210 | ||
| 3180 | if (accountManager.isLoggedIn() && !domainID.isNull()) { | 3211 | if (accountManager.isLoggedIn() && !domainID.isNull()) { |
| 3181 | // update our data-server with the domain-server we're logged in with | 3212 | // update our data-server with the domain-server we're logged in with |
| @@ -3462,8 +3493,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 280 unmodified lines | |||
| 3462 | // when the application is about to quit, stop our script engine so it unwinds properly | 3493 | // when the application is about to quit, stop our script engine so it unwinds properly |
| 3463 | connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop())); | 3494 | connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop())); |
| 3464 | 3495 | ||
| 3465 | NodeList* nodeList = NodeList::getInstance(); | 3496 | auto nodeList = DependencyManager::get<NodeList>(); |
| 3466 | connect(nodeList, &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled); | 3497 | connect(nodeList.data(), &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled); |
| 3467 | 3498 | ||
| 3468 | scriptEngine->moveToThread(workerThread); | 3499 | scriptEngine->moveToThread(workerThread); |
| 3469 | 3500 | ||