Showing the changes to interface/src/Application.cpp (1 of 238 files). Show all
Unified · Split
| @@ -89,6 +89,8 @@ · 88 unmodified lines | ||
| 89 | 89 | #include "ui/Stats.h" |
| 90 | 90 | #include "ui/TextRenderer.h" |
| 91 | 91 | |
| 92 | +#include "devices/Leapmotion.h" | |
| 93 | + | |
| 92 | 94 | using namespace std; |
| 93 | 95 | |
| 94 | 96 | // Starfield information |
| @@ -155,7 +157,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 60 unmodified lines | ||
| 155 | 157 | _mouseX(0), |
| 156 | 158 | _mouseY(0), |
| 157 | 159 | _lastMouseMove(usecTimestampNow()), |
| 158 | − _lastMouseMoveType(QEvent::MouseMove), | |
| 160 | + _lastMouseMoveWasSimulated(false), | |
| 159 | 161 | _mouseHidden(false), |
| 160 | 162 | _seenMouseMove(false), |
| 161 | 163 | _touchAvgX(0.0f), |
| @@ -174,7 +176,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 12 unmodified lines | ||
| 174 | 176 | _runningScriptsWidget(NULL), |
| 175 | 177 | _runningScriptsWidgetWasVisible(false), |
| 176 | 178 | _trayIcon(new QSystemTrayIcon(_window)), |
| 177 | − _lastNackTime(usecTimestampNow()) | |
| 179 | + _lastNackTime(usecTimestampNow()), | |
| 180 | + _lastSendDownstreamAudioStats(usecTimestampNow()) | |
| 178 | 181 | { |
| 179 | 182 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| 180 | 183 | QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); |
| @@ -356,6 +359,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 175 unmodified lines | ||
| 356 | 359 | |
| 357 | 360 | // Set the sixense filtering |
| 358 | 361 | _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense)); |
| 362 | + | |
| 363 | + // Set hand controller velocity filtering | |
| 364 | + _sixenseManager.setLowVelocityFilter(Menu::getInstance()->isOptionChecked(MenuOption::LowVelocityFilter)); | |
| 359 | 365 | |
| 360 | 366 | checkVersion(); |
| 361 | 367 | |
| @@ -588,7 +594,7 @@ void Application::paintGL() { · 226 unmodified lines | ||
| 588 | 594 | |
| 589 | 595 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { |
| 590 | 596 | _myCamera.setTightness(0.0f); // In first person, camera follows (untweaked) head exactly without delay |
| 591 | − _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition()); | |
| 597 | + _myCamera.setTargetPosition(_myAvatar->getHead()->getFilteredEyePosition()); | |
| 592 | 598 | _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); |
| 593 | 599 | |
| 594 | 600 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| @@ -603,9 +609,19 @@ void Application::paintGL() { · 8 unmodified lines | ||
| 603 | 609 | |
| 604 | 610 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 605 | 611 | _myCamera.setTightness(0.0f); |
| 606 | − _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | |
| 607 | − _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | |
| 608 | − _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition() + glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0)); | |
| 612 | + //Only behave like a true mirror when in the OR | |
| 613 | + if (OculusManager::isConnected()) { | |
| 614 | + _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | |
| 615 | + _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | |
| 616 | + _myCamera.setTargetPosition(_myAvatar->getHead()->getEyePosition() + glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0)); | |
| 617 | + } else { | |
| 618 | + _myCamera.setTightness(0.0f); | |
| 619 | + glm::vec3 eyePosition = _myAvatar->getHead()->getFilteredEyePosition(); | |
| 620 | + float headHeight = eyePosition.y - _myAvatar->getPosition().y; | |
| 621 | + _myCamera.setDistance(MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | |
| 622 | + _myCamera.setTargetPosition(_myAvatar->getPosition() + glm::vec3(0, headHeight + (_raiseMirror * _myAvatar->getScale()), 0)); | |
| 623 | + _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | |
| 624 | + } | |
| 609 | 625 | } |
| 610 | 626 | |
| 611 | 627 | // Update camera position |
| @@ -684,7 +700,7 @@ void Application::paintGL() { · 72 unmodified lines | ||
| 684 | 700 | } |
| 685 | 701 | |
| 686 | 702 | { |
| 687 | − PerformanceTimer perfTimer("paintGL/renderOverlay"); | |
| 703 | + PerformanceTimer perfTimer("renderOverlay"); | |
| 688 | 704 | // PrioVR will only work if renderOverlay is called, calibration is connected to Application::renderingOverlay() |
| 689 | 705 | _applicationOverlay.renderOverlay(true); |
| 690 | 706 | if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { |
| @@ -712,7 +728,6 @@ void Application::resizeGL(int width, int height) { · 21 unmodified lines | ||
| 712 | 728 | resetCamerasOnResizeGL(_myCamera, width, height); |
| 713 | 729 | |
| 714 | 730 | glViewport(0, 0, width, height); // shouldn't this account for the menu??? |
| 715 | − _applicationOverlay.resize(); | |
| 716 | 731 | |
| 717 | 732 | updateProjectionMatrix(); |
| 718 | 733 | glLoadIdentity(); |
| @@ -1128,18 +1143,19 @@ void Application::focusOutEvent(QFocusEvent* event) { · 409 unmodified lines | ||
| 1128 | 1143 | _keysPressed.clear(); |
| 1129 | 1144 | } |
| 1130 | 1145 | |
| 1131 | −void Application::mouseMoveEvent(QMouseEvent* event) { | |
| 1146 | +void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { | |
| 1132 | 1147 | |
| 1133 | 1148 | bool showMouse = true; |
| 1149 | + | |
| 1150 | + // Used by application overlay to determine how to draw cursor(s) | |
| 1151 | + _lastMouseMoveWasSimulated = deviceID > 0; | |
| 1152 | + | |
| 1134 | 1153 | // If this mouse move event is emitted by a controller, dont show the mouse cursor |
| 1135 | − if (event->type() == CONTROLLER_MOVE_EVENT) { | |
| 1154 | + if (_lastMouseMoveWasSimulated) { | |
| 1136 | 1155 | showMouse = false; |
| 1137 | 1156 | } |
| 1138 | 1157 | |
| 1139 | − // Used by application overlay to determine how to draw cursor(s) | |
| 1140 | − _lastMouseMoveType = event->type(); | |
| 1141 | − | |
| 1142 | − _controllerScriptingInterface.emitMouseMoveEvent(event); // send events to any registered scripts | |
| 1158 | + _controllerScriptingInterface.emitMouseMoveEvent(event, deviceID); // send events to any registered scripts | |
| 1143 | 1159 | |
| 1144 | 1160 | // if one of our scripts have asked to capture this event, then stop processing it |
| 1145 | 1161 | if (_controllerScriptingInterface.isMouseCaptured()) { |
| @@ -1158,7 +1174,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 12 unmodified lines | ||
| 1158 | 1174 | _mouseY = event->y(); |
| 1159 | 1175 | } |
| 1160 | 1176 | |
| 1161 | −void Application::mousePressEvent(QMouseEvent* event) { | |
| 1177 | +void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { | |
| 1162 | 1178 | _controllerScriptingInterface.emitMousePressEvent(event); // send events to any registered scripts |
| 1163 | 1179 | |
| 1164 | 1180 | // if one of our scripts have asked to capture this event, then stop processing it |
| @@ -1191,7 +1207,7 @@ void Application::mousePressEvent(QMouseEvent* event) { · 26 unmodified lines | ||
| 1191 | 1207 | } |
| 1192 | 1208 | } |
| 1193 | 1209 | |
| 1194 | −void Application::mouseReleaseEvent(QMouseEvent* event) { | |
| 1210 | +void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { | |
| 1195 | 1211 | _controllerScriptingInterface.emitMouseReleaseEvent(event); // send events to any registered scripts |
| 1196 | 1212 | |
| 1197 | 1213 | // if one of our scripts have asked to capture this event, then stop processing it |
| @@ -1358,18 +1374,18 @@ void Application::idle() { · 160 unmodified lines | ||
| 1358 | 1374 | if (timeSinceLastUpdate > IDLE_SIMULATE_MSECS) { |
| 1359 | 1375 | _lastTimeUpdated.start(); |
| 1360 | 1376 | { |
| 1361 | − PerformanceTimer perfTimer("idle/update"); | |
| 1377 | + PerformanceTimer perfTimer("update"); | |
| 1362 | 1378 | PerformanceWarning warn(showWarnings, "Application::idle()... update()"); |
| 1363 | 1379 | const float BIGGEST_DELTA_TIME_SECS = 0.25f; |
| 1364 | 1380 | update(glm::clamp((float)timeSinceLastUpdate / 1000.f, 0.f, BIGGEST_DELTA_TIME_SECS)); |
| 1365 | 1381 | } |
| 1366 | 1382 | { |
| 1367 | − PerformanceTimer perfTimer("idle/updateGL"); | |
| 1383 | + PerformanceTimer perfTimer("updateGL"); | |
| 1368 | 1384 | PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()"); |
| 1369 | 1385 | _glWidget->updateGL(); |
| 1370 | 1386 | } |
| 1371 | 1387 | { |
| 1372 | − PerformanceTimer perfTimer("idle/rest"); | |
| 1388 | + PerformanceTimer perfTimer("rest"); | |
| 1373 | 1389 | PerformanceWarning warn(showWarnings, "Application::idle()... rest of it"); |
| 1374 | 1390 | _idleLoopStdev.addValue(timeSinceLastUpdate); |
| 1375 | 1391 | |
| @@ -1381,7 +1397,7 @@ void Application::idle() { · 5 unmodified lines | ||
| 1381 | 1397 | } |
| 1382 | 1398 | |
| 1383 | 1399 | if (Menu::getInstance()->isOptionChecked(MenuOption::BuckyBalls)) { |
| 1384 | − PerformanceTimer perfTimer("idle/rest/_buckyBalls"); | |
| 1400 | + PerformanceTimer perfTimer("buckyBalls"); | |
| 1385 | 1401 | _buckyBalls.simulate(timeSinceLastUpdate / 1000.f, Application::getInstance()->getAvatar()->getHandData()); |
| 1386 | 1402 | } |
| 1387 | 1403 | |
| @@ -1429,6 +1445,10 @@ void Application::setRenderVoxels(bool voxelRender) { · 41 unmodified lines | ||
| 1429 | 1445 | } |
| 1430 | 1446 | } |
| 1431 | 1447 | |
| 1448 | +void Application::setLowVelocityFilter(bool lowVelocityFilter) { | |
| 1449 | + getSixenseManager()->setLowVelocityFilter(lowVelocityFilter); | |
| 1450 | +} | |
| 1451 | + | |
| 1432 | 1452 | void Application::doKillLocalVoxels() { |
| 1433 | 1453 | _wantToKillLocalVoxels = true; |
| 1434 | 1454 | } |
| @@ -1734,6 +1754,8 @@ void Application::init() { · 299 unmodified lines | ||
| 1734 | 1754 | _faceplus.init(); |
| 1735 | 1755 | _visage.init(); |
| 1736 | 1756 | |
| 1757 | + Leapmotion::init(); | |
| 1758 | + | |
| 1737 | 1759 | // fire off an immediate domain-server check in now that settings are loaded |
| 1738 | 1760 | NodeList::getInstance()->sendDomainServerCheckIn(); |
| 1739 | 1761 | |
| @@ -1828,7 +1850,7 @@ bool Application::isLookingAtMyAvatar(Avatar* avatar) { · 88 unmodified lines | ||
| 1828 | 1850 | } |
| 1829 | 1851 | |
| 1830 | 1852 | void Application::updateLOD() { |
| 1831 | − PerformanceTimer perfTimer("idle/update/updateLOD"); | |
| 1853 | + PerformanceTimer perfTimer("LOD"); | |
| 1832 | 1854 | // adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode |
| 1833 | 1855 | if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD) && !isThrottleRendering()) { |
| 1834 | 1856 | Menu::getInstance()->autoAdjustLOD(_fps); |
| @@ -1838,7 +1860,7 @@ void Application::updateLOD() { · 3 unmodified lines | ||
| 1838 | 1860 | } |
| 1839 | 1861 | |
| 1840 | 1862 | void Application::updateMouseRay() { |
| 1841 | − PerformanceTimer perfTimer("idle/update/updateMouseRay"); | |
| 1863 | + PerformanceTimer perfTimer("mouseRay"); | |
| 1842 | 1864 | |
| 1843 | 1865 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1844 | 1866 | PerformanceWarning warn(showWarnings, "Application::updateMouseRay()"); |
| @@ -1871,8 +1893,6 @@ void Application::updateMouseRay() { · 26 unmodified lines | ||
| 1871 | 1893 | } |
| 1872 | 1894 | |
| 1873 | 1895 | void Application::updateFaceshift() { |
| 1874 | − PerformanceTimer perfTimer("idle/update/updateFaceshift"); | |
| 1875 | − | |
| 1876 | 1896 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1877 | 1897 | PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); |
| 1878 | 1898 | |
| @@ -1886,8 +1906,6 @@ void Application::updateFaceshift() { · 7 unmodified lines | ||
| 1886 | 1906 | } |
| 1887 | 1907 | |
| 1888 | 1908 | void Application::updateVisage() { |
| 1889 | − PerformanceTimer perfTimer("idle/update/updateVisage"); | |
| 1890 | − | |
| 1891 | 1909 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1892 | 1910 | PerformanceWarning warn(showWarnings, "Application::updateVisage()"); |
| 1893 | 1911 | |
| @@ -1896,11 +1914,11 @@ void Application::updateVisage() { · 2 unmodified lines | ||
| 1896 | 1914 | } |
| 1897 | 1915 | |
| 1898 | 1916 | void Application::updateMyAvatarLookAtPosition() { |
| 1899 | − PerformanceTimer perfTimer("idle/update/updateMyAvatarLookAtPosition"); | |
| 1900 | − | |
| 1917 | + PerformanceTimer perfTimer("lookAt"); | |
| 1901 | 1918 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1902 | 1919 | PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()"); |
| 1903 | 1920 | |
| 1921 | + _myAvatar->updateLookAtTargetAvatar(); | |
| 1904 | 1922 | FaceTracker* tracker = getActiveFaceTracker(); |
| 1905 | 1923 | |
| 1906 | 1924 | bool isLookingAtSomeone = false; |
| @@ -1928,17 +1946,9 @@ void Application::updateMyAvatarLookAtPosition() { · 21 unmodified lines | ||
| 1928 | 1946 | } |
| 1929 | 1947 | } else { |
| 1930 | 1948 | // I am not looking at anyone else, so just look forward |
| 1931 | − lookAtSpot = _myAvatar->getHead()->calculateAverageEyePosition() + | |
| 1949 | + lookAtSpot = _myAvatar->getHead()->getEyePosition() + | |
| 1932 | 1950 | (_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.f, 0.f, -TREE_SCALE)); |
| 1933 | 1951 | } |
| 1934 | − // TODO: Add saccade to mouse pointer when stable, IF not looking at someone (since we know we are looking at it) | |
| 1935 | − /* | |
| 1936 | − const float FIXED_MIN_EYE_DISTANCE = 0.3f; | |
| 1937 | − float minEyeDistance = FIXED_MIN_EYE_DISTANCE + (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON ? 0.0f : | |
| 1938 | − glm::distance(_mouseRayOrigin, _myAvatar->getHead()->calculateAverageEyePosition())); | |
| 1939 | − lookAtSpot = _mouseRayOrigin + _mouseRayDirection * qMax(minEyeDistance, distance); | |
| 1940 | − */ | |
| 1941 | − | |
| 1942 | 1952 | } |
| 1943 | 1953 | // |
| 1944 | 1954 | // Deflect the eyes a bit to match the detected Gaze from 3D camera if active |
| @@ -1948,7 +1958,7 @@ void Application::updateMyAvatarLookAtPosition() { · 3 unmodified lines | ||
| 1948 | 1958 | float eyeYaw = tracker->getEstimatedEyeYaw(); |
| 1949 | 1959 | const float GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT = 0.1f; |
| 1950 | 1960 | // deflect using Faceshift gaze data |
| 1951 | − glm::vec3 origin = _myAvatar->getHead()->calculateAverageEyePosition(); | |
| 1961 | + glm::vec3 origin = _myAvatar->getHead()->getEyePosition(); | |
| 1952 | 1962 | float pitchSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? -1.0f : 1.0f; |
| 1953 | 1963 | float deflection = Menu::getInstance()->getFaceshiftEyeDeflection(); |
| 1954 | 1964 | if (isLookingAtSomeone) { |
| @@ -1963,7 +1973,7 @@ void Application::updateMyAvatarLookAtPosition() { · 8 unmodified lines | ||
| 1963 | 1973 | } |
| 1964 | 1974 | |
| 1965 | 1975 | void Application::updateThreads(float deltaTime) { |
| 1966 | − PerformanceTimer perfTimer("idle/update/updateThreads"); | |
| 1976 | + PerformanceTimer perfTimer("updateThreads"); | |
| 1967 | 1977 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1968 | 1978 | PerformanceWarning warn(showWarnings, "Application::updateThreads()"); |
| 1969 | 1979 | |
| @@ -1978,7 +1988,7 @@ void Application::updateThreads(float deltaTime) { · 8 unmodified lines | ||
| 1978 | 1988 | } |
| 1979 | 1989 | |
| 1980 | 1990 | void Application::updateMetavoxels(float deltaTime) { |
| 1981 | − PerformanceTimer perfTimer("idle/update/updateMetavoxels"); | |
| 1991 | + PerformanceTimer perfTimer("updateMetavoxels"); | |
| 1982 | 1992 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1983 | 1993 | PerformanceWarning warn(showWarnings, "Application::updateMetavoxels()"); |
| 1984 | 1994 | |
| @@ -2008,7 +2018,7 @@ void Application::cameraMenuChanged() { · 23 unmodified lines | ||
| 2008 | 2018 | } |
| 2009 | 2019 | |
| 2010 | 2020 | void Application::updateCamera(float deltaTime) { |
| 2011 | − PerformanceTimer perfTimer("idle/update/updateCamera"); | |
| 2021 | + PerformanceTimer perfTimer("updateCamera"); | |
| 2012 | 2022 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2013 | 2023 | PerformanceWarning warn(showWarnings, "Application::updateCamera()"); |
| 2014 | 2024 | |
| @@ -2026,7 +2036,7 @@ void Application::updateCamera(float deltaTime) { · 11 unmodified lines | ||
| 2026 | 2036 | } |
| 2027 | 2037 | |
| 2028 | 2038 | void Application::updateDialogs(float deltaTime) { |
| 2029 | − PerformanceTimer perfTimer("idle/update/updateDialogs"); | |
| 2039 | + PerformanceTimer perfTimer("updateDialogs"); | |
| 2030 | 2040 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2031 | 2041 | PerformanceWarning warn(showWarnings, "Application::updateDialogs()"); |
| 2032 | 2042 | |
| @@ -2043,7 +2053,7 @@ void Application::updateDialogs(float deltaTime) { · 10 unmodified lines | ||
| 2043 | 2053 | } |
| 2044 | 2054 | |
| 2045 | 2055 | void Application::updateCursor(float deltaTime) { |
| 2046 | − PerformanceTimer perfTimer("idle/update/updateCursor"); | |
| 2056 | + PerformanceTimer perfTimer("updateCursor"); | |
| 2047 | 2057 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2048 | 2058 | PerformanceWarning warn(showWarnings, "Application::updateCursor()"); |
| 2049 | 2059 | |
| @@ -2068,84 +2078,76 @@ void Application::updateCursor(float deltaTime) { · 18 unmodified lines | ||
| 2068 | 2078 | } |
| 2069 | 2079 | |
| 2070 | 2080 | void Application::update(float deltaTime) { |
| 2071 | − //PerformanceTimer perfTimer("idle/update"); // NOTE: we track this above in Application::idle() | |
| 2072 | − | |
| 2073 | 2081 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2074 | 2082 | PerformanceWarning warn(showWarnings, "Application::update()"); |
| 2075 | 2083 | |
| 2076 | 2084 | updateLOD(); |
| 2077 | 2085 | updateMouseRay(); // check what's under the mouse and update the mouse voxel |
| 2078 | − updateFaceshift(); | |
| 2079 | − updateVisage(); | |
| 2080 | − | |
| 2081 | 2086 | { |
| 2082 | − PerformanceTimer perfTimer("idle/update/updateLookAtTargetAvatar"); | |
| 2083 | − _myAvatar->updateLookAtTargetAvatar(); | |
| 2084 | − } | |
| 2085 | − updateMyAvatarLookAtPosition(); | |
| 2086 | − { | |
| 2087 | − PerformanceTimer perfTimer("idle/update/sixense,joystick,prioVR"); | |
| 2087 | + PerformanceTimer perfTimer("devices"); | |
| 2088 | + DeviceTracker::updateAll(); | |
| 2089 | + updateFaceshift(); | |
| 2090 | + updateVisage(); | |
| 2088 | 2091 | _sixenseManager.update(deltaTime); |
| 2089 | 2092 | _joystickManager.update(); |
| 2090 | 2093 | _prioVR.update(deltaTime); |
| 2094 | + | |
| 2091 | 2095 | } |
| 2092 | − | |
| 2093 | 2096 | { |
| 2094 | − PerformanceTimer perfTimer("idle/update/updateMyAvatar"); | |
| 2097 | + PerformanceTimer perfTimer("myAvatar"); | |
| 2098 | + updateMyAvatarLookAtPosition(); | |
| 2095 | 2099 | updateMyAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes |
| 2096 | 2100 | } |
| 2097 | 2101 | |
| 2102 | + | |
| 2103 | + // Dispatch input events | |
| 2104 | + _controllerScriptingInterface.updateInputControllers(); | |
| 2105 | + | |
| 2098 | 2106 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... |
| 2099 | 2107 | |
| 2100 | − { | |
| 2101 | − PerformanceTimer perfTimer("idle/update/_avatarManager"); | |
| 2102 | − _avatarManager.updateOtherAvatars(deltaTime); //loop through all the other avatars and simulate them... | |
| 2103 | − } | |
| 2108 | + _avatarManager.updateOtherAvatars(deltaTime); //loop through all the other avatars and simulate them... | |
| 2109 | + | |
| 2104 | 2110 | updateMetavoxels(deltaTime); // update metavoxels |
| 2105 | 2111 | updateCamera(deltaTime); // handle various camera tweaks like off axis projection |
| 2106 | 2112 | updateDialogs(deltaTime); // update various stats dialogs if present |
| 2107 | 2113 | updateCursor(deltaTime); // Handle cursor updates |
| 2108 | 2114 | |
| 2109 | 2115 | { |
| 2110 | − PerformanceTimer perfTimer("idle/update/_particles"); | |
| 2116 | + PerformanceTimer perfTimer("particles"); | |
| 2111 | 2117 | _particles.update(); // update the particles... |
| 2112 | − } | |
| 2113 | − { | |
| 2114 | − PerformanceTimer perfTimer("idle/update/_particleCollisionSystem"); | |
| 2115 | − _particleCollisionSystem.update(); // collide the particles... | |
| 2118 | + { | |
| 2119 | + PerformanceTimer perfTimer("collisions"); | |
| 2120 | + _particleCollisionSystem.update(); // collide the particles... | |
| 2121 | + } | |
| 2116 | 2122 | } |
| 2117 | 2123 | |
| 2118 | 2124 | { |
| 2119 | − PerformanceTimer perfTimer("idle/update/_models"); | |
| 2125 | + PerformanceTimer perfTimer("models"); | |
| 2120 | 2126 | _models.update(); // update the models... |
| 2121 | 2127 | _modelClipboardRenderer.update(); |
| 2122 | 2128 | } |
| 2123 | 2129 | |
| 2124 | 2130 | { |
| 2125 | − PerformanceTimer perfTimer("idle/update/_overlays"); | |
| 2131 | + PerformanceTimer perfTimer("overlays"); | |
| 2126 | 2132 | _overlays.update(deltaTime); |
| 2127 | 2133 | } |
| 2128 | 2134 | |
| 2129 | 2135 | { |
| 2130 | − PerformanceTimer perfTimer("idle/update/emit simulating"); | |
| 2136 | + PerformanceTimer perfTimer("emitSimulating"); | |
| 2131 | 2137 | // let external parties know we're updating |
| 2132 | 2138 | emit simulating(deltaTime); |
| 2133 | 2139 | } |
| 2134 | 2140 | } |
| 2135 | 2141 | |
| 2136 | 2142 | void Application::updateMyAvatar(float deltaTime) { |
| 2137 | − PerformanceTimer perfTimer("updateMyAvatar"); | |
| 2138 | 2143 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2139 | 2144 | PerformanceWarning warn(showWarnings, "Application::updateMyAvatar()"); |
| 2140 | 2145 | |
| 2141 | − { | |
| 2142 | − PerformanceTimer perfTimer("updateMyAvatar/_myAvatar->update()"); | |
| 2143 | − _myAvatar->update(deltaTime); | |
| 2144 | − } | |
| 2146 | + _myAvatar->update(deltaTime); | |
| 2145 | 2147 | |
| 2146 | 2148 | { |
| 2147 | 2149 | // send head/hand data to the avatar mixer and voxel server |
| 2148 | − PerformanceTimer perfTimer("updateMyAvatar/sendToAvatarMixer"); | |
| 2150 | + PerformanceTimer perfTimer("send"); | |
| 2149 | 2151 | QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData); |
| 2150 | 2152 | packet.append(_myAvatar->toByteArray()); |
| 2151 | 2153 | controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer); |
| @@ -2158,14 +2160,15 @@ void Application::updateMyAvatar(float deltaTime) { · 6 unmodified lines | ||
| 2158 | 2160 | // actually need to calculate the view frustum planes to send these details |
| 2159 | 2161 | // to the server. |
| 2160 | 2162 | { |
| 2161 | − PerformanceTimer perfTimer("updateMyAvatar/loadViewFrustum"); | |
| 2163 | + PerformanceTimer perfTimer("loadViewFrustum"); | |
| 2162 | 2164 | loadViewFrustum(_myCamera, _viewFrustum); |
| 2163 | 2165 | } |
| 2164 | 2166 | |
| 2167 | + quint64 now = usecTimestampNow(); | |
| 2168 | + | |
| 2165 | 2169 | // Update my voxel servers with my current voxel query... |
| 2166 | 2170 | { |
| 2167 | − PerformanceTimer perfTimer("updateMyAvatar/queryOctree"); | |
| 2168 | − quint64 now = usecTimestampNow(); | |
| 2171 | + PerformanceTimer perfTimer("queryOctree"); | |
| 2169 | 2172 | quint64 sinceLastQuery = now - _lastQueriedTime; |
| 2170 | 2173 | const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND; |
| 2171 | 2174 | bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY; |
| @@ -2183,7 +2186,6 @@ void Application::updateMyAvatar(float deltaTime) { · 11 unmodified lines | ||
| 2183 | 2186 | |
| 2184 | 2187 | // sent nack packets containing missing sequence numbers of received packets from nodes |
| 2185 | 2188 | { |
| 2186 | − quint64 now = usecTimestampNow(); | |
| 2187 | 2189 | quint64 sinceLastNack = now - _lastNackTime; |
| 2188 | 2190 | const quint64 TOO_LONG_SINCE_LAST_NACK = 1 * USECS_PER_SECOND; |
| 2189 | 2191 | if (sinceLastNack > TOO_LONG_SINCE_LAST_NACK) { |
| @@ -2191,6 +2193,15 @@ void Application::updateMyAvatar(float deltaTime) { · 1 unmodified line | ||
| 2191 | 2193 | sendNackPackets(); |
| 2192 | 2194 | } |
| 2193 | 2195 | } |
| 2196 | + | |
| 2197 | + { | |
| 2198 | + quint64 sinceLastNack = now - _lastSendDownstreamAudioStats; | |
| 2199 | + if (sinceLastNack > TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS) { | |
| 2200 | + _lastSendDownstreamAudioStats = now; | |
| 2201 | + | |
| 2202 | + QMetaObject::invokeMethod(&_audio, "sendDownstreamAudioStatsPacket", Qt::QueuedConnection); | |
| 2203 | + } | |
| 2204 | + } | |
| 2194 | 2205 | } |
| 2195 | 2206 | |
| 2196 | 2207 | int Application::sendNackPackets() { |
| @@ -2497,7 +2508,7 @@ glm::vec3 Application::getSunDirection() { · 300 unmodified lines | ||
| 2497 | 2508 | } |
| 2498 | 2509 | |
| 2499 | 2510 | void Application::updateShadowMap() { |
| 2500 | − PerformanceTimer perfTimer("paintGL/updateShadowMap"); | |
| 2511 | + PerformanceTimer perfTimer("shadowMap"); | |
| 2501 | 2512 | QOpenGLFramebufferObject* fbo = _textureCache.getShadowFramebufferObject(); |
| 2502 | 2513 | fbo->bind(); |
| 2503 | 2514 | glEnable(GL_DEPTH_TEST); |
| @@ -2619,7 +2630,9 @@ void Application::updateShadowMap() { · 115 unmodified lines | ||
| 2619 | 2630 | glViewport(0, 0, _glWidget->width(), _glWidget->height()); |
| 2620 | 2631 | } |
| 2621 | 2632 | |
| 2622 | −const GLfloat WHITE_SPECULAR_COLOR[] = { 1.0f, 1.0f, 1.0f, 1.0f }; | |
| 2633 | +const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f }; | |
| 2634 | +const GLfloat WORLD_DIFFUSE_COLOR[] = { 0.6f, 0.525f, 0.525f }; | |
| 2635 | +const GLfloat WORLD_SPECULAR_COLOR[] = { 0.94f, 0.94f, 0.737f, 1.0f }; | |
| 2623 | 2636 | const GLfloat NO_SPECULAR_COLOR[] = { 0.0f, 0.0f, 0.0f, 1.0f }; |
| 2624 | 2637 | |
| 2625 | 2638 | void Application::setupWorldLight() { |
| @@ -2631,13 +2644,10 @@ void Application::setupWorldLight() { · 5 unmodified lines | ||
| 2631 | 2644 | glm::vec3 sunDirection = getSunDirection(); |
| 2632 | 2645 | GLfloat light_position0[] = { sunDirection.x, sunDirection.y, sunDirection.z, 0.0 }; |
| 2633 | 2646 | glLightfv(GL_LIGHT0, GL_POSITION, light_position0); |
| 2634 | − GLfloat ambient_color[] = { 0.7f, 0.7f, 0.8f }; | |
| 2635 | − glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color); | |
| 2636 | − GLfloat diffuse_color[] = { 0.8f, 0.7f, 0.7f }; | |
| 2637 | − glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color); | |
| 2638 | − | |
| 2639 | − glLightfv(GL_LIGHT0, GL_SPECULAR, WHITE_SPECULAR_COLOR); | |
| 2640 | − glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR); | |
| 2647 | + glLightfv(GL_LIGHT0, GL_AMBIENT, WORLD_AMBIENT_COLOR); | |
| 2648 | + glLightfv(GL_LIGHT0, GL_DIFFUSE, WORLD_DIFFUSE_COLOR); | |
| 2649 | + glLightfv(GL_LIGHT0, GL_SPECULAR, WORLD_SPECULAR_COLOR); | |
| 2650 | + glMaterialfv(GL_FRONT, GL_SPECULAR, WORLD_SPECULAR_COLOR); | |
| 2641 | 2651 | glMateriali(GL_FRONT, GL_SHININESS, 96); |
| 2642 | 2652 | } |
| 2643 | 2653 | |
| @@ -2660,7 +2670,7 @@ QImage Application::renderAvatarBillboard() { · 16 unmodified lines | ||
| 2660 | 2670 | } |
| 2661 | 2671 | |
| 2662 | 2672 | void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { |
| 2663 | − PerformanceTimer perfTimer("paintGL/displaySide"); | |
| 2673 | + PerformanceTimer perfTimer("display"); | |
| 2664 | 2674 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()"); |
| 2665 | 2675 | // transform by eye offset |
| 2666 | 2676 | |
| @@ -2694,7 +2704,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 27 unmodified lines | ||
| 2694 | 2704 | |
| 2695 | 2705 | // Setup 3D lights (after the camera transform, so that they are positioned in world space) |
| 2696 | 2706 | { |
| 2697 | − PerformanceTimer perfTimer("paintGL/displaySide/setupWorldLight"); | |
| 2707 | + PerformanceTimer perfTimer("lights"); | |
| 2698 | 2708 | setupWorldLight(); |
| 2699 | 2709 | } |
| 2700 | 2710 | |
| @@ -2713,7 +2723,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 12 unmodified lines | ||
| 2713 | 2723 | } |
| 2714 | 2724 | |
| 2715 | 2725 | if (!selfAvatarOnly && Menu::getInstance()->isOptionChecked(MenuOption::Stars)) { |
| 2716 | − PerformanceTimer perfTimer("paintGL/displaySide/stars"); | |
| 2726 | + PerformanceTimer perfTimer("stars"); | |
| 2717 | 2727 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2718 | 2728 | "Application::displaySide() ... stars..."); |
| 2719 | 2729 | if (!_stars.isStarsLoaded()) { |
| @@ -2742,7 +2752,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 22 unmodified lines | ||
| 2742 | 2752 | |
| 2743 | 2753 | // draw the sky dome |
| 2744 | 2754 | if (!selfAvatarOnly && Menu::getInstance()->isOptionChecked(MenuOption::Atmosphere)) { |
| 2745 | − PerformanceTimer perfTimer("paintGL/displaySide/atmosphere"); | |
| 2755 | + PerformanceTimer perfTimer("atmosphere"); | |
| 2746 | 2756 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2747 | 2757 | "Application::displaySide() ... atmosphere..."); |
| 2748 | 2758 | _environment.renderAtmospheres(whichCamera); |
| @@ -2763,13 +2773,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 14 unmodified lines | ||
| 2763 | 2773 | |
| 2764 | 2774 | // draw the audio reflector overlay |
| 2765 | 2775 | { |
| 2766 | − PerformanceTimer perfTimer("paintGL/displaySide/audioReflector"); | |
| 2776 | + PerformanceTimer perfTimer("audio"); | |
| 2767 | 2777 | _audioReflector.render(); |
| 2768 | 2778 | } |
| 2769 | 2779 | |
| 2770 | 2780 | // Draw voxels |
| 2771 | 2781 | if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { |
| 2772 | − PerformanceTimer perfTimer("paintGL/displaySide/voxels"); | |
| 2782 | + PerformanceTimer perfTimer("voxels"); | |
| 2773 | 2783 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2774 | 2784 | "Application::displaySide() ... voxels..."); |
| 2775 | 2785 | _voxels.render(); |
| @@ -2777,14 +2787,14 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | ||
| 2777 | 2787 | |
| 2778 | 2788 | // also, metavoxels |
| 2779 | 2789 | if (Menu::getInstance()->isOptionChecked(MenuOption::Metavoxels)) { |
| 2780 | − PerformanceTimer perfTimer("paintGL/displaySide/metavoxels"); | |
| 2790 | + PerformanceTimer perfTimer("metavoxels"); | |
| 2781 | 2791 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2782 | 2792 | "Application::displaySide() ... metavoxels..."); |
| 2783 | 2793 | _metavoxels.render(); |
| 2784 | 2794 | } |
| 2785 | 2795 | |
| 2786 | 2796 | if (Menu::getInstance()->isOptionChecked(MenuOption::BuckyBalls)) { |
| 2787 | − PerformanceTimer perfTimer("paintGL/displaySide/buckyBalls"); | |
| 2797 | + PerformanceTimer perfTimer("buckyBalls"); | |
| 2788 | 2798 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2789 | 2799 | "Application::displaySide() ... bucky balls..."); |
| 2790 | 2800 | _buckyBalls.render(); |
| @@ -2792,7 +2802,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | ||
| 2792 | 2802 | |
| 2793 | 2803 | // render particles... |
| 2794 | 2804 | if (Menu::getInstance()->isOptionChecked(MenuOption::Particles)) { |
| 2795 | − PerformanceTimer perfTimer("paintGL/displaySide/particles"); | |
| 2805 | + PerformanceTimer perfTimer("particles"); | |
| 2796 | 2806 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2797 | 2807 | "Application::displaySide() ... particles..."); |
| 2798 | 2808 | _particles.render(); |
| @@ -2800,7 +2810,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | ||
| 2800 | 2810 | |
| 2801 | 2811 | // render models... |
| 2802 | 2812 | if (Menu::getInstance()->isOptionChecked(MenuOption::Models)) { |
| 2803 | − PerformanceTimer perfTimer("paintGL/displaySide/models"); | |
| 2813 | + PerformanceTimer perfTimer("models"); | |
| 2804 | 2814 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2805 | 2815 | "Application::displaySide() ... models..."); |
| 2806 | 2816 | _models.render(); |
| @@ -2809,14 +2819,14 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 2 unmodified lines | ||
| 2809 | 2819 | |
| 2810 | 2820 | // render the ambient occlusion effect if enabled |
| 2811 | 2821 | if (Menu::getInstance()->isOptionChecked(MenuOption::AmbientOcclusion)) { |
| 2812 | − PerformanceTimer perfTimer("paintGL/displaySide/AmbientOcclusion"); | |
| 2822 | + PerformanceTimer perfTimer("ambientOcclusion"); | |
| 2813 | 2823 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2814 | 2824 | "Application::displaySide() ... AmbientOcclusion..."); |
| 2815 | 2825 | _ambientOcclusionEffect.render(); |
| 2816 | 2826 | } |
| 2817 | 2827 | |
| 2818 | 2828 | // restore default, white specular |
| 2819 | − glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR); | |
| 2829 | + glMaterialfv(GL_FRONT, GL_SPECULAR, WORLD_SPECULAR_COLOR); | |
| 2820 | 2830 | |
| 2821 | 2831 | _nodeBoundsDisplay.draw(); |
| 2822 | 2832 | |
| @@ -2824,20 +2834,27 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | ||
| 2824 | 2834 | |
| 2825 | 2835 | bool mirrorMode = (whichCamera.getInterpolatedMode() == CAMERA_MODE_MIRROR); |
| 2826 | 2836 | { |
| 2827 | − PerformanceTimer perfTimer("paintGL/displaySide/renderAvatars"); | |
| 2837 | + PerformanceTimer perfTimer("avatars"); | |
| 2838 | + | |
| 2828 | 2839 | _avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, selfAvatarOnly); |
| 2840 | + | |
| 2841 | + //Render the sixense lasers | |
| 2842 | + if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) { | |
| 2843 | + _myAvatar->renderLaserPointers(); | |
| 2844 | + } | |
| 2829 | 2845 | } |
| 2830 | 2846 | |
| 2831 | 2847 | if (!selfAvatarOnly) { |
| 2832 | 2848 | // Render the world box |
| 2833 | − if (whichCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats) && Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { | |
| 2834 | − PerformanceTimer perfTimer("paintGL/displaySide/renderWorldBox"); | |
| 2849 | + if (whichCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats) && | |
| 2850 | + Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { | |
| 2851 | + PerformanceTimer perfTimer("worldBox"); | |
| 2835 | 2852 | renderWorldBox(); |
| 2836 | 2853 | } |
| 2837 | 2854 | |
| 2838 | 2855 | // view frustum for debugging |
| 2839 | 2856 | if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayFrustum) && whichCamera.getMode() != CAMERA_MODE_MIRROR) { |
| 2840 | − PerformanceTimer perfTimer("paintGL/displaySide/ViewFrustum"); | |
| 2857 | + PerformanceTimer perfTimer("viewFrustum"); | |
| 2841 | 2858 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2842 | 2859 | "Application::displaySide() ... renderViewFrustum..."); |
| 2843 | 2860 | renderViewFrustum(_viewFrustum); |
| @@ -2845,7 +2862,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 1 unmodified line | ||
| 2845 | 2862 | |
| 2846 | 2863 | // render voxel fades if they exist |
| 2847 | 2864 | if (_voxelFades.size() > 0) { |
| 2848 | − PerformanceTimer perfTimer("paintGL/displaySide/voxel fades"); | |
| 2865 | + PerformanceTimer perfTimer("voxelFades"); | |
| 2849 | 2866 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2850 | 2867 | "Application::displaySide() ... voxel fades..."); |
| 2851 | 2868 | _voxelFadesLock.lockForWrite(); |
| @@ -2862,13 +2879,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 10 unmodified lines | ||
| 2862 | 2879 | |
| 2863 | 2880 | // give external parties a change to hook in |
| 2864 | 2881 | { |
| 2865 | − PerformanceTimer perfTimer("paintGL/displaySide/inWorldInterface"); | |
| 2882 | + PerformanceTimer perfTimer("inWorldInterface"); | |
| 2866 | 2883 | emit renderingInWorldInterface(); |
| 2867 | 2884 | } |
| 2868 | 2885 | |
| 2869 | 2886 | // render JS/scriptable overlays |
| 2870 | 2887 | { |
| 2871 | − PerformanceTimer perfTimer("paintGL/displaySide/3dOverlays"); | |
| 2888 | + PerformanceTimer perfTimer("3dOverlays"); | |
| 2872 | 2889 | _overlays.render3D(); |
| 2873 | 2890 | } |
| 2874 | 2891 | } |
| @@ -2948,7 +2965,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 73 unmodified lines | ||
| 2948 | 2965 | _mirrorCamera.setTargetPosition(glm::vec3()); |
| 2949 | 2966 | |
| 2950 | 2967 | } else { |
| 2951 | − _mirrorCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition()); | |
| 2968 | + _mirrorCamera.setTargetPosition(_myAvatar->getHead()->getEyePosition()); | |
| 2952 | 2969 | } |
| 2953 | 2970 | } |
| 2954 | 2971 | _mirrorCamera.setAspectRatio((float)region.width() / region.height()); |
| @@ -2977,7 +2994,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 22 unmodified lines | ||
| 2977 | 2994 | _myAvatar->getSkeletonModel().getNeckPosition(neckPosition); |
| 2978 | 2995 | |
| 2979 | 2996 | // get the eye position relative to the body |
| 2980 | − glm::vec3 eyePosition = _myAvatar->getHead()->calculateAverageEyePosition(); | |
| 2997 | + glm::vec3 eyePosition = _myAvatar->getHead()->getEyePosition(); | |
| 2981 | 2998 | float eyeHeight = eyePosition.y - _myAvatar->getPosition().y; |
| 2982 | 2999 | |
| 2983 | 3000 | // set the translation of the face relative to the neck position |
| @@ -2995,6 +3012,13 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 11 unmodified lines | ||
| 2995 | 3012 | attachment->setTranslation(attachment->getTranslation() + delta); |
| 2996 | 3013 | } |
| 2997 | 3014 | |
| 3015 | + // and lo, even the shadow matrices | |
| 3016 | + glm::mat4 savedShadowMatrices[CASCADED_SHADOW_MATRIX_COUNT]; | |
| 3017 | + for (int i = 0; i < CASCADED_SHADOW_MATRIX_COUNT; i++) { | |
| 3018 | + savedShadowMatrices[i] = _shadowMatrices[i]; | |
| 3019 | + _shadowMatrices[i] = glm::transpose(glm::transpose(_shadowMatrices[i]) * glm::translate(-delta)); | |
| 3020 | + } | |
| 3021 | + | |
| 2998 | 3022 | displaySide(_mirrorCamera, true); |
| 2999 | 3023 | |
| 3000 | 3024 | // restore absolute translations |
| @@ -3003,6 +3027,11 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 2 unmodified lines | ||
| 3003 | 3027 | for (int i = 0; i < absoluteAttachmentTranslations.size(); i++) { |
| 3004 | 3028 | _myAvatar->getAttachmentModels().at(i)->setTranslation(absoluteAttachmentTranslations.at(i)); |
| 3005 | 3029 | } |
| 3030 | + | |
| 3031 | + // restore the shadow matrices | |
| 3032 | + for (int i = 0; i < CASCADED_SHADOW_MATRIX_COUNT; i++) { | |
| 3033 | + _shadowMatrices[i] = savedShadowMatrices[i]; | |
| 3034 | + } | |
| 3006 | 3035 | } else { |
| 3007 | 3036 | displaySide(_mirrorCamera, true); |
| 3008 | 3037 | } |
| @@ -3205,6 +3234,7 @@ void Application::resetSensors() { · 196 unmodified lines | ||
| 3205 | 3234 | OculusManager::reset(); |
| 3206 | 3235 | |
| 3207 | 3236 | _prioVR.reset(); |
| 3237 | + //_leapmotion.reset(); | |
| 3208 | 3238 | |
| 3209 | 3239 | QCursor::setPos(_mouseX, _mouseY); |
| 3210 | 3240 | _myAvatar->reset(); |
| @@ -3355,7 +3385,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 144 unmodified lines | ||
| 3355 | 3385 | _modelEditSender.nodeKilled(node); |
| 3356 | 3386 | |
| 3357 | 3387 | if (node->getType() == NodeType::AudioMixer) { |
| 3358 | − QMetaObject::invokeMethod(&_audio, "resetIncomingMixedAudioSequenceNumberStats"); | |
| 3388 | + QMetaObject::invokeMethod(&_audio, "audioMixerKilled"); | |
| 3359 | 3389 | } |
| 3360 | 3390 | |
| 3361 | 3391 | if (node->getType() == NodeType::VoxelServer) { |
| @@ -3640,6 +3670,9 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 278 unmodified lines | ||
| 3640 | 3670 | scriptEngine->getModelsScriptingInterface()->setPacketSender(&_modelEditSender); |
| 3641 | 3671 | scriptEngine->getModelsScriptingInterface()->setModelTree(_models.getTree()); |
| 3642 | 3672 | |
| 3673 | + // model has some custom types | |
| 3674 | + Model::registerMetaTypes(scriptEngine); | |
| 3675 | + | |
| 3643 | 3676 | // hook our avatar object into this script engine |
| 3644 | 3677 | scriptEngine->setAvatarData(_myAvatar, "MyAvatar"); // leave it as a MyAvatar class to expose thrust features |
| 3645 | 3678 | |
| @@ -3669,6 +3702,9 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 23 unmodified lines | ||
| 3669 | 3702 | scriptEngine->registerGlobalObject("AnimationCache", &_animationCache); |
| 3670 | 3703 | scriptEngine->registerGlobalObject("AudioReflector", &_audioReflector); |
| 3671 | 3704 | scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance()); |
| 3705 | + scriptEngine->registerGlobalObject("Metavoxels", &_metavoxels); | |
| 3706 | + | |
| 3707 | + scriptEngine->registerGlobalObject("AvatarManager", &_avatarManager); | |
| 3672 | 3708 | |
| 3673 | 3709 | #ifdef HAVE_RTMIDI |
| 3674 | 3710 | scriptEngine->registerGlobalObject("MIDI", &MIDIManager::getInstance()); |