Showing the changes to interface/src/Application.cpp (1 of 100 files). Show all
Unified · Split
| @@ -679,7 +679,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 678 unmodified lines | ||
| 679 | 679 | })); |
| 680 | 680 | |
| 681 | 681 | userInputMapper->registerDevice(_applicationStateDevice); |
| 682 | − | |
| 682 | + | |
| 683 | 683 | // Setup the keyboardMouseDevice and the user input mapper with the default bindings |
| 684 | 684 | userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice()); |
| 685 | 685 | |
| @@ -749,7 +749,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 63 unmodified lines | ||
| 749 | 749 | _oldHandRightClick[0] = false; |
| 750 | 750 | _oldHandLeftClick[1] = false; |
| 751 | 751 | _oldHandRightClick[1] = false; |
| 752 | − | |
| 752 | + | |
| 753 | 753 | auto applicationUpdater = DependencyManager::get<AutoUpdater>(); |
| 754 | 754 | connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); |
| 755 | 755 | applicationUpdater->checkForUpdate(); |
| @@ -768,7 +768,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 12 unmodified lines | ||
| 768 | 768 | |
| 769 | 769 | // If the user clicks an an entity, we will check that it's an unlocked web entity, and if so, set the focus to it |
| 770 | 770 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); |
| 771 | − connect(entityScriptingInterface.data(), &EntityScriptingInterface::clickDownOnEntity, | |
| 771 | + connect(entityScriptingInterface.data(), &EntityScriptingInterface::clickDownOnEntity, | |
| 772 | 772 | [this, entityScriptingInterface](const EntityItemID& entityItemID, const MouseEvent& event) { |
| 773 | 773 | if (_keyboardFocusedItem != entityItemID) { |
| 774 | 774 | _keyboardFocusedItem = UNKNOWN_ENTITY_ID; |
| @@ -817,7 +817,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 42 unmodified lines | ||
| 817 | 817 | }); |
| 818 | 818 | |
| 819 | 819 | // If the user clicks somewhere where there is NO entity at all, we will release focus |
| 820 | − connect(getEntities(), &EntityTreeRenderer::mousePressOffEntity, | |
| 820 | + connect(getEntities(), &EntityTreeRenderer::mousePressOffEntity, | |
| 821 | 821 | [=](const RayToEntityIntersectionResult& entityItemID, const QMouseEvent* event, unsigned int deviceId) { |
| 822 | 822 | _keyboardFocusedItem = UNKNOWN_ENTITY_ID; |
| 823 | 823 | if (_keyboardFocusHighlight) { |
| @@ -826,17 +826,17 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 2 unmodified lines | ||
| 826 | 826 | }); |
| 827 | 827 | |
| 828 | 828 | connect(this, &Application::applicationStateChanged, this, &Application::activeChanged); |
| 829 | − | |
| 829 | + | |
| 830 | 830 | qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0); |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | void Application::aboutToQuit() { |
| 834 | 834 | emit beforeAboutToQuit(); |
| 835 | − | |
| 835 | + | |
| 836 | 836 | getActiveDisplayPlugin()->deactivate(); |
| 837 | − | |
| 837 | + | |
| 838 | 838 | _aboutToQuit = true; |
| 839 | − | |
| 839 | + | |
| 840 | 840 | cleanupBeforeQuit(); |
| 841 | 841 | } |
| 842 | 842 | |
| @@ -860,16 +860,16 @@ void Application::cleanupBeforeQuit() { · 17 unmodified lines | ||
| 860 | 860 | _keyboardFocusHighlight = nullptr; |
| 861 | 861 | |
| 862 | 862 | _entities.clear(); // this will allow entity scripts to properly shutdown |
| 863 | − | |
| 863 | + | |
| 864 | 864 | auto nodeList = DependencyManager::get<NodeList>(); |
| 865 | − | |
| 865 | + | |
| 866 | 866 | // send the domain a disconnect packet, force stoppage of domain-server check-ins |
| 867 | 867 | nodeList->getDomainHandler().disconnect(); |
| 868 | 868 | nodeList->setIsShuttingDown(true); |
| 869 | − | |
| 869 | + | |
| 870 | 870 | // tell the packet receiver we're shutting down, so it can drop packets |
| 871 | 871 | nodeList->getPacketReceiver().setShouldDropPackets(true); |
| 872 | − | |
| 872 | + | |
| 873 | 873 | _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts |
| 874 | 874 | ScriptEngine::stopAllScripts(this); // stop all currently running global scripts |
| 875 | 875 | |
| @@ -947,7 +947,7 @@ Application::~Application() { · 71 unmodified lines | ||
| 947 | 947 | DependencyManager::destroy<GeometryCache>(); |
| 948 | 948 | DependencyManager::destroy<ScriptCache>(); |
| 949 | 949 | DependencyManager::destroy<SoundCache>(); |
| 950 | − | |
| 950 | + | |
| 951 | 951 | // cleanup the AssetClient thread |
| 952 | 952 | QThread* assetThread = DependencyManager::get<AssetClient>()->thread(); |
| 953 | 953 | DependencyManager::destroy<AssetClient>(); |
| @@ -955,14 +955,14 @@ Application::~Application() { · 1 unmodified line | ||
| 955 | 955 | assetThread->wait(); |
| 956 | 956 | |
| 957 | 957 | QThread* nodeThread = DependencyManager::get<NodeList>()->thread(); |
| 958 | − | |
| 958 | + | |
| 959 | 959 | // remove the NodeList from the DependencyManager |
| 960 | 960 | DependencyManager::destroy<NodeList>(); |
| 961 | 961 | |
| 962 | 962 | // ask the node thread to quit and wait until it is done |
| 963 | 963 | nodeThread->quit(); |
| 964 | 964 | nodeThread->wait(); |
| 965 | − | |
| 965 | + | |
| 966 | 966 | Leapmotion::destroy(); |
| 967 | 967 | RealSense::destroy(); |
| 968 | 968 | |
| @@ -1058,7 +1058,7 @@ void Application::initializeUi() { · 89 unmodified lines | ||
| 1058 | 1058 | resizeGL(); |
| 1059 | 1059 | } |
| 1060 | 1060 | }); |
| 1061 | − | |
| 1061 | + | |
| 1062 | 1062 | // This will set up the input plugins UI |
| 1063 | 1063 | _activeInputPlugins.clear(); |
| 1064 | 1064 | foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) { |
| @@ -1100,8 +1100,8 @@ void Application::paintGL() { · 35 unmodified lines | ||
| 1100 | 1100 | return; |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | − // Some plugins process message events, potentially leading to | |
| 1104 | − // re-entering a paint event. don't allow further processing if this | |
| 1103 | + // Some plugins process message events, potentially leading to | |
| 1104 | + // re-entering a paint event. don't allow further processing if this | |
| 1105 | 1105 | // happens |
| 1106 | 1106 | if (_inPaint) { |
| 1107 | 1107 | return; |
| @@ -1137,17 +1137,17 @@ void Application::paintGL() { · 29 unmodified lines | ||
| 1137 | 1137 | if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { |
| 1138 | 1138 | PerformanceTimer perfTimer("Mirror"); |
| 1139 | 1139 | auto primaryFbo = DependencyManager::get<FramebufferCache>()->getPrimaryFramebufferDepthColor(); |
| 1140 | − | |
| 1140 | + | |
| 1141 | 1141 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; |
| 1142 | 1142 | renderRearViewMirror(&renderArgs, _mirrorViewRect); |
| 1143 | 1143 | renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE; |
| 1144 | − | |
| 1144 | + | |
| 1145 | 1145 | { |
| 1146 | 1146 | float ratio = ((float)QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale()); |
| 1147 | 1147 | // Flip the src and destination rect horizontally to do the mirror |
| 1148 | 1148 | auto mirrorRect = glm::ivec4(0, 0, _mirrorViewRect.width() * ratio, _mirrorViewRect.height() * ratio); |
| 1149 | 1149 | auto mirrorRectDest = glm::ivec4(mirrorRect.z, mirrorRect.y, mirrorRect.x, mirrorRect.w); |
| 1150 | − | |
| 1150 | + | |
| 1151 | 1151 | auto selfieFbo = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer(); |
| 1152 | 1152 | gpu::doInBatch(renderArgs._context, [=](gpu::Batch& batch) { |
| 1153 | 1153 | batch.setFramebuffer(selfieFbo); |
| @@ -1169,9 +1169,9 @@ void Application::paintGL() { · 15 unmodified lines | ||
| 1169 | 1169 | |
| 1170 | 1170 | { |
| 1171 | 1171 | PerformanceTimer perfTimer("CameraUpdates"); |
| 1172 | − | |
| 1172 | + | |
| 1173 | 1173 | auto myAvatar = getMyAvatar(); |
| 1174 | − | |
| 1174 | + | |
| 1175 | 1175 | myAvatar->startCapture(); |
| 1176 | 1176 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| 1177 | 1177 | Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN); |
| @@ -1208,26 +1208,26 @@ void Application::paintGL() { · 30 unmodified lines | ||
| 1208 | 1208 | * (myAvatar->getScale() * myAvatar->getBoomLength() * glm::vec3(0.0f, 0.0f, 1.0f))); |
| 1209 | 1209 | } else { |
| 1210 | 1210 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() |
| 1211 | − + myAvatar->getOrientation() | |
| 1211 | + + myAvatar->getOrientation() | |
| 1212 | 1212 | * (myAvatar->getScale() * myAvatar->getBoomLength() * glm::vec3(0.0f, 0.0f, 1.0f))); |
| 1213 | 1213 | } |
| 1214 | 1214 | } |
| 1215 | 1215 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 1216 | 1216 | if (isHMDMode()) { |
| 1217 | 1217 | glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); |
| 1218 | − _myCamera.setRotation(myAvatar->getWorldAlignedOrientation() | |
| 1218 | + _myCamera.setRotation(myAvatar->getWorldAlignedOrientation() | |
| 1219 | 1219 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)) * hmdRotation); |
| 1220 | 1220 | glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix()); |
| 1221 | − _myCamera.setPosition(myAvatar->getDefaultEyePosition() | |
| 1222 | − + glm::vec3(0, _raiseMirror * myAvatar->getScale(), 0) | |
| 1221 | + _myCamera.setPosition(myAvatar->getDefaultEyePosition() | |
| 1222 | + + glm::vec3(0, _raiseMirror * myAvatar->getScale(), 0) | |
| 1223 | 1223 | + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * |
| 1224 | − glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror | |
| 1224 | + glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror | |
| 1225 | 1225 | + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))) * hmdOffset); |
| 1226 | 1226 | } else { |
| 1227 | − _myCamera.setRotation(myAvatar->getWorldAlignedOrientation() | |
| 1227 | + _myCamera.setRotation(myAvatar->getWorldAlignedOrientation() | |
| 1228 | 1228 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); |
| 1229 | − _myCamera.setPosition(myAvatar->getDefaultEyePosition() | |
| 1230 | − + glm::vec3(0, _raiseMirror * myAvatar->getScale(), 0) | |
| 1229 | + _myCamera.setPosition(myAvatar->getDefaultEyePosition() | |
| 1230 | + + glm::vec3(0, _raiseMirror * myAvatar->getScale(), 0) | |
| 1231 | 1231 | + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * |
| 1232 | 1232 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 1233 | 1233 | } |
| @@ -1246,7 +1246,7 @@ void Application::paintGL() { · 12 unmodified lines | ||
| 1246 | 1246 | } |
| 1247 | 1247 | } |
| 1248 | 1248 | } |
| 1249 | − // Update camera position | |
| 1249 | + // Update camera position | |
| 1250 | 1250 | if (!isHMDMode()) { |
| 1251 | 1251 | _myCamera.update(1.0f / _fps); |
| 1252 | 1252 | } |
| @@ -1264,12 +1264,12 @@ void Application::paintGL() { · 11 unmodified lines | ||
| 1264 | 1264 | if (displayPlugin->isStereo()) { |
| 1265 | 1265 | // Stereo modes will typically have a larger projection matrix overall, |
| 1266 | 1266 | // so we ask for the 'mono' projection matrix, which for stereo and HMD |
| 1267 | − // plugins will imply the combined projection for both eyes. | |
| 1267 | + // plugins will imply the combined projection for both eyes. | |
| 1268 | 1268 | // |
| 1269 | 1269 | // This is properly implemented for the Oculus plugins, but for OpenVR |
| 1270 | − // and Stereo displays I'm not sure how to get / calculate it, so we're | |
| 1271 | − // just relying on the left FOV in each case and hoping that the | |
| 1272 | − // overall culling margin of error doesn't cause popping in the | |
| 1270 | + // and Stereo displays I'm not sure how to get / calculate it, so we're | |
| 1271 | + // just relying on the left FOV in each case and hoping that the | |
| 1272 | + // overall culling margin of error doesn't cause popping in the | |
| 1273 | 1273 | // right eye. There are FIXMEs in the relevant plugins |
| 1274 | 1274 | _myCamera.setProjection(displayPlugin->getProjection(Mono, _myCamera.getProjection())); |
| 1275 | 1275 | renderArgs._context->enableStereo(true); |
| @@ -1279,11 +1279,11 @@ void Application::paintGL() { · 3 unmodified lines | ||
| 1279 | 1279 | auto hmdInterface = DependencyManager::get<HMDScriptingInterface>(); |
| 1280 | 1280 | float IPDScale = hmdInterface->getIPDScale(); |
| 1281 | 1281 | // FIXME we probably don't need to set the projection matrix every frame, |
| 1282 | − // only when the display plugin changes (or in non-HMD modes when the user | |
| 1282 | + // only when the display plugin changes (or in non-HMD modes when the user | |
| 1283 | 1283 | // changes the FOV manually, which right now I don't think they can. |
| 1284 | 1284 | for_each_eye([&](Eye eye) { |
| 1285 | − // For providing the stereo eye views, the HMD head pose has already been | |
| 1286 | − // applied to the avatar, so we need to get the difference between the head | |
| 1285 | + // For providing the stereo eye views, the HMD head pose has already been | |
| 1286 | + // applied to the avatar, so we need to get the difference between the head | |
| 1287 | 1287 | // pose applied to the avatar and the per eye pose, and use THAT as |
| 1288 | 1288 | // the per-eye stereo matrix adjustment. |
| 1289 | 1289 | mat4 eyeToHead = displayPlugin->getEyeToHeadTransform(eye); |
| @@ -1293,10 +1293,10 @@ void Application::paintGL() { · 3 unmodified lines | ||
| 1293 | 1293 | mat4 eyeOffsetTransform = glm::translate(mat4(), eyeOffset * -1.0f * IPDScale); |
| 1294 | 1294 | eyeOffsets[eye] = eyeOffsetTransform; |
| 1295 | 1295 | |
| 1296 | − // Tell the plugin what pose we're using to render. In this case we're just using the | |
| 1297 | − // unmodified head pose because the only plugin that cares (the Oculus plugin) uses it | |
| 1298 | − // for rotational timewarp. If we move to support positonal timewarp, we need to | |
| 1299 | − // ensure this contains the full pose composed with the eye offsets. | |
| 1296 | + // Tell the plugin what pose we're using to render. In this case we're just using the | |
| 1297 | + // unmodified head pose because the only plugin that cares (the Oculus plugin) uses it | |
| 1298 | + // for rotational timewarp. If we move to support positonal timewarp, we need to | |
| 1299 | + // ensure this contains the full pose composed with the eye offsets. | |
| 1300 | 1300 | mat4 headPose = displayPlugin->getHeadPose(); |
| 1301 | 1301 | displayPlugin->setEyeRenderPose(eye, headPose); |
| 1302 | 1302 | |
| @@ -1343,7 +1343,7 @@ void Application::paintGL() { · 40 unmodified lines | ||
| 1343 | 1343 | PerformanceTimer perfTimer("pluginOutput"); |
| 1344 | 1344 | auto primaryFbo = framebufferCache->getPrimaryFramebuffer(); |
| 1345 | 1345 | GLuint finalTexture = gpu::GLBackend::getTextureID(primaryFbo->getRenderBuffer(0)); |
| 1346 | − // Ensure the rendering context commands are completed when rendering | |
| 1346 | + // Ensure the rendering context commands are completed when rendering | |
| 1347 | 1347 | GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); |
| 1348 | 1348 | // Ensure the sync object is flushed to the driver thread before releasing the context |
| 1349 | 1349 | // CRITICAL for the mac driver apparently. |
| @@ -1394,7 +1394,7 @@ void Application::audioMuteToggled() { · 44 unmodified lines | ||
| 1394 | 1394 | } |
| 1395 | 1395 | |
| 1396 | 1396 | void Application::faceTrackerMuteToggled() { |
| 1397 | − | |
| 1397 | + | |
| 1398 | 1398 | QAction* muteAction = Menu::getInstance()->getActionForOption(MenuOption::MuteFaceTracking); |
| 1399 | 1399 | Q_CHECK_PTR(muteAction); |
| 1400 | 1400 | bool isMuted = getSelectedFaceTracker()->isMuted(); |
| @@ -1427,7 +1427,7 @@ void Application::resizeGL() { · 26 unmodified lines | ||
| 1427 | 1427 | if (nullptr == _displayPlugin) { |
| 1428 | 1428 | return; |
| 1429 | 1429 | } |
| 1430 | − | |
| 1430 | + | |
| 1431 | 1431 | auto displayPlugin = getActiveDisplayPlugin(); |
| 1432 | 1432 | // Set the desired FBO texture size. If it hasn't changed, this does nothing. |
| 1433 | 1433 | // Otherwise, it must rebuild the FBOs |
| @@ -1437,14 +1437,14 @@ void Application::resizeGL() { · 3 unmodified lines | ||
| 1437 | 1437 | _renderResolution = renderSize; |
| 1438 | 1438 | DependencyManager::get<FramebufferCache>()->setFrameBufferSize(fromGlm(renderSize)); |
| 1439 | 1439 | } |
| 1440 | − | |
| 1440 | + | |
| 1441 | 1441 | // FIXME the aspect ratio for stereo displays is incorrect based on this. |
| 1442 | 1442 | float aspectRatio = displayPlugin->getRecommendedAspectRatio(); |
| 1443 | 1443 | _myCamera.setProjection(glm::perspective(glm::radians(_fieldOfView.get()), aspectRatio, |
| 1444 | 1444 | DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP)); |
| 1445 | 1445 | // Possible change in aspect ratio |
| 1446 | 1446 | loadViewFrustum(_myCamera, _viewFrustum); |
| 1447 | − | |
| 1447 | + | |
| 1448 | 1448 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 1449 | 1449 | auto uiSize = displayPlugin->getRecommendedUiSize(); |
| 1450 | 1450 | // Bit of a hack since there's no device pixel ratio change event I can find. |
| @@ -1613,7 +1613,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 162 unmodified lines | ||
| 1613 | 1613 | if (isMeta) { |
| 1614 | 1614 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 1615 | 1615 | offscreenUi->load("Browser.qml"); |
| 1616 | − } | |
| 1616 | + } | |
| 1617 | 1617 | break; |
| 1618 | 1618 | |
| 1619 | 1619 | case Qt::Key_X: |
| @@ -2109,7 +2109,7 @@ void Application::wheelEvent(QWheelEvent* event) { · 489 unmodified lines | ||
| 2109 | 2109 | if (_controllerScriptingInterface->isWheelCaptured()) { |
| 2110 | 2110 | return; |
| 2111 | 2111 | } |
| 2112 | − | |
| 2112 | + | |
| 2113 | 2113 | if (Menu::getInstance()->isOptionChecked(KeyboardMouseDevice::NAME)) { |
| 2114 | 2114 | _keyboardMouseDevice->wheelEvent(event); |
| 2115 | 2115 | } |
| @@ -2227,7 +2227,7 @@ void Application::idle(uint64_t now) { · 111 unmodified lines | ||
| 2227 | 2227 | _idleLoopStdev.reset(); |
| 2228 | 2228 | } |
| 2229 | 2229 | } |
| 2230 | − | |
| 2230 | + | |
| 2231 | 2231 | _overlayConductor.update(secondsSinceLastUpdate); |
| 2232 | 2232 | |
| 2233 | 2233 | // check for any requested background downloads. |
| @@ -2481,7 +2481,7 @@ void Application::init() { · 247 unmodified lines | ||
| 2481 | 2481 | DependencyManager::get<AddressManager>()->loadSettings(addressLookupString); |
| 2482 | 2482 | |
| 2483 | 2483 | qCDebug(interfaceapp) << "Loaded settings"; |
| 2484 | − | |
| 2484 | + | |
| 2485 | 2485 | Leapmotion::init(); |
| 2486 | 2486 | RealSense::init(); |
| 2487 | 2487 | |
| @@ -2539,7 +2539,7 @@ void Application::setAvatarUpdateThreading(bool isThreaded) { · 51 unmodified lines | ||
| 2539 | 2539 | if (_avatarUpdate && (_avatarUpdate->isThreaded() == isThreaded)) { |
| 2540 | 2540 | return; |
| 2541 | 2541 | } |
| 2542 | − | |
| 2542 | + | |
| 2543 | 2543 | auto myAvatar = getMyAvatar(); |
| 2544 | 2544 | if (_avatarUpdate) { |
| 2545 | 2545 | _avatarUpdate->terminate(); // Must be before we shutdown anim graph. |
| @@ -2750,7 +2750,7 @@ void Application::updateDialogs(float deltaTime) { · 204 unmodified lines | ||
| 2750 | 2750 | if(audioStatsDialog) { |
| 2751 | 2751 | audioStatsDialog->update(); |
| 2752 | 2752 | } |
| 2753 | − | |
| 2753 | + | |
| 2754 | 2754 | // Update bandwidth dialog, if any |
| 2755 | 2755 | BandwidthDialog* bandwidthDialog = dialogsManager->getBandwidthDialog(); |
| 2756 | 2756 | if (bandwidthDialog) { |
| @@ -2828,14 +2828,8 @@ void Application::update(float deltaTime) { · 71 unmodified lines | ||
| 2828 | 2828 | myAvatar->setDriveKeys(TRANSLATE_Y, userInputMapper->getActionState(controller::Action::TRANSLATE_Y)); |
| 2829 | 2829 | myAvatar->setDriveKeys(TRANSLATE_X, userInputMapper->getActionState(controller::Action::TRANSLATE_X)); |
| 2830 | 2830 | if (deltaTime > FLT_EPSILON) { |
| 2831 | − // For rotations what we really want are meausures of "angles per second" (in order to prevent | |
| 2832 | − // fps-dependent spin rates) so we need to scale the units of the controller contribution. | |
| 2833 | − // (TODO?: maybe we should similarly scale ALL action state info, or change the expected behavior | |
| 2834 | − // controllers to provide a delta_per_second value rather than a raw delta.) | |
| 2835 | − const float EXPECTED_FRAME_RATE = 60.0f; | |
| 2836 | − float timeFactor = EXPECTED_FRAME_RATE * deltaTime; | |
| 2837 | − myAvatar->setDriveKeys(PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH) / timeFactor); | |
| 2838 | − myAvatar->setDriveKeys(YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW) / timeFactor); | |
| 2831 | + myAvatar->setDriveKeys(PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH)); | |
| 2832 | + myAvatar->setDriveKeys(YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW)); | |
| 2839 | 2833 | myAvatar->setDriveKeys(STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW)); |
| 2840 | 2834 | } |
| 2841 | 2835 | } |
| @@ -2892,7 +2886,7 @@ void Application::update(float deltaTime) { · 50 unmodified lines | ||
| 2892 | 2886 | _entities.getTree()->withWriteLock([&] { |
| 2893 | 2887 | _physicsEngine->stepSimulation(); |
| 2894 | 2888 | }); |
| 2895 | − | |
| 2889 | + | |
| 2896 | 2890 | if (_physicsEngine->hasOutgoingChanges()) { |
| 2897 | 2891 | _entities.getTree()->withWriteLock([&] { |
| 2898 | 2892 | _entitySimulation.handleOutgoingChanges(_physicsEngine->getOutgoingChanges(), _physicsEngine->getSessionID()); |
| @@ -3021,10 +3015,10 @@ int Application::sendNackPackets() { · 122 unmodified lines | ||
| 3021 | 3015 | foreach(const OCTREE_PACKET_SEQUENCE& missingNumber, missingSequenceNumbers) { |
| 3022 | 3016 | nackPacketList->writePrimitive(missingNumber); |
| 3023 | 3017 | } |
| 3024 | − | |
| 3018 | + | |
| 3025 | 3019 | if (nackPacketList->getNumPackets()) { |
| 3026 | 3020 | packetsSent += nackPacketList->getNumPackets(); |
| 3027 | − | |
| 3021 | + | |
| 3028 | 3022 | // send the packet list |
| 3029 | 3023 | nodeList->sendPacketList(std::move(nackPacketList), *node); |
| 3030 | 3024 | } |
| @@ -3632,7 +3626,7 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi · 601 unmodified lines | ||
| 3632 | 3626 | float fov = MIRROR_FIELD_OF_VIEW; |
| 3633 | 3627 | |
| 3634 | 3628 | auto myAvatar = getMyAvatar(); |
| 3635 | − | |
| 3629 | + | |
| 3636 | 3630 | // bool eyeRelativeCamera = false; |
| 3637 | 3631 | if (billboard) { |
| 3638 | 3632 | fov = BILLBOARD_FIELD_OF_VIEW; // degees |
| @@ -3840,7 +3834,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 201 unmodified lines | ||
| 3840 | 3834 | Menu::getInstance()->getActionForOption(MenuOption::UploadAsset)->setEnabled(false); |
| 3841 | 3835 | } |
| 3842 | 3836 | } |
| 3843 | − | |
| 3837 | + | |
| 3844 | 3838 | void Application::trackIncomingOctreePacket(NLPacket& packet, SharedNodePointer sendingNode, bool wasStatsPacket) { |
| 3845 | 3839 | |
| 3846 | 3840 | // Attempt to identify the sender from its address. |
| @@ -3865,7 +3859,7 @@ int Application::processOctreeStats(NLPacket& packet, SharedNodePointer sendingN · 18 unmodified lines | ||
| 3865 | 3859 | int statsMessageLength = 0; |
| 3866 | 3860 | |
| 3867 | 3861 | const QUuid& nodeUUID = sendingNode->getUUID(); |
| 3868 | − | |
| 3862 | + | |
| 3869 | 3863 | // now that we know the node ID, let's add these stats to the stats for that node... |
| 3870 | 3864 | _octreeServerSceneStats.withWriteLock([&] { |
| 3871 | 3865 | OctreeSceneStats& octreeStats = _octreeServerSceneStats[nodeUUID]; |
| @@ -4066,7 +4060,7 @@ bool Application::acceptURL(const QString& urlString, bool defaultUpload) { · 194 unmodified lines | ||
| 4066 | 4060 | Qt::AutoConnection, Q_ARG(const QString&, urlString)); |
| 4067 | 4061 | return true; |
| 4068 | 4062 | } |
| 4069 | − | |
| 4063 | + | |
| 4070 | 4064 | QUrl url(urlString); |
| 4071 | 4065 | QHashIterator<QString, AcceptURLMethod> i(_acceptedExtensions); |
| 4072 | 4066 | QString lowerPath = url.path().toLower(); |
| @@ -4077,7 +4071,7 @@ bool Application::acceptURL(const QString& urlString, bool defaultUpload) { · 4 unmodified lines | ||
| 4077 | 4071 | return (this->*method)(urlString); |
| 4078 | 4072 | } |
| 4079 | 4073 | } |
| 4080 | − | |
| 4074 | + | |
| 4081 | 4075 | return defaultUpload && askToUploadAsset(urlString); |
| 4082 | 4076 | } |
| 4083 | 4077 | |
| @@ -4159,10 +4153,10 @@ bool Application::askToUploadAsset(const QString& filename) { · 75 unmodified lines | ||
| 4159 | 4153 | QString("You don't have upload rights on that domain.\n\n")); |
| 4160 | 4154 | return false; |
| 4161 | 4155 | } |
| 4162 | − | |
| 4156 | + | |
| 4163 | 4157 | QUrl url { filename }; |
| 4164 | 4158 | if (auto upload = DependencyManager::get<AssetClient>()->createUpload(url.toLocalFile())) { |
| 4165 | − | |
| 4159 | + | |
| 4166 | 4160 | QMessageBox messageBox; |
| 4167 | 4161 | messageBox.setWindowTitle("Asset upload"); |
| 4168 | 4162 | messageBox.setText("You are about to upload the following file to the asset server:\n" + |
| @@ -4170,19 +4164,19 @@ bool Application::askToUploadAsset(const QString& filename) { · 1 unmodified line | ||
| 4170 | 4164 | messageBox.setInformativeText("Do you want to continue?"); |
| 4171 | 4165 | messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); |
| 4172 | 4166 | messageBox.setDefaultButton(QMessageBox::Ok); |
| 4173 | − | |
| 4167 | + | |
| 4174 | 4168 | // Option to drop model in world for models |
| 4175 | 4169 | if (filename.endsWith(FBX_EXTENSION) || filename.endsWith(OBJ_EXTENSION)) { |
| 4176 | 4170 | auto checkBox = new QCheckBox(&messageBox); |
| 4177 | 4171 | checkBox->setText("Add to scene"); |
| 4178 | 4172 | messageBox.setCheckBox(checkBox); |
| 4179 | 4173 | } |
| 4180 | − | |
| 4174 | + | |
| 4181 | 4175 | if (messageBox.exec() != QMessageBox::Ok) { |
| 4182 | 4176 | upload->deleteLater(); |
| 4183 | 4177 | return false; |
| 4184 | 4178 | } |
| 4185 | − | |
| 4179 | + | |
| 4186 | 4180 | // connect to the finished signal so we know when the AssetUpload is done |
| 4187 | 4181 | if (messageBox.checkBox() && (messageBox.checkBox()->checkState() == Qt::Checked)) { |
| 4188 | 4182 | // Custom behavior for models |
| @@ -4192,12 +4186,12 @@ bool Application::askToUploadAsset(const QString& filename) { · 3 unmodified lines | ||
| 4192 | 4186 | &AssetUploadDialogFactory::getInstance(), |
| 4193 | 4187 | &AssetUploadDialogFactory::handleUploadFinished); |
| 4194 | 4188 | } |
| 4195 | − | |
| 4189 | + | |
| 4196 | 4190 | // start the upload now |
| 4197 | 4191 | upload->start(); |
| 4198 | 4192 | return true; |
| 4199 | 4193 | } |
| 4200 | − | |
| 4194 | + | |
| 4201 | 4195 | // display a message box with the error |
| 4202 | 4196 | QMessageBox::warning(_window, "Failed Upload", QString("Failed to upload %1.\n\n").arg(filename)); |
| 4203 | 4197 | return false; |
| @@ -4205,20 +4199,20 @@ bool Application::askToUploadAsset(const QString& filename) { · 1 unmodified line | ||
| 4205 | 4199 | |
| 4206 | 4200 | void Application::modelUploadFinished(AssetUpload* upload, const QString& hash) { |
| 4207 | 4201 | auto filename = QFileInfo(upload->getFilename()).fileName(); |
| 4208 | − | |
| 4202 | + | |
| 4209 | 4203 | if ((upload->getError() == AssetUpload::NoError) && |
| 4210 | 4204 | (filename.endsWith(FBX_EXTENSION) || filename.endsWith(OBJ_EXTENSION))) { |
| 4211 | − | |
| 4205 | + | |
| 4212 | 4206 | auto entities = DependencyManager::get<EntityScriptingInterface>(); |
| 4213 | − | |
| 4207 | + | |
| 4214 | 4208 | EntityItemProperties properties; |
| 4215 | 4209 | properties.setType(EntityTypes::Model); |
| 4216 | 4210 | properties.setModelURL(QString("%1:%2.%3").arg(URL_SCHEME_ATP).arg(hash).arg(upload->getExtension())); |
| 4217 | 4211 | properties.setPosition(_myCamera.getPosition() + _myCamera.getOrientation() * Vectors::FRONT * 2.0f); |
| 4218 | 4212 | properties.setName(QUrl(upload->getFilename()).fileName()); |
| 4219 | − | |
| 4213 | + | |
| 4220 | 4214 | entities->addEntity(properties); |
| 4221 | − | |
| 4215 | + | |
| 4222 | 4216 | upload->deleteLater(); |
| 4223 | 4217 | } else { |
| 4224 | 4218 | AssetUploadDialogFactory::getInstance().handleUploadFinished(upload, hash); |
| @@ -4499,7 +4493,7 @@ void Application::takeSnapshot() { · 274 unmodified lines | ||
| 4499 | 4493 | _snapshotShareDialog = new SnapshotShareDialog(fileName, _glWidget); |
| 4500 | 4494 | } |
| 4501 | 4495 | _snapshotShareDialog->show(); |
| 4502 | − | |
| 4496 | + | |
| 4503 | 4497 | } |
| 4504 | 4498 | |
| 4505 | 4499 | float Application::getRenderResolutionScale() const { |
| @@ -4744,8 +4738,8 @@ void Application::updateDisplayMode() { · 238 unmodified lines | ||
| 4744 | 4738 | return; |
| 4745 | 4739 | } |
| 4746 | 4740 | |
| 4747 | − // Some plugins *cough* Oculus *cough* process message events from inside their | |
| 4748 | − // display function, and we don't want to change the display plugin underneath | |
| 4741 | + // Some plugins *cough* Oculus *cough* process message events from inside their | |
| 4742 | + // display function, and we don't want to change the display plugin underneath | |
| 4749 | 4743 | // the paintGL call, so we need to guard against that |
| 4750 | 4744 | if (_inPaint) { |
| 4751 | 4745 | qDebug() << "Deferring plugin switch until out of painting"; |
| @@ -4779,14 +4773,14 @@ void Application::updateDisplayMode() { · 27 unmodified lines | ||
| 4779 | 4773 | |
| 4780 | 4774 | oldDisplayPlugin = _displayPlugin; |
| 4781 | 4775 | _displayPlugin = newDisplayPlugin; |
| 4782 | − | |
| 4776 | + | |
| 4783 | 4777 | // If the displayPlugin is a screen based HMD, then it will want the HMDTools displayed |
| 4784 | 4778 | // Direct Mode HMDs (like windows Oculus) will be isHmd() but will have a screen of -1 |
| 4785 | 4779 | bool newPluginWantsHMDTools = newDisplayPlugin ? |
| 4786 | 4780 | (newDisplayPlugin->isHmd() && (newDisplayPlugin->getHmdScreen() >= 0)) : false; |
| 4787 | − bool oldPluginWantedHMDTools = oldDisplayPlugin ? | |
| 4781 | + bool oldPluginWantedHMDTools = oldDisplayPlugin ? | |
| 4788 | 4782 | (oldDisplayPlugin->isHmd() && (oldDisplayPlugin->getHmdScreen() >= 0)) : false; |
| 4789 | − | |
| 4783 | + | |
| 4790 | 4784 | // Only show the hmd tools after the correct plugin has |
| 4791 | 4785 | // been activated so that it's UI is setup correctly |
| 4792 | 4786 | if (newPluginWantsHMDTools) { |
| @@ -4796,7 +4790,7 @@ void Application::updateDisplayMode() { · 3 unmodified lines | ||
| 4796 | 4790 | if (oldDisplayPlugin) { |
| 4797 | 4791 | oldDisplayPlugin->deactivate(); |
| 4798 | 4792 | _offscreenContext->makeCurrent(); |
| 4799 | − | |
| 4793 | + | |
| 4800 | 4794 | // if the old plugin was HMD and the new plugin is not HMD, then hide our hmdtools |
| 4801 | 4795 | if (oldPluginWantedHMDTools && !newPluginWantsHMDTools) { |
| 4802 | 4796 | DependencyManager::get<DialogsManager>()->hmdTools(false); |
| @@ -4929,7 +4923,7 @@ void Application::setPalmData(Hand* hand, const controller::Pose& pose, float de · 126 unmodified lines | ||
| 4929 | 4923 | rawVelocity = glm::vec3(0.0f); |
| 4930 | 4924 | } |
| 4931 | 4925 | palm.setRawVelocity(rawVelocity); // meters/sec |
| 4932 | − | |
| 4926 | + | |
| 4933 | 4927 | // Angular Velocity of Palm |
| 4934 | 4928 | glm::quat deltaRotation = rotation * glm::inverse(palm.getRawRotation()); |
| 4935 | 4929 | glm::vec3 angularVelocity(0.0f); |
| @@ -5009,7 +5003,7 @@ void Application::emulateMouse(Hand* hand, float click, float shift, HandData::H · 73 unmodified lines | ||
| 5009 | 5003 | pos.setY(canvasSize.y / 2.0f + cursorRange * yAngle); |
| 5010 | 5004 | |
| 5011 | 5005 | } |
| 5012 | − | |
| 5006 | + | |
| 5013 | 5007 | //If we are off screen then we should stop processing, and if a trigger or bumper is pressed, |
| 5014 | 5008 | //we should unpress them. |
| 5015 | 5009 | if (pos.x() == INT_MAX) { |