Showing the changes to interface/src/Application.cpp (1 of 110 files). Show all
Unified · Split
| @@ -172,7 +172,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 171 unmodified lines | |||
| 172 | _runningScriptsWidget(NULL), | 172 | _runningScriptsWidget(NULL), |
| 173 | _runningScriptsWidgetWasVisible(false), | 173 | _runningScriptsWidgetWasVisible(false), |
| 174 | _trayIcon(new QSystemTrayIcon(_window)), | 174 | _trayIcon(new QSystemTrayIcon(_window)), |
| 175 | _lastNackTime(usecTimestampNow()) | 175 | _lastNackTime(usecTimestampNow()), |
| 176 | _lastSendDownstreamAudioStats(usecTimestampNow()) | ||
| 176 | { | 177 | { |
| 177 | // read the ApplicationInfo.ini file for Name/Version/Domain information | 178 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| 178 | QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); | 179 | QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); |
| @@ -354,6 +355,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 175 unmodified lines | |||
| 354 | 355 | ||
| 355 | // Set the sixense filtering | 356 | // Set the sixense filtering |
| 356 | _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense)); | 357 | _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense)); |
| 358 | |||
| 359 | // Set hand controller velocity filtering | ||
| 360 | _sixenseManager.setLowVelocityFilter(Menu::getInstance()->isOptionChecked(MenuOption::LowVelocityFilter)); | ||
| 357 | 361 | ||
| 358 | checkVersion(); | 362 | checkVersion(); |
| 359 | 363 | ||
| @@ -601,9 +605,19 @@ void Application::paintGL() { · 241 unmodified lines | |||
| 601 | 605 | ||
| 602 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { | 606 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 603 | _myCamera.setTightness(0.0f); | 607 | _myCamera.setTightness(0.0f); |
| 604 | _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | 608 | //Only behave like a true mirror when in the OR |
| 605 | _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | 609 | if (OculusManager::isConnected()) { |
| 606 | _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition() + glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0)); | 610 | _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 611 | _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | ||
| 612 | _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition() + glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0)); | ||
| 613 | } else { | ||
| 614 | _myCamera.setTightness(0.0f); | ||
| 615 | glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition(); | ||
| 616 | float headHeight = eyePosition.y - _myAvatar->getPosition().y; | ||
| 617 | _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | ||
| 618 | _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0)); | ||
| 619 | _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | ||
| 620 | } | ||
| 607 | } | 621 | } |
| 608 | 622 | ||
| 609 | // Update camera position | 623 | // Update camera position |
| @@ -682,13 +696,10 @@ void Application::paintGL() { · 72 unmodified lines | |||
| 682 | } | 696 | } |
| 683 | 697 | ||
| 684 | { | 698 | { |
| 685 | PerformanceTimer perfTimer("paintGL/renderOverlay"); | 699 | PerformanceTimer perfTimer("renderOverlay"); |
| 686 | //If alpha is 1, we can render directly to the screen. | 700 | // PrioVR will only work if renderOverlay is called, calibration is connected to Application::renderingOverlay() |
| 687 | if (_applicationOverlay.getAlpha() == 1.0f) { | 701 | _applicationOverlay.renderOverlay(true); |
| 688 | _applicationOverlay.renderOverlay(); | 702 | if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { |
| 689 | } else { | ||
| 690 | //Render to to texture so we can fade it | ||
| 691 | _applicationOverlay.renderOverlay(true); | ||
| 692 | _applicationOverlay.displayOverlayTexture(); | 703 | _applicationOverlay.displayOverlayTexture(); |
| 693 | } | 704 | } |
| 694 | } | 705 | } |
| @@ -1010,6 +1021,9 @@ void Application::keyPressEvent(QKeyEvent* event) { · 315 unmodified lines | |||
| 1010 | Menu::getInstance()->triggerOption(MenuOption::FullscreenMirror); | 1021 | Menu::getInstance()->triggerOption(MenuOption::FullscreenMirror); |
| 1011 | } | 1022 | } |
| 1012 | break; | 1023 | break; |
| 1024 | case Qt::Key_Slash: | ||
| 1025 | Menu::getInstance()->triggerOption(MenuOption::UserInterface); | ||
| 1026 | break; | ||
| 1013 | case Qt::Key_F: | 1027 | case Qt::Key_F: |
| 1014 | if (isShifted) { | 1028 | if (isShifted) { |
| 1015 | Menu::getInstance()->triggerOption(MenuOption::DisplayFrustum); | 1029 | Menu::getInstance()->triggerOption(MenuOption::DisplayFrustum); |
| @@ -1029,7 +1043,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 13 unmodified lines | |||
| 1029 | } | 1043 | } |
| 1030 | break; | 1044 | break; |
| 1031 | break; | 1045 | break; |
| 1032 | case Qt::Key_Slash: | 1046 | case Qt::Key_Percent: |
| 1033 | Menu::getInstance()->triggerOption(MenuOption::Stats); | 1047 | Menu::getInstance()->triggerOption(MenuOption::Stats); |
| 1034 | break; | 1048 | break; |
| 1035 | case Qt::Key_Plus: | 1049 | case Qt::Key_Plus: |
| @@ -1355,18 +1369,18 @@ void Application::idle() { · 319 unmodified lines | |||
| 1355 | if (timeSinceLastUpdate > IDLE_SIMULATE_MSECS) { | 1369 | if (timeSinceLastUpdate > IDLE_SIMULATE_MSECS) { |
| 1356 | _lastTimeUpdated.start(); | 1370 | _lastTimeUpdated.start(); |
| 1357 | { | 1371 | { |
| 1358 | PerformanceTimer perfTimer("idle/update"); | 1372 | PerformanceTimer perfTimer("update"); |
| 1359 | PerformanceWarning warn(showWarnings, "Application::idle()... update()"); | 1373 | PerformanceWarning warn(showWarnings, "Application::idle()... update()"); |
| 1360 | const float BIGGEST_DELTA_TIME_SECS = 0.25f; | 1374 | const float BIGGEST_DELTA_TIME_SECS = 0.25f; |
| 1361 | update(glm::clamp((float)timeSinceLastUpdate / 1000.f, 0.f, BIGGEST_DELTA_TIME_SECS)); | 1375 | update(glm::clamp((float)timeSinceLastUpdate / 1000.f, 0.f, BIGGEST_DELTA_TIME_SECS)); |
| 1362 | } | 1376 | } |
| 1363 | { | 1377 | { |
| 1364 | PerformanceTimer perfTimer("idle/updateGL"); | 1378 | PerformanceTimer perfTimer("updateGL"); |
| 1365 | PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()"); | 1379 | PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()"); |
| 1366 | _glWidget->updateGL(); | 1380 | _glWidget->updateGL(); |
| 1367 | } | 1381 | } |
| 1368 | { | 1382 | { |
| 1369 | PerformanceTimer perfTimer("idle/rest"); | 1383 | PerformanceTimer perfTimer("rest"); |
| 1370 | PerformanceWarning warn(showWarnings, "Application::idle()... rest of it"); | 1384 | PerformanceWarning warn(showWarnings, "Application::idle()... rest of it"); |
| 1371 | _idleLoopStdev.addValue(timeSinceLastUpdate); | 1385 | _idleLoopStdev.addValue(timeSinceLastUpdate); |
| 1372 | 1386 | ||
| @@ -1378,7 +1392,7 @@ void Application::idle() { · 5 unmodified lines | |||
| 1378 | } | 1392 | } |
| 1379 | 1393 | ||
| 1380 | if (Menu::getInstance()->isOptionChecked(MenuOption::BuckyBalls)) { | 1394 | if (Menu::getInstance()->isOptionChecked(MenuOption::BuckyBalls)) { |
| 1381 | PerformanceTimer perfTimer("idle/rest/_buckyBalls"); | 1395 | PerformanceTimer perfTimer("buckyBalls"); |
| 1382 | _buckyBalls.simulate(timeSinceLastUpdate / 1000.f, Application::getInstance()->getAvatar()->getHandData()); | 1396 | _buckyBalls.simulate(timeSinceLastUpdate / 1000.f, Application::getInstance()->getAvatar()->getHandData()); |
| 1383 | } | 1397 | } |
| 1384 | 1398 | ||
| @@ -1426,6 +1440,10 @@ void Application::setRenderVoxels(bool voxelRender) { · 41 unmodified lines | |||
| 1426 | } | 1440 | } |
| 1427 | } | 1441 | } |
| 1428 | 1442 | ||
| 1443 | void Application::setLowVelocityFilter(bool lowVelocityFilter) { | ||
| 1444 | getSixenseManager()->setLowVelocityFilter(lowVelocityFilter); | ||
| 1445 | } | ||
| 1446 | |||
| 1429 | void Application::doKillLocalVoxels() { | 1447 | void Application::doKillLocalVoxels() { |
| 1430 | _wantToKillLocalVoxels = true; | 1448 | _wantToKillLocalVoxels = true; |
| 1431 | } | 1449 | } |
| @@ -1792,7 +1810,7 @@ bool Application::isLookingAtMyAvatar(Avatar* avatar) { · 360 unmodified lines | |||
| 1792 | } | 1810 | } |
| 1793 | 1811 | ||
| 1794 | void Application::updateLOD() { | 1812 | void Application::updateLOD() { |
| 1795 | PerformanceTimer perfTimer("idle/update/updateLOD"); | 1813 | PerformanceTimer perfTimer("LOD"); |
| 1796 | // adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode | 1814 | // adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode |
| 1797 | if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD) && !isThrottleRendering()) { | 1815 | if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD) && !isThrottleRendering()) { |
| 1798 | Menu::getInstance()->autoAdjustLOD(_fps); | 1816 | Menu::getInstance()->autoAdjustLOD(_fps); |
| @@ -1802,7 +1820,7 @@ void Application::updateLOD() { · 3 unmodified lines | |||
| 1802 | } | 1820 | } |
| 1803 | 1821 | ||
| 1804 | void Application::updateMouseRay() { | 1822 | void Application::updateMouseRay() { |
| 1805 | PerformanceTimer perfTimer("idle/update/updateMouseRay"); | 1823 | PerformanceTimer perfTimer("mouseRay"); |
| 1806 | 1824 | ||
| 1807 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1825 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1808 | PerformanceWarning warn(showWarnings, "Application::updateMouseRay()"); | 1826 | PerformanceWarning warn(showWarnings, "Application::updateMouseRay()"); |
| @@ -1835,8 +1853,6 @@ void Application::updateMouseRay() { · 26 unmodified lines | |||
| 1835 | } | 1853 | } |
| 1836 | 1854 | ||
| 1837 | void Application::updateFaceshift() { | 1855 | void Application::updateFaceshift() { |
| 1838 | PerformanceTimer perfTimer("idle/update/updateFaceshift"); | ||
| 1839 | |||
| 1840 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1856 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1841 | PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); | 1857 | PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); |
| 1842 | 1858 | ||
| @@ -1850,8 +1866,6 @@ void Application::updateFaceshift() { · 7 unmodified lines | |||
| 1850 | } | 1866 | } |
| 1851 | 1867 | ||
| 1852 | void Application::updateVisage() { | 1868 | void Application::updateVisage() { |
| 1853 | PerformanceTimer perfTimer("idle/update/updateVisage"); | ||
| 1854 | |||
| 1855 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1869 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1856 | PerformanceWarning warn(showWarnings, "Application::updateVisage()"); | 1870 | PerformanceWarning warn(showWarnings, "Application::updateVisage()"); |
| 1857 | 1871 | ||
| @@ -1860,11 +1874,11 @@ void Application::updateVisage() { · 2 unmodified lines | |||
| 1860 | } | 1874 | } |
| 1861 | 1875 | ||
| 1862 | void Application::updateMyAvatarLookAtPosition() { | 1876 | void Application::updateMyAvatarLookAtPosition() { |
| 1863 | PerformanceTimer perfTimer("idle/update/updateMyAvatarLookAtPosition"); | 1877 | PerformanceTimer perfTimer("lookAt"); |
| 1864 | |||
| 1865 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1878 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1866 | PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()"); | 1879 | PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()"); |
| 1867 | 1880 | ||
| 1881 | _myAvatar->updateLookAtTargetAvatar(); | ||
| 1868 | FaceTracker* tracker = getActiveFaceTracker(); | 1882 | FaceTracker* tracker = getActiveFaceTracker(); |
| 1869 | 1883 | ||
| 1870 | bool isLookingAtSomeone = false; | 1884 | bool isLookingAtSomeone = false; |
| @@ -1927,7 +1941,7 @@ void Application::updateMyAvatarLookAtPosition() { · 56 unmodified lines | |||
| 1927 | } | 1941 | } |
| 1928 | 1942 | ||
| 1929 | void Application::updateThreads(float deltaTime) { | 1943 | void Application::updateThreads(float deltaTime) { |
| 1930 | PerformanceTimer perfTimer("idle/update/updateThreads"); | 1944 | PerformanceTimer perfTimer("updateThreads"); |
| 1931 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1945 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1932 | PerformanceWarning warn(showWarnings, "Application::updateThreads()"); | 1946 | PerformanceWarning warn(showWarnings, "Application::updateThreads()"); |
| 1933 | 1947 | ||
| @@ -1942,7 +1956,7 @@ void Application::updateThreads(float deltaTime) { · 8 unmodified lines | |||
| 1942 | } | 1956 | } |
| 1943 | 1957 | ||
| 1944 | void Application::updateMetavoxels(float deltaTime) { | 1958 | void Application::updateMetavoxels(float deltaTime) { |
| 1945 | PerformanceTimer perfTimer("idle/update/updateMetavoxels"); | 1959 | PerformanceTimer perfTimer("updateMetavoxels"); |
| 1946 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1960 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1947 | PerformanceWarning warn(showWarnings, "Application::updateMetavoxels()"); | 1961 | PerformanceWarning warn(showWarnings, "Application::updateMetavoxels()"); |
| 1948 | 1962 | ||
| @@ -1972,7 +1986,7 @@ void Application::cameraMenuChanged() { · 23 unmodified lines | |||
| 1972 | } | 1986 | } |
| 1973 | 1987 | ||
| 1974 | void Application::updateCamera(float deltaTime) { | 1988 | void Application::updateCamera(float deltaTime) { |
| 1975 | PerformanceTimer perfTimer("idle/update/updateCamera"); | 1989 | PerformanceTimer perfTimer("updateCamera"); |
| 1976 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1990 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1977 | PerformanceWarning warn(showWarnings, "Application::updateCamera()"); | 1991 | PerformanceWarning warn(showWarnings, "Application::updateCamera()"); |
| 1978 | 1992 | ||
| @@ -1990,7 +2004,7 @@ void Application::updateCamera(float deltaTime) { · 11 unmodified lines | |||
| 1990 | } | 2004 | } |
| 1991 | 2005 | ||
| 1992 | void Application::updateDialogs(float deltaTime) { | 2006 | void Application::updateDialogs(float deltaTime) { |
| 1993 | PerformanceTimer perfTimer("idle/update/updateDialogs"); | 2007 | PerformanceTimer perfTimer("updateDialogs"); |
| 1994 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 2008 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1995 | PerformanceWarning warn(showWarnings, "Application::updateDialogs()"); | 2009 | PerformanceWarning warn(showWarnings, "Application::updateDialogs()"); |
| 1996 | 2010 | ||
| @@ -2007,7 +2021,7 @@ void Application::updateDialogs(float deltaTime) { · 10 unmodified lines | |||
| 2007 | } | 2021 | } |
| 2008 | 2022 | ||
| 2009 | void Application::updateCursor(float deltaTime) { | 2023 | void Application::updateCursor(float deltaTime) { |
| 2010 | PerformanceTimer perfTimer("idle/update/updateCursor"); | 2024 | PerformanceTimer perfTimer("updateCursor"); |
| 2011 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 2025 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2012 | PerformanceWarning warn(showWarnings, "Application::updateCursor()"); | 2026 | PerformanceWarning warn(showWarnings, "Application::updateCursor()"); |
| 2013 | 2027 | ||
| @@ -2032,83 +2046,69 @@ void Application::updateCursor(float deltaTime) { · 18 unmodified lines | |||
| 2032 | } | 2046 | } |
| 2033 | 2047 | ||
| 2034 | void Application::update(float deltaTime) { | 2048 | void Application::update(float deltaTime) { |
| 2035 | //PerformanceTimer perfTimer("idle/update"); // NOTE: we track this above in Application::idle() | ||
| 2036 | |||
| 2037 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 2049 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2038 | PerformanceWarning warn(showWarnings, "Application::update()"); | 2050 | PerformanceWarning warn(showWarnings, "Application::update()"); |
| 2039 | 2051 | ||
| 2040 | updateLOD(); | 2052 | updateLOD(); |
| 2041 | updateMouseRay(); // check what's under the mouse and update the mouse voxel | 2053 | updateMouseRay(); // check what's under the mouse and update the mouse voxel |
| 2042 | updateFaceshift(); | ||
| 2043 | updateVisage(); | ||
| 2044 | |||
| 2045 | { | ||
| 2046 | PerformanceTimer perfTimer("idle/update/updateLookAtTargetAvatar"); | ||
| 2047 | _myAvatar->updateLookAtTargetAvatar(); | ||
| 2048 | } | ||
| 2049 | updateMyAvatarLookAtPosition(); | ||
| 2050 | { | 2054 | { |
| 2051 | PerformanceTimer perfTimer("idle/update/sixense,joystick,prioVR"); | 2055 | PerformanceTimer perfTimer("devices"); |
| 2056 | updateFaceshift(); | ||
| 2057 | updateVisage(); | ||
| 2052 | _sixenseManager.update(deltaTime); | 2058 | _sixenseManager.update(deltaTime); |
| 2053 | _joystickManager.update(); | 2059 | _joystickManager.update(); |
| 2054 | _prioVR.update(deltaTime); | 2060 | _prioVR.update(deltaTime); |
| 2055 | } | 2061 | } |
| 2056 | |||
| 2057 | { | 2062 | { |
| 2058 | PerformanceTimer perfTimer("idle/update/updateMyAvatar"); | 2063 | PerformanceTimer perfTimer("myAvatar"); |
| 2064 | updateMyAvatarLookAtPosition(); | ||
| 2059 | updateMyAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes | 2065 | updateMyAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes |
| 2060 | } | 2066 | } |
| 2061 | 2067 | ||
| 2062 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... | 2068 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... |
| 2063 | 2069 | ||
| 2064 | { | 2070 | _avatarManager.updateOtherAvatars(deltaTime); //loop through all the other avatars and simulate them... |
| 2065 | PerformanceTimer perfTimer("idle/update/_avatarManager"); | 2071 | |
| 2066 | _avatarManager.updateOtherAvatars(deltaTime); //loop through all the other avatars and simulate them... | ||
| 2067 | } | ||
| 2068 | updateMetavoxels(deltaTime); // update metavoxels | 2072 | updateMetavoxels(deltaTime); // update metavoxels |
| 2069 | updateCamera(deltaTime); // handle various camera tweaks like off axis projection | 2073 | updateCamera(deltaTime); // handle various camera tweaks like off axis projection |
| 2070 | updateDialogs(deltaTime); // update various stats dialogs if present | 2074 | updateDialogs(deltaTime); // update various stats dialogs if present |
| 2071 | updateCursor(deltaTime); // Handle cursor updates | 2075 | updateCursor(deltaTime); // Handle cursor updates |
| 2072 | 2076 | ||
| 2073 | { | 2077 | { |
| 2074 | PerformanceTimer perfTimer("idle/update/_particles"); | 2078 | PerformanceTimer perfTimer("particles"); |
| 2075 | _particles.update(); // update the particles... | 2079 | _particles.update(); // update the particles... |
| 2076 | } | 2080 | { |
| 2077 | { | 2081 | PerformanceTimer perfTimer("collisions"); |
| 2078 | PerformanceTimer perfTimer("idle/update/_particleCollisionSystem"); | 2082 | _particleCollisionSystem.update(); // collide the particles... |
| 2079 | _particleCollisionSystem.update(); // collide the particles... | 2083 | } |
| 2080 | } | 2084 | } |
| 2081 | 2085 | ||
| 2082 | { | 2086 | { |
| 2083 | PerformanceTimer perfTimer("idle/update/_entities"); | 2087 | PerformanceTimer perfTimer("entities"); |
| 2084 | _entities.update(); // update the models... | 2088 | _entities.update(); // update the models... |
| 2085 | } | 2089 | } |
| 2086 | 2090 | ||
| 2087 | { | 2091 | { |
| 2088 | PerformanceTimer perfTimer("idle/update/_overlays"); | 2092 | PerformanceTimer perfTimer("overlays"); |
| 2089 | _overlays.update(deltaTime); | 2093 | _overlays.update(deltaTime); |
| 2090 | } | 2094 | } |
| 2091 | 2095 | ||
| 2092 | { | 2096 | { |
| 2093 | PerformanceTimer perfTimer("idle/update/emit simulating"); | 2097 | PerformanceTimer perfTimer("emitSimulating"); |
| 2094 | // let external parties know we're updating | 2098 | // let external parties know we're updating |
| 2095 | emit simulating(deltaTime); | 2099 | emit simulating(deltaTime); |
| 2096 | } | 2100 | } |
| 2097 | } | 2101 | } |
| 2098 | 2102 | ||
| 2099 | void Application::updateMyAvatar(float deltaTime) { | 2103 | void Application::updateMyAvatar(float deltaTime) { |
| 2100 | PerformanceTimer perfTimer("updateMyAvatar"); | ||
| 2101 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 2104 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2102 | PerformanceWarning warn(showWarnings, "Application::updateMyAvatar()"); | 2105 | PerformanceWarning warn(showWarnings, "Application::updateMyAvatar()"); |
| 2103 | 2106 | ||
| 2104 | { | 2107 | _myAvatar->update(deltaTime); |
| 2105 | PerformanceTimer perfTimer("updateMyAvatar/_myAvatar->update()"); | ||
| 2106 | _myAvatar->update(deltaTime); | ||
| 2107 | } | ||
| 2108 | 2108 | ||
| 2109 | { | 2109 | { |
| 2110 | // send head/hand data to the avatar mixer and voxel server | 2110 | // send head/hand data to the avatar mixer and voxel server |
| 2111 | PerformanceTimer perfTimer("updateMyAvatar/sendToAvatarMixer"); | 2111 | PerformanceTimer perfTimer("send"); |
| 2112 | QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData); | 2112 | QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData); |
| 2113 | packet.append(_myAvatar->toByteArray()); | 2113 | packet.append(_myAvatar->toByteArray()); |
| 2114 | controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer); | 2114 | controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer); |
| @@ -2121,14 +2121,15 @@ void Application::updateMyAvatar(float deltaTime) { · 6 unmodified lines | |||
| 2121 | // actually need to calculate the view frustum planes to send these details | 2121 | // actually need to calculate the view frustum planes to send these details |
| 2122 | // to the server. | 2122 | // to the server. |
| 2123 | { | 2123 | { |
| 2124 | PerformanceTimer perfTimer("updateMyAvatar/loadViewFrustum"); | 2124 | PerformanceTimer perfTimer("loadViewFrustum"); |
| 2125 | loadViewFrustum(_myCamera, _viewFrustum); | 2125 | loadViewFrustum(_myCamera, _viewFrustum); |
| 2126 | } | 2126 | } |
| 2127 | 2127 | ||
| 2128 | quint64 now = usecTimestampNow(); | ||
| 2129 | |||
| 2128 | // Update my voxel servers with my current voxel query... | 2130 | // Update my voxel servers with my current voxel query... |
| 2129 | { | 2131 | { |
| 2130 | PerformanceTimer perfTimer("updateMyAvatar/queryOctree"); | 2132 | PerformanceTimer perfTimer("queryOctree"); |
| 2131 | quint64 now = usecTimestampNow(); | ||
| 2132 | quint64 sinceLastQuery = now - _lastQueriedTime; | 2133 | quint64 sinceLastQuery = now - _lastQueriedTime; |
| 2133 | const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND; | 2134 | const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND; |
| 2134 | bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY; | 2135 | bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY; |
| @@ -2146,7 +2147,6 @@ void Application::updateMyAvatar(float deltaTime) { · 11 unmodified lines | |||
| 2146 | 2147 | ||
| 2147 | // sent nack packets containing missing sequence numbers of received packets from nodes | 2148 | // sent nack packets containing missing sequence numbers of received packets from nodes |
| 2148 | { | 2149 | { |
| 2149 | quint64 now = usecTimestampNow(); | ||
| 2150 | quint64 sinceLastNack = now - _lastNackTime; | 2150 | quint64 sinceLastNack = now - _lastNackTime; |
| 2151 | const quint64 TOO_LONG_SINCE_LAST_NACK = 1 * USECS_PER_SECOND; | 2151 | const quint64 TOO_LONG_SINCE_LAST_NACK = 1 * USECS_PER_SECOND; |
| 2152 | if (sinceLastNack > TOO_LONG_SINCE_LAST_NACK) { | 2152 | if (sinceLastNack > TOO_LONG_SINCE_LAST_NACK) { |
| @@ -2154,6 +2154,15 @@ void Application::updateMyAvatar(float deltaTime) { · 1 unmodified line | |||
| 2154 | sendNackPackets(); | 2154 | sendNackPackets(); |
| 2155 | } | 2155 | } |
| 2156 | } | 2156 | } |
| 2157 | |||
| 2158 | { | ||
| 2159 | quint64 sinceLastNack = now - _lastSendDownstreamAudioStats; | ||
| 2160 | if (sinceLastNack > TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS) { | ||
| 2161 | _lastSendDownstreamAudioStats = now; | ||
| 2162 | |||
| 2163 | QMetaObject::invokeMethod(&_audio, "sendDownstreamAudioStatsPacket", Qt::QueuedConnection); | ||
| 2164 | } | ||
| 2165 | } | ||
| 2157 | } | 2166 | } |
| 2158 | 2167 | ||
| 2159 | int Application::sendNackPackets() { | 2168 | int Application::sendNackPackets() { |
| @@ -2460,7 +2469,7 @@ glm::vec3 Application::getSunDirection() { · 300 unmodified lines | |||
| 2460 | } | 2469 | } |
| 2461 | 2470 | ||
| 2462 | void Application::updateShadowMap() { | 2471 | void Application::updateShadowMap() { |
| 2463 | PerformanceTimer perfTimer("paintGL/updateShadowMap"); | 2472 | PerformanceTimer perfTimer("shadowMap"); |
| 2464 | QOpenGLFramebufferObject* fbo = _textureCache.getShadowFramebufferObject(); | 2473 | QOpenGLFramebufferObject* fbo = _textureCache.getShadowFramebufferObject(); |
| 2465 | fbo->bind(); | 2474 | fbo->bind(); |
| 2466 | glEnable(GL_DEPTH_TEST); | 2475 | glEnable(GL_DEPTH_TEST); |
| @@ -2622,7 +2631,7 @@ QImage Application::renderAvatarBillboard() { · 155 unmodified lines | |||
| 2622 | } | 2631 | } |
| 2623 | 2632 | ||
| 2624 | void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { | 2633 | void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { |
| 2625 | PerformanceTimer perfTimer("paintGL/displaySide"); | 2634 | PerformanceTimer perfTimer("display"); |
| 2626 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()"); | 2635 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()"); |
| 2627 | // transform by eye offset | 2636 | // transform by eye offset |
| 2628 | 2637 | ||
| @@ -2656,7 +2665,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 27 unmodified lines | |||
| 2656 | 2665 | ||
| 2657 | // Setup 3D lights (after the camera transform, so that they are positioned in world space) | 2666 | // Setup 3D lights (after the camera transform, so that they are positioned in world space) |
| 2658 | { | 2667 | { |
| 2659 | PerformanceTimer perfTimer("paintGL/displaySide/setupWorldLight"); | 2668 | PerformanceTimer perfTimer("lights"); |
| 2660 | setupWorldLight(); | 2669 | setupWorldLight(); |
| 2661 | } | 2670 | } |
| 2662 | 2671 | ||
| @@ -2675,7 +2684,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 12 unmodified lines | |||
| 2675 | } | 2684 | } |
| 2676 | 2685 | ||
| 2677 | if (!selfAvatarOnly && Menu::getInstance()->isOptionChecked(MenuOption::Stars)) { | 2686 | if (!selfAvatarOnly && Menu::getInstance()->isOptionChecked(MenuOption::Stars)) { |
| 2678 | PerformanceTimer perfTimer("paintGL/displaySide/stars"); | 2687 | PerformanceTimer perfTimer("stars"); |
| 2679 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2688 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2680 | "Application::displaySide() ... stars..."); | 2689 | "Application::displaySide() ... stars..."); |
| 2681 | if (!_stars.isStarsLoaded()) { | 2690 | if (!_stars.isStarsLoaded()) { |
| @@ -2704,7 +2713,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 22 unmodified lines | |||
| 2704 | 2713 | ||
| 2705 | // draw the sky dome | 2714 | // draw the sky dome |
| 2706 | if (!selfAvatarOnly && Menu::getInstance()->isOptionChecked(MenuOption::Atmosphere)) { | 2715 | if (!selfAvatarOnly && Menu::getInstance()->isOptionChecked(MenuOption::Atmosphere)) { |
| 2707 | PerformanceTimer perfTimer("paintGL/displaySide/atmosphere"); | 2716 | PerformanceTimer perfTimer("atmosphere"); |
| 2708 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2717 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2709 | "Application::displaySide() ... atmosphere..."); | 2718 | "Application::displaySide() ... atmosphere..."); |
| 2710 | _environment.renderAtmospheres(whichCamera); | 2719 | _environment.renderAtmospheres(whichCamera); |
| @@ -2725,13 +2734,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 14 unmodified lines | |||
| 2725 | 2734 | ||
| 2726 | // draw the audio reflector overlay | 2735 | // draw the audio reflector overlay |
| 2727 | { | 2736 | { |
| 2728 | PerformanceTimer perfTimer("paintGL/displaySide/audioReflector"); | 2737 | PerformanceTimer perfTimer("audio"); |
| 2729 | _audioReflector.render(); | 2738 | _audioReflector.render(); |
| 2730 | } | 2739 | } |
| 2731 | 2740 | ||
| 2732 | // Draw voxels | 2741 | // Draw voxels |
| 2733 | if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { | 2742 | if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { |
| 2734 | PerformanceTimer perfTimer("paintGL/displaySide/voxels"); | 2743 | PerformanceTimer perfTimer("voxels"); |
| 2735 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2744 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2736 | "Application::displaySide() ... voxels..."); | 2745 | "Application::displaySide() ... voxels..."); |
| 2737 | _voxels.render(); | 2746 | _voxels.render(); |
| @@ -2739,14 +2748,14 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | |||
| 2739 | 2748 | ||
| 2740 | // also, metavoxels | 2749 | // also, metavoxels |
| 2741 | if (Menu::getInstance()->isOptionChecked(MenuOption::Metavoxels)) { | 2750 | if (Menu::getInstance()->isOptionChecked(MenuOption::Metavoxels)) { |
| 2742 | PerformanceTimer perfTimer("paintGL/displaySide/metavoxels"); | 2751 | PerformanceTimer perfTimer("metavoxels"); |
| 2743 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2752 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2744 | "Application::displaySide() ... metavoxels..."); | 2753 | "Application::displaySide() ... metavoxels..."); |
| 2745 | _metavoxels.render(); | 2754 | _metavoxels.render(); |
| 2746 | } | 2755 | } |
| 2747 | 2756 | ||
| 2748 | if (Menu::getInstance()->isOptionChecked(MenuOption::BuckyBalls)) { | 2757 | if (Menu::getInstance()->isOptionChecked(MenuOption::BuckyBalls)) { |
| 2749 | PerformanceTimer perfTimer("paintGL/displaySide/buckyBalls"); | 2758 | PerformanceTimer perfTimer("buckyBalls"); |
| 2750 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2759 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2751 | "Application::displaySide() ... bucky balls..."); | 2760 | "Application::displaySide() ... bucky balls..."); |
| 2752 | _buckyBalls.render(); | 2761 | _buckyBalls.render(); |
| @@ -2754,7 +2763,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | |||
| 2754 | 2763 | ||
| 2755 | // render particles... | 2764 | // render particles... |
| 2756 | if (Menu::getInstance()->isOptionChecked(MenuOption::Particles)) { | 2765 | if (Menu::getInstance()->isOptionChecked(MenuOption::Particles)) { |
| 2757 | PerformanceTimer perfTimer("paintGL/displaySide/particles"); | 2766 | PerformanceTimer perfTimer("particles"); |
| 2758 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2767 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2759 | "Application::displaySide() ... particles..."); | 2768 | "Application::displaySide() ... particles..."); |
| 2760 | _particles.render(); | 2769 | _particles.render(); |
| @@ -2762,7 +2771,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | |||
| 2762 | 2771 | ||
| 2763 | // render models... | 2772 | // render models... |
| 2764 | if (Menu::getInstance()->isOptionChecked(MenuOption::Models)) { | 2773 | if (Menu::getInstance()->isOptionChecked(MenuOption::Models)) { |
| 2765 | PerformanceTimer perfTimer("paintGL/displaySide/models"); | 2774 | PerformanceTimer perfTimer("models"); |
| 2766 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2775 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2767 | "Application::displaySide() ... models..."); | 2776 | "Application::displaySide() ... models..."); |
| 2768 | _entities.render(); | 2777 | _entities.render(); |
| @@ -2770,7 +2779,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | |||
| 2770 | 2779 | ||
| 2771 | // render the ambient occlusion effect if enabled | 2780 | // render the ambient occlusion effect if enabled |
| 2772 | if (Menu::getInstance()->isOptionChecked(MenuOption::AmbientOcclusion)) { | 2781 | if (Menu::getInstance()->isOptionChecked(MenuOption::AmbientOcclusion)) { |
| 2773 | PerformanceTimer perfTimer("paintGL/displaySide/AmbientOcclusion"); | 2782 | PerformanceTimer perfTimer("ambientOcclusion"); |
| 2774 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2783 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2775 | "Application::displaySide() ... AmbientOcclusion..."); | 2784 | "Application::displaySide() ... AmbientOcclusion..."); |
| 2776 | _ambientOcclusionEffect.render(); | 2785 | _ambientOcclusionEffect.render(); |
| @@ -2785,20 +2794,22 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 8 unmodified lines | |||
| 2785 | 2794 | ||
| 2786 | bool mirrorMode = (whichCamera.getInterpolatedMode() == CAMERA_MODE_MIRROR); | 2795 | bool mirrorMode = (whichCamera.getInterpolatedMode() == CAMERA_MODE_MIRROR); |
| 2787 | { | 2796 | { |
| 2788 | PerformanceTimer perfTimer("paintGL/displaySide/renderAvatars"); | 2797 | PerformanceTimer perfTimer("avatars"); |
| 2798 | |||
| 2789 | _avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, selfAvatarOnly); | 2799 | _avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, selfAvatarOnly); |
| 2790 | } | 2800 | } |
| 2791 | 2801 | ||
| 2792 | if (!selfAvatarOnly) { | 2802 | if (!selfAvatarOnly) { |
| 2793 | // Render the world box | 2803 | // Render the world box |
| 2794 | if (whichCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats)) { | 2804 | if (whichCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats) && |
| 2795 | PerformanceTimer perfTimer("paintGL/displaySide/renderWorldBox"); | 2805 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { |
| 2806 | PerformanceTimer perfTimer("worldBox"); | ||
| 2796 | renderWorldBox(); | 2807 | renderWorldBox(); |
| 2797 | } | 2808 | } |
| 2798 | 2809 | ||
| 2799 | // view frustum for debugging | 2810 | // view frustum for debugging |
| 2800 | if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayFrustum) && whichCamera.getMode() != CAMERA_MODE_MIRROR) { | 2811 | if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayFrustum) && whichCamera.getMode() != CAMERA_MODE_MIRROR) { |
| 2801 | PerformanceTimer perfTimer("paintGL/displaySide/ViewFrustum"); | 2812 | PerformanceTimer perfTimer("viewFrustum"); |
| 2802 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2813 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2803 | "Application::displaySide() ... renderViewFrustum..."); | 2814 | "Application::displaySide() ... renderViewFrustum..."); |
| 2804 | renderViewFrustum(_viewFrustum); | 2815 | renderViewFrustum(_viewFrustum); |
| @@ -2806,7 +2817,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | |||
| 2806 | 2817 | ||
| 2807 | // render voxel fades if they exist | 2818 | // render voxel fades if they exist |
| 2808 | if (_voxelFades.size() > 0) { | 2819 | if (_voxelFades.size() > 0) { |
| 2809 | PerformanceTimer perfTimer("paintGL/displaySide/voxel fades"); | 2820 | PerformanceTimer perfTimer("voxelFades"); |
| 2810 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 2821 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2811 | "Application::displaySide() ... voxel fades..."); | 2822 | "Application::displaySide() ... voxel fades..."); |
| 2812 | _voxelFadesLock.lockForWrite(); | 2823 | _voxelFadesLock.lockForWrite(); |
| @@ -2823,13 +2834,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 10 unmodified lines | |||
| 2823 | 2834 | ||
| 2824 | // give external parties a change to hook in | 2835 | // give external parties a change to hook in |
| 2825 | { | 2836 | { |
| 2826 | PerformanceTimer perfTimer("paintGL/displaySide/inWorldInterface"); | 2837 | PerformanceTimer perfTimer("inWorldInterface"); |
| 2827 | emit renderingInWorldInterface(); | 2838 | emit renderingInWorldInterface(); |
| 2828 | } | 2839 | } |
| 2829 | 2840 | ||
| 2830 | // render JS/scriptable overlays | 2841 | // render JS/scriptable overlays |
| 2831 | { | 2842 | { |
| 2832 | PerformanceTimer perfTimer("paintGL/displaySide/3dOverlays"); | 2843 | PerformanceTimer perfTimer("3dOverlays"); |
| 2833 | _overlays.render3D(); | 2844 | _overlays.render3D(); |
| 2834 | } | 2845 | } |
| 2835 | } | 2846 | } |