Showing the changes to interface/src/Application.cpp (1 of 5 files). Show all
Unified · Split
| @@ -144,6 +144,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 143 unmodified lines | ||
| 144 | 144 | _packetsPerSecond(0), |
| 145 | 145 | _bytesPerSecond(0), |
| 146 | 146 | _bytesCount(0), |
| 147 | + _recentMaxPackets(0), | |
| 148 | + _resetRecentMaxPacketsSoon(true), | |
| 147 | 149 | _swatch(NULL), |
| 148 | 150 | _pasteMode(false) |
| 149 | 151 | { |
| @@ -1314,22 +1316,30 @@ void Application::idle() { · 1164 unmodified lines | ||
| 1314 | 1316 | |
| 1315 | 1317 | double timeSinceLastUpdate = diffclock(&_lastTimeUpdated, &check); |
| 1316 | 1318 | if (timeSinceLastUpdate > IDLE_SIMULATE_MSECS) { |
| 1317 | − | |
| 1318 | − const float BIGGEST_DELTA_TIME_SECS = 0.25f; | |
| 1319 | − update(glm::clamp((float)timeSinceLastUpdate / 1000.f, 0.f, BIGGEST_DELTA_TIME_SECS)); | |
| 1320 | − _glWidget->updateGL(); | |
| 1321 | − _lastTimeUpdated = check; | |
| 1322 | − _idleLoopStdev.addValue(timeSinceLastUpdate); | |
| 1323 | − | |
| 1324 | − // Record standard deviation and reset counter if needed | |
| 1325 | − const int STDEV_SAMPLES = 500; | |
| 1326 | − if (_idleLoopStdev.getSamples() > STDEV_SAMPLES) { | |
| 1327 | − _idleLoopMeasuredJitter = _idleLoopStdev.getStDev(); | |
| 1328 | − _idleLoopStdev.reset(); | |
| 1319 | + { | |
| 1320 | + PerformanceWarning warn(showWarnings, "Application::idle()... update()"); | |
| 1321 | + const float BIGGEST_DELTA_TIME_SECS = 0.25f; | |
| 1322 | + update(glm::clamp((float)timeSinceLastUpdate / 1000.f, 0.f, BIGGEST_DELTA_TIME_SECS)); | |
| 1323 | + } | |
| 1324 | + { | |
| 1325 | + PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()"); | |
| 1326 | + _glWidget->updateGL(); | |
| 1329 | 1327 | } |
| 1328 | + { | |
| 1329 | + PerformanceWarning warn(showWarnings, "Application::idle()... rest of it"); | |
| 1330 | + _lastTimeUpdated = check; | |
| 1331 | + _idleLoopStdev.addValue(timeSinceLastUpdate); | |
| 1332 | + | |
| 1333 | + // Record standard deviation and reset counter if needed | |
| 1334 | + const int STDEV_SAMPLES = 500; | |
| 1335 | + if (_idleLoopStdev.getSamples() > STDEV_SAMPLES) { | |
| 1336 | + _idleLoopMeasuredJitter = _idleLoopStdev.getStDev(); | |
| 1337 | + _idleLoopStdev.reset(); | |
| 1338 | + } | |
| 1330 | 1339 | |
| 1331 | − // After finishing all of the above work, restart the idle timer, allowing 2ms to process events. | |
| 1332 | − idleTimer->start(2); | |
| 1340 | + // After finishing all of the above work, restart the idle timer, allowing 2ms to process events. | |
| 1341 | + idleTimer->start(2); | |
| 1342 | + } | |
| 1333 | 1343 | } |
| 1334 | 1344 | } |
| 1335 | 1345 | void Application::terminate() { |
| @@ -1776,6 +1786,8 @@ static QUuid DEFAULT_NODE_ID_REF; · 440 unmodified lines | ||
| 1776 | 1786 | |
| 1777 | 1787 | void Application::updateLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection, |
| 1778 | 1788 | glm::vec3& eyePosition) { |
| 1789 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1790 | + PerformanceWarning warn(showWarnings, "Application::updateLookatTargetAvatar()"); | |
| 1779 | 1791 | |
| 1780 | 1792 | _lookatTargetAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, DEFAULT_NODE_ID_REF); |
| 1781 | 1793 | } |
| @@ -1907,17 +1919,13 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 125 unmodified lines | ||
| 1907 | 1919 | } |
| 1908 | 1920 | } |
| 1909 | 1921 | |
| 1910 | −void Application::update(float deltaTime) { | |
| 1922 | +void Application::updateMouseRay(float deltaTime, glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection) { | |
| 1923 | + | |
| 1911 | 1924 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1912 | − PerformanceWarning warn(showWarnings, "Application::update()"); | |
| 1913 | − | |
| 1914 | − // tell my avatar if the mouse is being pressed... | |
| 1915 | − _myAvatar.setMousePressed(_mousePressed); | |
| 1916 | − | |
| 1917 | − // check what's under the mouse and update the mouse voxel | |
| 1918 | − glm::vec3 mouseRayOrigin, mouseRayDirection; | |
| 1919 | − _viewFrustum.computePickRay(_mouseX / (float)_glWidget->width(), | |
| 1920 | − _mouseY / (float)_glWidget->height(), mouseRayOrigin, mouseRayDirection); | |
| 1925 | + PerformanceWarning warn(showWarnings, "Application::updateMouseRay()"); | |
| 1926 | + | |
| 1927 | + _viewFrustum.computePickRay(_mouseX / (float)_glWidget->width(), _mouseY / (float)_glWidget->height(), | |
| 1928 | + mouseRayOrigin, mouseRayDirection); | |
| 1921 | 1929 | |
| 1922 | 1930 | // adjust for mirroring |
| 1923 | 1931 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| @@ -1928,12 +1936,19 @@ void Application::update(float deltaTime) { · 4 unmodified lines | ||
| 1928 | 1936 | _viewFrustum.getRight() * glm::dot(_viewFrustum.getRight(), mouseRayDirection)); |
| 1929 | 1937 | } |
| 1930 | 1938 | |
| 1939 | + // tell my avatar if the mouse is being pressed... | |
| 1940 | + _myAvatar.setMousePressed(_mousePressed); | |
| 1941 | + | |
| 1931 | 1942 | // tell my avatar the posiion and direction of the ray projected ino the world based on the mouse position |
| 1932 | 1943 | _myAvatar.setMouseRay(mouseRayOrigin, mouseRayDirection); |
| 1933 | − | |
| 1934 | − // Set where I am looking based on my mouse ray (so that other people can see) | |
| 1935 | − glm::vec3 lookAtSpot; | |
| 1944 | +} | |
| 1945 | + | |
| 1946 | +void Application::updateFaceshift(float deltaTime, glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, | |
| 1947 | + glm::vec3& lookAtRayOrigin, glm::vec3& lookAtRayDirection) { | |
| 1936 | 1948 | |
| 1949 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1950 | + PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); | |
| 1951 | + | |
| 1937 | 1952 | // Update faceshift |
| 1938 | 1953 | _faceshift.update(); |
| 1939 | 1954 | |
| @@ -1943,14 +1958,19 @@ void Application::update(float deltaTime) { · 3 unmodified lines | ||
| 1943 | 1958 | } |
| 1944 | 1959 | |
| 1945 | 1960 | // if we have faceshift, use that to compute the lookat direction |
| 1946 | − glm::vec3 lookAtRayOrigin = mouseRayOrigin, lookAtRayDirection = mouseRayDirection; | |
| 1947 | 1961 | if (_faceshift.isActive()) { |
| 1948 | 1962 | lookAtRayOrigin = _myAvatar.getHead().calculateAverageEyePosition(); |
| 1949 | 1963 | lookAtRayDirection = _myAvatar.getHead().getOrientation() * glm::quat(glm::radians(glm::vec3( |
| 1950 | 1964 | _faceshift.getEstimatedEyePitch(), _faceshift.getEstimatedEyeYaw(), 0.0f))) * glm::vec3(0.0f, 0.0f, -1.0f); |
| 1951 | 1965 | } |
| 1966 | +} | |
| 1952 | 1967 | |
| 1953 | − updateLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, lookAtSpot); | |
| 1968 | +void Application::updateMyAvatarLookAtPosition(glm::vec3& lookAtSpot, glm::vec3& lookAtRayOrigin, | |
| 1969 | + glm::vec3& lookAtRayDirection) { | |
| 1970 | + | |
| 1971 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1972 | + PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()"); | |
| 1973 | + | |
| 1954 | 1974 | if (_lookatTargetAvatar && !_faceshift.isActive()) { |
| 1955 | 1975 | // If the mouse is over another avatar's head... |
| 1956 | 1976 | _myAvatar.getHead().setLookAtPosition(lookAtSpot); |
| @@ -1969,11 +1989,14 @@ void Application::update(float deltaTime) { · 12 unmodified lines | ||
| 1969 | 1989 | lookAtSpot = lookAtRayOrigin + lookAtRayDirection * FAR_AWAY_STARE; |
| 1970 | 1990 | _myAvatar.getHead().setLookAtPosition(lookAtSpot); |
| 1971 | 1991 | } |
| 1992 | +} | |
| 1972 | 1993 | |
| 1973 | − // Find the voxel we are hovering over, and respond if clicked | |
| 1974 | − float distance; | |
| 1975 | − BoxFace face; | |
| 1976 | − | |
| 1994 | +void Application::updateHoverVoxels(float deltaTime, glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, | |
| 1995 | + float& distance, BoxFace& face) { | |
| 1996 | + | |
| 1997 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 1998 | + PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels()"); | |
| 1999 | + | |
| 1977 | 2000 | // If we have clicked on a voxel, update it's color |
| 1978 | 2001 | if (_isHoverVoxelSounding) { |
| 1979 | 2002 | VoxelNode* hoveredNode = _voxels.getVoxelAt(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s); |
| @@ -2005,13 +2028,19 @@ void Application::update(float deltaTime) { · 25 unmodified lines | ||
| 2005 | 2028 | _isHoverVoxelSounding = true; |
| 2006 | 2029 | } |
| 2007 | 2030 | } |
| 2008 | − | |
| 2031 | +} | |
| 2032 | + | |
| 2033 | +void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, | |
| 2034 | + float& distance, BoxFace& face) { | |
| 2035 | + | |
| 2036 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2037 | + PerformanceWarning warn(showWarnings, "Application::updateMouseVoxels()"); | |
| 2038 | + | |
| 2009 | 2039 | _mouseVoxel.s = 0.0f; |
| 2010 | 2040 | if (Menu::getInstance()->isVoxelModeActionChecked() && |
| 2011 | 2041 | (fabs(_myAvatar.getVelocity().x) + |
| 2012 | 2042 | fabs(_myAvatar.getVelocity().y) + |
| 2013 | 2043 | fabs(_myAvatar.getVelocity().z)) / 3 < MAX_AVATAR_EDIT_VELOCITY) { |
| 2014 | − PerformanceWarning warn(showWarnings, "Application::update()... findRayIntersection()"); | |
| 2015 | 2044 | |
| 2016 | 2045 | if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) { |
| 2017 | 2046 | if (distance < MAX_VOXEL_EDIT_DISTANCE) { |
| @@ -2080,12 +2109,17 @@ void Application::update(float deltaTime) { · 62 unmodified lines | ||
| 2080 | 2109 | _justEditedVoxel = false; |
| 2081 | 2110 | } |
| 2082 | 2111 | } |
| 2083 | − | |
| 2112 | +} | |
| 2113 | + | |
| 2114 | +void Application::updateHandAndTouch(float deltaTime) { | |
| 2115 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2116 | + PerformanceWarning warn(showWarnings, "Application::updateHandAndTouch()"); | |
| 2117 | + | |
| 2084 | 2118 | // walking triggers the handControl to stop |
| 2085 | 2119 | if (_myAvatar.getMode() == AVATAR_MODE_WALKING) { |
| 2086 | 2120 | _handControl.stop(); |
| 2087 | 2121 | } |
| 2088 | − | |
| 2122 | + | |
| 2089 | 2123 | // Update from Touch |
| 2090 | 2124 | if (_isTouchPressed) { |
| 2091 | 2125 | float TOUCH_YAW_SCALE = -0.25f; |
| @@ -2096,19 +2130,29 @@ void Application::update(float deltaTime) { · 4 unmodified lines | ||
| 2096 | 2130 | _lastTouchAvgX = _touchAvgX; |
| 2097 | 2131 | _lastTouchAvgY = _touchAvgY; |
| 2098 | 2132 | } |
| 2099 | − | |
| 2100 | − // Leap finger-sensing device | |
| 2133 | +} | |
| 2134 | + | |
| 2135 | +void Application::updateLeap(float deltaTime) { | |
| 2136 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2137 | + PerformanceWarning warn(showWarnings, "Application::updateLeap()"); | |
| 2138 | + | |
| 2101 | 2139 | LeapManager::enableFakeFingers(Menu::getInstance()->isOptionChecked(MenuOption::SimulateLeapHand)); |
| 2102 | 2140 | _myAvatar.getHand().setRaveGloveActive(Menu::getInstance()->isOptionChecked(MenuOption::TestRaveGlove)); |
| 2103 | 2141 | LeapManager::nextFrame(_myAvatar); |
| 2104 | − | |
| 2105 | − // Read serial port interface devices | |
| 2142 | +} | |
| 2143 | + | |
| 2144 | +void Application::updateSerialDevices(float deltaTime) { | |
| 2145 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2146 | + PerformanceWarning warn(showWarnings, "Application::updateSerialDevices()"); | |
| 2147 | + | |
| 2106 | 2148 | if (_serialHeadSensor.isActive()) { |
| 2107 | 2149 | _serialHeadSensor.readData(deltaTime); |
| 2108 | 2150 | } |
| 2109 | − | |
| 2110 | − // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes | |
| 2111 | − updateAvatar(deltaTime); | |
| 2151 | +} | |
| 2152 | + | |
| 2153 | +void Application::updateThreads(float deltaTime) { | |
| 2154 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2155 | + PerformanceWarning warn(showWarnings, "Application::updateThreads()"); | |
| 2112 | 2156 | |
| 2113 | 2157 | // read incoming packets from network |
| 2114 | 2158 | if (!_enableNetworkThread) { |
| @@ -2120,12 +2164,12 @@ void Application::update(float deltaTime) { · 5 unmodified lines | ||
| 2120 | 2164 | _voxelProcessor.threadRoutine(); |
| 2121 | 2165 | _voxelEditSender.threadRoutine(); |
| 2122 | 2166 | } |
| 2167 | +} | |
| 2168 | + | |
| 2169 | +void Application::updateMyAvatarSimulation(float deltaTime) { | |
| 2170 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2171 | + PerformanceWarning warn(showWarnings, "Application::updateMyAvatarSimulation()"); | |
| 2123 | 2172 | |
| 2124 | − | |
| 2125 | − //loop through all the other avatars and simulate them... | |
| 2126 | − updateAvatars(deltaTime, mouseRayOrigin, mouseRayDirection); | |
| 2127 | − | |
| 2128 | − // Simulate myself | |
| 2129 | 2173 | if (Menu::getInstance()->isOptionChecked(MenuOption::Gravity)) { |
| 2130 | 2174 | _myAvatar.setGravity(_environment.getGravity(_myAvatar.getPosition())); |
| 2131 | 2175 | } |
| @@ -2138,12 +2182,21 @@ void Application::update(float deltaTime) { · 6 unmodified lines | ||
| 2138 | 2182 | } else { |
| 2139 | 2183 | _myAvatar.simulate(deltaTime, NULL); |
| 2140 | 2184 | } |
| 2141 | − | |
| 2142 | − // Simulate particle cloud movements | |
| 2185 | +} | |
| 2186 | + | |
| 2187 | +void Application::updateParticles(float deltaTime) { | |
| 2188 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2189 | + PerformanceWarning warn(showWarnings, "Application::updateParticles()"); | |
| 2190 | + | |
| 2143 | 2191 | if (Menu::getInstance()->isOptionChecked(MenuOption::ParticleCloud)) { |
| 2144 | 2192 | _cloud.simulate(deltaTime); |
| 2145 | 2193 | } |
| 2146 | − | |
| 2194 | +} | |
| 2195 | + | |
| 2196 | +void Application::updateTransmitter(float deltaTime) { | |
| 2197 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2198 | + PerformanceWarning warn(showWarnings, "Application::updateTransmitter()"); | |
| 2199 | + | |
| 2147 | 2200 | // no transmitter drive implies transmitter pick |
| 2148 | 2201 | if (!Menu::getInstance()->isOptionChecked(MenuOption::TransmitterDrive) && _myTransmitter.isConnected()) { |
| 2149 | 2202 | _transmitterPickStart = _myAvatar.getSkeleton().joint[AVATAR_JOINT_CHEST].position; |
| @@ -2178,7 +2231,12 @@ void Application::update(float deltaTime) { · 28 unmodified lines | ||
| 2178 | 2231 | } else { |
| 2179 | 2232 | _transmitterPickStart = _transmitterPickEnd = glm::vec3(); |
| 2180 | 2233 | } |
| 2181 | − | |
| 2234 | +} | |
| 2235 | + | |
| 2236 | +void Application::updateCamera(float deltaTime) { | |
| 2237 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2238 | + PerformanceWarning warn(showWarnings, "Application::updateCamera()"); | |
| 2239 | + | |
| 2182 | 2240 | if (!OculusManager::isConnected()) { |
| 2183 | 2241 | if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) { |
| 2184 | 2242 | if (_myCamera.getMode() != CAMERA_MODE_MIRROR) { |
| @@ -2213,7 +2271,12 @@ void Application::update(float deltaTime) { · 28 unmodified lines | ||
| 2213 | 2271 | } |
| 2214 | 2272 | } |
| 2215 | 2273 | } |
| 2216 | − | |
| 2274 | +} | |
| 2275 | + | |
| 2276 | +void Application::updateDialogs(float deltaTime) { | |
| 2277 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2278 | + PerformanceWarning warn(showWarnings, "Application::updateDialogs()"); | |
| 2279 | + | |
| 2217 | 2280 | // Update bandwidth dialog, if any |
| 2218 | 2281 | BandwidthDialog* bandwidthDialog = Menu::getInstance()->getBandwidthDialog(); |
| 2219 | 2282 | if (bandwidthDialog) { |
| @@ -2224,6 +2287,11 @@ void Application::update(float deltaTime) { · 4 unmodified lines | ||
| 2224 | 2287 | if (voxelStatsDialog) { |
| 2225 | 2288 | voxelStatsDialog->update(); |
| 2226 | 2289 | } |
| 2290 | +} | |
| 2291 | + | |
| 2292 | +void Application::updateAudio(float deltaTime) { | |
| 2293 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2294 | + PerformanceWarning warn(showWarnings, "Application::updateAudio()"); | |
| 2227 | 2295 | |
| 2228 | 2296 | // Update audio stats for procedural sounds |
| 2229 | 2297 | #ifndef _WIN32 |
| @@ -2231,7 +2299,12 @@ void Application::update(float deltaTime) { · 1 unmodified line | ||
| 2231 | 2299 | _audio.setLastVelocity(_myAvatar.getVelocity()); |
| 2232 | 2300 | _audio.eventuallyAnalyzePing(); |
| 2233 | 2301 | #endif |
| 2234 | − | |
| 2302 | +} | |
| 2303 | + | |
| 2304 | +void Application::updateCursor(float deltaTime) { | |
| 2305 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2306 | + PerformanceWarning warn(showWarnings, "Application::updateCursor()"); | |
| 2307 | + | |
| 2235 | 2308 | // watch mouse position, if it hasn't moved, hide the cursor |
| 2236 | 2309 | bool underMouse = _glWidget->underMouse(); |
| 2237 | 2310 | if (!_mouseHidden) { |
| @@ -2252,6 +2325,43 @@ void Application::update(float deltaTime) { · 14 unmodified lines | ||
| 2252 | 2325 | } |
| 2253 | 2326 | } |
| 2254 | 2327 | |
| 2328 | +void Application::update(float deltaTime) { | |
| 2329 | + bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | |
| 2330 | + PerformanceWarning warn(showWarnings, "Application::update()"); | |
| 2331 | + | |
| 2332 | + // check what's under the mouse and update the mouse voxel | |
| 2333 | + glm::vec3 mouseRayOrigin, mouseRayDirection; | |
| 2334 | + updateMouseRay(deltaTime, mouseRayOrigin, mouseRayDirection); | |
| 2335 | + | |
| 2336 | + // Set where I am looking based on my mouse ray (so that other people can see) | |
| 2337 | + glm::vec3 lookAtSpot; | |
| 2338 | + glm::vec3 lookAtRayOrigin = mouseRayOrigin, lookAtRayDirection = mouseRayDirection; | |
| 2339 | + | |
| 2340 | + updateFaceshift(deltaTime, mouseRayOrigin, mouseRayDirection, lookAtRayOrigin, lookAtRayDirection); | |
| 2341 | + updateLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, lookAtSpot); | |
| 2342 | + updateMyAvatarLookAtPosition(lookAtSpot, lookAtRayOrigin, lookAtRayDirection); | |
| 2343 | + | |
| 2344 | + // Find the voxel we are hovering over, and respond if clicked | |
| 2345 | + float distance; | |
| 2346 | + BoxFace face; | |
| 2347 | + | |
| 2348 | + updateHoverVoxels(deltaTime, mouseRayOrigin, mouseRayDirection, distance, face); // clicking on voxels and making sounds | |
| 2349 | + updateMouseVoxels(deltaTime, mouseRayOrigin, mouseRayDirection, distance, face); // UI/UX related to voxels | |
| 2350 | + updateHandAndTouch(deltaTime); // Update state for touch sensors | |
| 2351 | + updateLeap(deltaTime); // Leap finger-sensing device | |
| 2352 | + updateSerialDevices(deltaTime); // Read serial port interface devices | |
| 2353 | + updateAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes | |
| 2354 | + updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... | |
| 2355 | + updateAvatars(deltaTime, mouseRayOrigin, mouseRayDirection); //loop through all the other avatars and simulate them... | |
| 2356 | + updateMyAvatarSimulation(deltaTime); // Simulate myself | |
| 2357 | + updateParticles(deltaTime); // Simulate particle cloud movements | |
| 2358 | + updateTransmitter(deltaTime); // transmitter drive or pick | |
| 2359 | + updateCamera(deltaTime); // handle various camera tweaks like off axis projection | |
| 2360 | + updateDialogs(deltaTime); // update various stats dialogs if present | |
| 2361 | + updateAudio(deltaTime); // Update audio stats for procedural sounds | |
| 2362 | + updateCursor(deltaTime); // Handle cursor updates | |
| 2363 | +} | |
| 2364 | + | |
| 2255 | 2365 | void Application::updateAvatar(float deltaTime) { |
| 2256 | 2366 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2257 | 2367 | PerformanceWarning warn(showWarnings, "Application::updateAvatar()"); |
| @@ -3258,6 +3368,8 @@ void Application::displayStats() { · 1000 unmodified lines | ||
| 3258 | 3368 | drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, avatarStats); |
| 3259 | 3369 | |
| 3260 | 3370 | |
| 3371 | + QLocale locale(QLocale::English); | |
| 3372 | + | |
| 3261 | 3373 | std::stringstream voxelStats; |
| 3262 | 3374 | voxelStats.precision(4); |
| 3263 | 3375 | voxelStats << "Voxels " << |
| @@ -3280,11 +3392,19 @@ void Application::displayStats() { · 16 unmodified lines | ||
| 3280 | 3392 | statsVerticalOffset += PELS_PER_LINE; |
| 3281 | 3393 | drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); |
| 3282 | 3394 | |
| 3395 | + unsigned long localTotal = VoxelNode::getNodeCount(); | |
| 3396 | + unsigned long localInternal = VoxelNode::getInternalNodeCount(); | |
| 3397 | + unsigned long localLeaves = VoxelNode::getLeafNodeCount(); | |
| 3398 | + QString localTotalString = locale.toString((uint)localTotal); // consider adding: .rightJustified(10, ' '); | |
| 3399 | + QString localInternalString = locale.toString((uint)localInternal); | |
| 3400 | + QString localLeavesString = locale.toString((uint)localLeaves); | |
| 3401 | + | |
| 3402 | + | |
| 3283 | 3403 | voxelStats.str(""); |
| 3284 | 3404 | voxelStats << |
| 3285 | − "Local Voxels Total: " << VoxelNode::getNodeCount() << ", " << | |
| 3286 | − "Internal: " << VoxelNode::getInternalNodeCount() << " , " << | |
| 3287 | − "Leaves: " << VoxelNode::getLeafNodeCount() << ""; | |
| 3405 | + "Local Voxels Total: " << localTotalString.toLocal8Bit().constData() << " / " << | |
| 3406 | + "Internal: " << localInternalString.toLocal8Bit().constData() << " / " << | |
| 3407 | + "Leaves: " << localLeavesString.toLocal8Bit().constData() << ""; | |
| 3288 | 3408 | statsVerticalOffset += PELS_PER_LINE; |
| 3289 | 3409 | drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); |
| 3290 | 3410 | |
| @@ -3311,6 +3431,29 @@ void Application::displayStats() { · 20 unmodified lines | ||
| 3311 | 3431 | voxelStats << "Sending Mode: " << voxelDetails; |
| 3312 | 3432 | statsVerticalOffset += PELS_PER_LINE; |
| 3313 | 3433 | drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); |
| 3434 | + | |
| 3435 | + voxelStats.str(""); | |
| 3436 | + int voxelPacketsToProcess = _voxelProcessor.packetsToProcessCount(); | |
| 3437 | + QString packetsString = locale.toString((int)voxelPacketsToProcess); | |
| 3438 | + QString maxString = locale.toString((int)_recentMaxPackets); | |
| 3439 | + | |
| 3440 | + voxelStats << "Voxel Packets to Process: " << packetsString.toLocal8Bit().constData() | |
| 3441 | + << " [Recent Max: " << maxString.toLocal8Bit().constData() << "]"; | |
| 3442 | + | |
| 3443 | + if (_resetRecentMaxPacketsSoon && voxelPacketsToProcess > 0) { | |
| 3444 | + _recentMaxPackets = 0; | |
| 3445 | + _resetRecentMaxPacketsSoon = false; | |
| 3446 | + } | |
| 3447 | + if (voxelPacketsToProcess == 0) { | |
| 3448 | + _resetRecentMaxPacketsSoon = true; | |
| 3449 | + } else { | |
| 3450 | + if (voxelPacketsToProcess > _recentMaxPackets) { | |
| 3451 | + _recentMaxPackets = voxelPacketsToProcess; | |
| 3452 | + } | |
| 3453 | + } | |
| 3454 | + statsVerticalOffset += PELS_PER_LINE; | |
| 3455 | + drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); | |
| 3456 | + | |
| 3314 | 3457 | |
| 3315 | 3458 | Node *avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); |
| 3316 | 3459 | char avatarMixerStats[200]; |