Showing the changes to interface/src/Application.cpp (1 of 89 files). Show all
Unified · Split
| @@ -371,6 +371,8 @@ static const QString INFO_HELP_PATH = "html/tabletHelp.html"; · 370 unmodified lines | ||
| 371 | 371 | |
| 372 | 372 | static const unsigned int THROTTLED_SIM_FRAMERATE = 15; |
| 373 | 373 | static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SIM_FRAMERATE; |
| 374 | +static const int ENTITY_SERVER_ADDED_TIMEOUT = 5000; | |
| 375 | +static const int ENTITY_SERVER_CONNECTION_TIMEOUT = 5000; | |
| 374 | 376 | |
| 375 | 377 | static const uint32_t INVALID_FRAME = UINT32_MAX; |
| 376 | 378 | |
| @@ -1234,6 +1236,18 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 857 unmodified lines | ||
| 1234 | 1236 | getOverlays().deleteOverlay(getTabletScreenID()); |
| 1235 | 1237 | getOverlays().deleteOverlay(getTabletHomeButtonID()); |
| 1236 | 1238 | getOverlays().deleteOverlay(getTabletFrameID()); |
| 1239 | + _failedToConnectToEntityServer = false; | |
| 1240 | + }); | |
| 1241 | + | |
| 1242 | + _entityServerConnectionTimer.setSingleShot(true); | |
| 1243 | + connect(&_entityServerConnectionTimer, &QTimer::timeout, this, &Application::setFailedToConnectToEntityServer); | |
| 1244 | + | |
| 1245 | + connect(&domainHandler, &DomainHandler::connectedToDomain, this, [this]() { | |
| 1246 | + if (!isServerlessMode()) { | |
| 1247 | + _entityServerConnectionTimer.setInterval(ENTITY_SERVER_ADDED_TIMEOUT); | |
| 1248 | + _entityServerConnectionTimer.start(); | |
| 1249 | + _failedToConnectToEntityServer = false; | |
| 1250 | + } | |
| 1237 | 1251 | }); |
| 1238 | 1252 | connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &Application::domainConnectionRefused); |
| 1239 | 1253 | |
| @@ -1315,7 +1329,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 75 unmodified lines | ||
| 1315 | 1329 | // Desktop mode. |
| 1316 | 1330 | getOverlays().deleteOverlay(_loginDialogOverlayID); |
| 1317 | 1331 | _loginDialogOverlayID = OverlayID(); |
| 1318 | − _loginPointerManager.tearDown(); | |
| 1332 | + _loginStateManager.tearDown(); | |
| 1319 | 1333 | dialogsManager->showLoginDialog(); |
| 1320 | 1334 | } |
| 1321 | 1335 | } |
| @@ -3394,26 +3408,37 @@ void Application::showHelp() { · 2072 unmodified lines | ||
| 3394 | 3408 | static const QString HAND_CONTROLLER_NAME_OCULUS_TOUCH = "oculus"; |
| 3395 | 3409 | static const QString HAND_CONTROLLER_NAME_WINDOWS_MR = "windowsMR"; |
| 3396 | 3410 | |
| 3411 | + static const QString VIVE_PLUGIN_NAME = "HTC Vive"; | |
| 3412 | + static const QString OCULUS_RIFT_PLUGIN_NAME = "Oculus Rift"; | |
| 3413 | + static const QString WINDOWS_MR_PLUGIN_NAME = "WindowsMR"; | |
| 3414 | + | |
| 3397 | 3415 | static const QString TAB_KEYBOARD_MOUSE = "kbm"; |
| 3398 | 3416 | static const QString TAB_GAMEPAD = "gamepad"; |
| 3399 | 3417 | static const QString TAB_HAND_CONTROLLERS = "handControllers"; |
| 3400 | 3418 | |
| 3401 | − QString handControllerName = HAND_CONTROLLER_NAME_VIVE; | |
| 3419 | + QString handControllerName; | |
| 3402 | 3420 | QString defaultTab = TAB_KEYBOARD_MOUSE; |
| 3403 | 3421 | |
| 3404 | − if (PluginUtils::isViveControllerAvailable()) { | |
| 3405 | − defaultTab = TAB_HAND_CONTROLLERS; | |
| 3406 | − handControllerName = HAND_CONTROLLER_NAME_VIVE; | |
| 3407 | − } else if (PluginUtils::isOculusTouchControllerAvailable()) { | |
| 3408 | − defaultTab = TAB_HAND_CONTROLLERS; | |
| 3409 | − handControllerName = HAND_CONTROLLER_NAME_OCULUS_TOUCH; | |
| 3410 | − } else if (qApp->getActiveDisplayPlugin()->getName() == "WindowMS") { | |
| 3422 | + if (PluginUtils::isHMDAvailable(WINDOWS_MR_PLUGIN_NAME)) { | |
| 3411 | 3423 | defaultTab = TAB_HAND_CONTROLLERS; |
| 3412 | 3424 | handControllerName = HAND_CONTROLLER_NAME_WINDOWS_MR; |
| 3425 | + } else if (PluginUtils::isHMDAvailable(VIVE_PLUGIN_NAME)) { | |
| 3426 | + defaultTab = TAB_HAND_CONTROLLERS; | |
| 3427 | + handControllerName = HAND_CONTROLLER_NAME_VIVE; | |
| 3428 | + } else if (PluginUtils::isHMDAvailable(OCULUS_RIFT_PLUGIN_NAME)) { | |
| 3429 | + if (PluginUtils::isOculusTouchControllerAvailable()) { | |
| 3430 | + defaultTab = TAB_HAND_CONTROLLERS; | |
| 3431 | + handControllerName = HAND_CONTROLLER_NAME_OCULUS_TOUCH; | |
| 3432 | + } else if (PluginUtils::isXboxControllerAvailable()) { | |
| 3433 | + defaultTab = TAB_GAMEPAD; | |
| 3434 | + } else { | |
| 3435 | + defaultTab = TAB_KEYBOARD_MOUSE; | |
| 3436 | + } | |
| 3413 | 3437 | } else if (PluginUtils::isXboxControllerAvailable()) { |
| 3414 | 3438 | defaultTab = TAB_GAMEPAD; |
| 3439 | + } else { | |
| 3440 | + defaultTab = TAB_KEYBOARD_MOUSE; | |
| 3415 | 3441 | } |
| 3416 | − // TODO need some way to detect windowsMR to load controls reference default tab in Help > Controls Reference menu. | |
| 3417 | 3442 | |
| 3418 | 3443 | QUrlQuery queryString; |
| 3419 | 3444 | queryString.addQueryItem("handControllerName", handControllerName); |
| @@ -5844,6 +5869,7 @@ void Application::update(float deltaTime) { · 2424 unmodified lines | ||
| 5844 | 5869 | quint64 now = usecTimestampNow(); |
| 5845 | 5870 | if (isServerlessMode() || _octreeProcessor.isLoadSequenceComplete()) { |
| 5846 | 5871 | bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled(); |
| 5872 | + | |
| 5847 | 5873 | if (gpuTextureMemSizeStable() || !enableInterstitial) { |
| 5848 | 5874 | // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway |
| 5849 | 5875 | _lastPhysicsCheckTime = now; |
| @@ -6225,7 +6251,7 @@ void Application::update(float deltaTime) { · 375 unmodified lines | ||
| 6225 | 6251 | _overlays.update(deltaTime); |
| 6226 | 6252 | } |
| 6227 | 6253 | if (!_loginDialogOverlayID.isNull()) { |
| 6228 | − _loginPointerManager.update(); | |
| 6254 | + _loginStateManager.update(); | |
| 6229 | 6255 | } |
| 6230 | 6256 | |
| 6231 | 6257 | if (!_loginDialogOverlayID.isNull()) { |
| @@ -6242,8 +6268,8 @@ void Application::update(float deltaTime) { · 10 unmodified lines | ||
| 6242 | 6268 | //auto lookAtQuat = glm::inverse(glm::quat_cast(glm::lookAt(positionVec, avatarHeadPosition, avatarHeadOrientation * Vectors::UNIT_Y))); |
| 6243 | 6269 | auto pointAngle = (glm::acos(glm::dot(glm::normalize(overlayToHeadVec), glm::normalize(headLookVec))) * 180.0f / PI); |
| 6244 | 6270 | auto upVec = myAvatar->getWorldOrientation() * Vectors::UNIT_Y; |
| 6245 | − auto offset = headLookVec * 1.0f; | |
| 6246 | − auto newOverlayPositionVec = (cameraPositionVec + offset); | |
| 6271 | + auto offset = headLookVec * 0.7f; | |
| 6272 | + auto newOverlayPositionVec = (cameraPositionVec + offset) + (upVec * -0.1f); | |
| 6247 | 6273 | auto newOverlayOrientation = glm::inverse(glm::quat_cast(glm::lookAt(newOverlayPositionVec, cameraPositionVec, upVec))) * Quaternions::Y_180; |
| 6248 | 6274 | |
| 6249 | 6275 | if (pointAngle > 30.0f) { |
| @@ -6702,7 +6728,8 @@ void Application::keyboardRaisedChanged(bool raised) { · 452 unmodified lines | ||
| 6702 | 6728 | if (raised && !_loginDialogOverlayID.isNull()) { |
| 6703 | 6729 | QVariantMap properties { |
| 6704 | 6730 | { "parentID", _loginDialogOverlayID }, |
| 6705 | − { "localPosition", vec3toVariant(glm::vec3(-0.3f, -0.3f, 0.2f)) } | |
| 6731 | + { "localPosition", vec3toVariant(glm::vec3(-0.3f, -0.3f, 0.2f)) }, | |
| 6732 | + { "localOrientation", quatToVariant(glm::quat(0.0f, 0.0, 1.00f, 0.0f)) } | |
| 6706 | 6733 | }; |
| 6707 | 6734 | getOverlays().editOverlay(keyboard->getAnchorID(), properties); |
| 6708 | 6735 | } |
| @@ -6815,7 +6842,13 @@ void Application::resettingDomain() { · 106 unmodified lines | ||
| 6815 | 6842 | } |
| 6816 | 6843 | |
| 6817 | 6844 | void Application::nodeAdded(SharedNodePointer node) const { |
| 6818 | − // nothing to do here | |
| 6845 | + if (node->getType() == NodeType::EntityServer) { | |
| 6846 | + if (!_failedToConnectToEntityServer) { | |
| 6847 | + _entityServerConnectionTimer.stop(); | |
| 6848 | + _entityServerConnectionTimer.setInterval(ENTITY_SERVER_CONNECTION_TIMEOUT); | |
| 6849 | + _entityServerConnectionTimer.start(); | |
| 6850 | + } | |
| 6851 | + } | |
| 6819 | 6852 | } |
| 6820 | 6853 | |
| 6821 | 6854 | void Application::nodeActivated(SharedNodePointer node) { |
| @@ -6843,6 +6876,10 @@ void Application::nodeActivated(SharedNodePointer node) { · 21 unmodified lines | ||
| 6843 | 6876 | if (node->getType() == NodeType::EntityServer) { |
| 6844 | 6877 | _queryExpiry = SteadyClock::now(); |
| 6845 | 6878 | _octreeQuery.incrementConnectionID(); |
| 6879 | + | |
| 6880 | + if (!_failedToConnectToEntityServer) { | |
| 6881 | + _entityServerConnectionTimer.stop(); | |
| 6882 | + } | |
| 6846 | 6883 | } |
| 6847 | 6884 | |
| 6848 | 6885 | if (node->getType() == NodeType::AudioMixer && !isInterstitialMode()) { |
| @@ -8614,7 +8651,7 @@ void Application::createLoginDialogOverlay() { · 1765 unmodified lines | ||
| 8614 | 8651 | auto headLookVec = (cameraOrientation * Vectors::FRONT); |
| 8615 | 8652 | // DEFAULT_DPI / tablet scale percentage |
| 8616 | 8653 | float overlayDpi = 31.0f / (75.0f / 100.0f); |
| 8617 | − auto offset = headLookVec * 1.0f; | |
| 8654 | + auto offset = headLookVec * 0.7f; | |
| 8618 | 8655 | auto overlayPosition = (cameraPosition + offset) + (upVec * -0.1f); |
| 8619 | 8656 | |
| 8620 | 8657 | const glm::vec2 LOGIN_OVERLAY_DIMENSIONS{ 0.5f, 0.5f }; |
| @@ -8633,8 +8670,8 @@ void Application::createLoginDialogOverlay() { · 12 unmodified lines | ||
| 8633 | 8670 | }; |
| 8634 | 8671 | |
| 8635 | 8672 | _loginDialogOverlayID = getOverlays().addOverlay("web3d", overlayProperties); |
| 8636 | − if (!_loginPointerManager.isSetUp()) { | |
| 8637 | − _loginPointerManager.setUp(); | |
| 8673 | + if (!_loginStateManager.isSetUp()) { | |
| 8674 | + _loginStateManager.setUp(); | |
| 8638 | 8675 | } |
| 8639 | 8676 | } |
| 8640 | 8677 | |
| @@ -8651,7 +8688,7 @@ void Application::onDismissedLoginDialog() { · 10 unmodified lines | ||
| 8651 | 8688 | qDebug() << "Deleting overlay"; |
| 8652 | 8689 | getOverlays().deleteOverlay(_loginDialogOverlayID); |
| 8653 | 8690 | _loginDialogOverlayID = OverlayID(); |
| 8654 | − _loginPointerManager.tearDown(); | |
| 8691 | + _loginStateManager.tearDown(); | |
| 8655 | 8692 | } |
| 8656 | 8693 | resumeAfterLoginDialogActionTaken(); |
| 8657 | 8694 | } |