History

Merge branch 'loginInitiative2' of https://github.com/wayne-chen/hifi into loginInitiative2

Wayne Chen committed 7 years ago

Commit 28203282 parents 4f1361c 1419ec989 files · +898 −365Browse files

Showing the changes to interface/src/Application.cpp (1 of 89 files). Show all

Unified · Split

interface/src/Application.cpp+56−19
@@ -371,6 +371,8 @@ static const QString INFO_HELP_PATH = "html/tabletHelp.html"; · 370 unmodified lines
371 371
372static const unsigned int THROTTLED_SIM_FRAMERATE = 15;372static const unsigned int THROTTLED_SIM_FRAMERATE = 15;
373static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SIM_FRAMERATE;373static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SIM_FRAMERATE;
374static const int ENTITY_SERVER_ADDED_TIMEOUT = 5000;
375static const int ENTITY_SERVER_CONNECTION_TIMEOUT = 5000;
374 376
375static const uint32_t INVALID_FRAME = UINT32_MAX;377static 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 getOverlays().deleteOverlay(getTabletScreenID());1236 getOverlays().deleteOverlay(getTabletScreenID());
1235 getOverlays().deleteOverlay(getTabletHomeButtonID());1237 getOverlays().deleteOverlay(getTabletHomeButtonID());
1236 getOverlays().deleteOverlay(getTabletFrameID());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 connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &Application::domainConnectionRefused);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 // Desktop mode.1329 // Desktop mode.
1316 getOverlays().deleteOverlay(_loginDialogOverlayID);1330 getOverlays().deleteOverlay(_loginDialogOverlayID);
1317 _loginDialogOverlayID = OverlayID();1331 _loginDialogOverlayID = OverlayID();
1318 _loginPointerManager.tearDown();1332 _loginStateManager.tearDown();
1319 dialogsManager->showLoginDialog();1333 dialogsManager->showLoginDialog();
1320 }1334 }
1321 }1335 }
@@ -3394,26 +3408,37 @@ void Application::showHelp() { · 2072 unmodified lines
3394 static const QString HAND_CONTROLLER_NAME_OCULUS_TOUCH = "oculus";3408 static const QString HAND_CONTROLLER_NAME_OCULUS_TOUCH = "oculus";
3395 static const QString HAND_CONTROLLER_NAME_WINDOWS_MR = "windowsMR";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 static const QString TAB_KEYBOARD_MOUSE = "kbm";3415 static const QString TAB_KEYBOARD_MOUSE = "kbm";
3398 static const QString TAB_GAMEPAD = "gamepad";3416 static const QString TAB_GAMEPAD = "gamepad";
3399 static const QString TAB_HAND_CONTROLLERS = "handControllers";3417 static const QString TAB_HAND_CONTROLLERS = "handControllers";
3400 3418
3401 QString handControllerName = HAND_CONTROLLER_NAME_VIVE;3419 QString handControllerName;
3402 QString defaultTab = TAB_KEYBOARD_MOUSE;3420 QString defaultTab = TAB_KEYBOARD_MOUSE;
3403 3421
3404 if (PluginUtils::isViveControllerAvailable()) {3422 if (PluginUtils::isHMDAvailable(WINDOWS_MR_PLUGIN_NAME)) {
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") {
3411 defaultTab = TAB_HAND_CONTROLLERS;3423 defaultTab = TAB_HAND_CONTROLLERS;
3412 handControllerName = HAND_CONTROLLER_NAME_WINDOWS_MR;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 } else if (PluginUtils::isXboxControllerAvailable()) {3437 } else if (PluginUtils::isXboxControllerAvailable()) {
3414 defaultTab = TAB_GAMEPAD;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 QUrlQuery queryString;3443 QUrlQuery queryString;
3419 queryString.addQueryItem("handControllerName", handControllerName);3444 queryString.addQueryItem("handControllerName", handControllerName);
@@ -5844,6 +5869,7 @@ void Application::update(float deltaTime) { · 2424 unmodified lines
5844 quint64 now = usecTimestampNow();5869 quint64 now = usecTimestampNow();
5845 if (isServerlessMode() || _octreeProcessor.isLoadSequenceComplete()) {5870 if (isServerlessMode() || _octreeProcessor.isLoadSequenceComplete()) {
5846 bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();5871 bool enableInterstitial = DependencyManager::get<NodeList>()->getDomainHandler().getInterstitialModeEnabled();
5872
5847 if (gpuTextureMemSizeStable() || !enableInterstitial) {5873 if (gpuTextureMemSizeStable() || !enableInterstitial) {
5848 // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway5874 // we've received a new full-scene octree stats packet, or it's been long enough to try again anyway
5849 _lastPhysicsCheckTime = now;5875 _lastPhysicsCheckTime = now;
@@ -6225,7 +6251,7 @@ void Application::update(float deltaTime) { · 375 unmodified lines
6225 _overlays.update(deltaTime);6251 _overlays.update(deltaTime);
6226 }6252 }
6227 if (!_loginDialogOverlayID.isNull()) {6253 if (!_loginDialogOverlayID.isNull()) {
6228 _loginPointerManager.update();6254 _loginStateManager.update();
6229 }6255 }
6230 6256
6231 if (!_loginDialogOverlayID.isNull()) {6257 if (!_loginDialogOverlayID.isNull()) {
@@ -6242,8 +6268,8 @@ void Application::update(float deltaTime) { · 10 unmodified lines
6242 //auto lookAtQuat = glm::inverse(glm::quat_cast(glm::lookAt(positionVec, avatarHeadPosition, avatarHeadOrientation * Vectors::UNIT_Y)));6268 //auto lookAtQuat = glm::inverse(glm::quat_cast(glm::lookAt(positionVec, avatarHeadPosition, avatarHeadOrientation * Vectors::UNIT_Y)));
6243 auto pointAngle = (glm::acos(glm::dot(glm::normalize(overlayToHeadVec), glm::normalize(headLookVec))) * 180.0f / PI);6269 auto pointAngle = (glm::acos(glm::dot(glm::normalize(overlayToHeadVec), glm::normalize(headLookVec))) * 180.0f / PI);
6244 auto upVec = myAvatar->getWorldOrientation() * Vectors::UNIT_Y;6270 auto upVec = myAvatar->getWorldOrientation() * Vectors::UNIT_Y;
6245 auto offset = headLookVec * 1.0f;6271 auto offset = headLookVec * 0.7f;
6246 auto newOverlayPositionVec = (cameraPositionVec + offset);6272 auto newOverlayPositionVec = (cameraPositionVec + offset) + (upVec * -0.1f);
6247 auto newOverlayOrientation = glm::inverse(glm::quat_cast(glm::lookAt(newOverlayPositionVec, cameraPositionVec, upVec))) * Quaternions::Y_180;6273 auto newOverlayOrientation = glm::inverse(glm::quat_cast(glm::lookAt(newOverlayPositionVec, cameraPositionVec, upVec))) * Quaternions::Y_180;
6248 6274
6249 if (pointAngle > 30.0f) {6275 if (pointAngle > 30.0f) {
@@ -6702,7 +6728,8 @@ void Application::keyboardRaisedChanged(bool raised) { · 452 unmodified lines
6702 if (raised && !_loginDialogOverlayID.isNull()) {6728 if (raised && !_loginDialogOverlayID.isNull()) {
6703 QVariantMap properties {6729 QVariantMap properties {
6704 { "parentID", _loginDialogOverlayID },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 getOverlays().editOverlay(keyboard->getAnchorID(), properties);6734 getOverlays().editOverlay(keyboard->getAnchorID(), properties);
6708 }6735 }
@@ -6815,7 +6842,13 @@ void Application::resettingDomain() { · 106 unmodified lines
6815}6842}
6816 6843
6817void Application::nodeAdded(SharedNodePointer node) const {6844void Application::nodeAdded(SharedNodePointer node) const {
6818 // nothing to do here6845 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
6821void Application::nodeActivated(SharedNodePointer node) {6854void Application::nodeActivated(SharedNodePointer node) {
@@ -6843,6 +6876,10 @@ void Application::nodeActivated(SharedNodePointer node) { · 21 unmodified lines
6843 if (node->getType() == NodeType::EntityServer) {6876 if (node->getType() == NodeType::EntityServer) {
6844 _queryExpiry = SteadyClock::now();6877 _queryExpiry = SteadyClock::now();
6845 _octreeQuery.incrementConnectionID();6878 _octreeQuery.incrementConnectionID();
6879
6880 if (!_failedToConnectToEntityServer) {
6881 _entityServerConnectionTimer.stop();
6882 }
6846 }6883 }
6847 6884
6848 if (node->getType() == NodeType::AudioMixer && !isInterstitialMode()) {6885 if (node->getType() == NodeType::AudioMixer && !isInterstitialMode()) {
@@ -8614,7 +8651,7 @@ void Application::createLoginDialogOverlay() { · 1765 unmodified lines
8614 auto headLookVec = (cameraOrientation * Vectors::FRONT);8651 auto headLookVec = (cameraOrientation * Vectors::FRONT);
8615 // DEFAULT_DPI / tablet scale percentage8652 // DEFAULT_DPI / tablet scale percentage
8616 float overlayDpi = 31.0f / (75.0f / 100.0f);8653 float overlayDpi = 31.0f / (75.0f / 100.0f);
8617 auto offset = headLookVec * 1.0f;8654 auto offset = headLookVec * 0.7f;
8618 auto overlayPosition = (cameraPosition + offset) + (upVec * -0.1f);8655 auto overlayPosition = (cameraPosition + offset) + (upVec * -0.1f);
8619 8656
8620 const glm::vec2 LOGIN_OVERLAY_DIMENSIONS{ 0.5f, 0.5f };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 _loginDialogOverlayID = getOverlays().addOverlay("web3d", overlayProperties);8672 _loginDialogOverlayID = getOverlays().addOverlay("web3d", overlayProperties);
8636 if (!_loginPointerManager.isSetUp()) {8673 if (!_loginStateManager.isSetUp()) {
8637 _loginPointerManager.setUp();8674 _loginStateManager.setUp();
8638 }8675 }
8639}8676}
8640 8677
@@ -8651,7 +8688,7 @@ void Application::onDismissedLoginDialog() { · 10 unmodified lines
8651 qDebug() << "Deleting overlay";8688 qDebug() << "Deleting overlay";
8652 getOverlays().deleteOverlay(_loginDialogOverlayID);8689 getOverlays().deleteOverlay(_loginDialogOverlayID);
8653 _loginDialogOverlayID = OverlayID();8690 _loginDialogOverlayID = OverlayID();
8654 _loginPointerManager.tearDown();8691 _loginStateManager.tearDown();
8655 }8692 }
8656 resumeAfterLoginDialogActionTaken();8693 resumeAfterLoginDialogActionTaken();
8657}8694}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t