Showing the changes to interface/src/Application.cpp (1 of 40 files). Show all
Unified · Split
| @@ -81,9 +81,10 @@ · 80 unmodified lines | |||
| 81 | #include "scripting/LocationScriptingInterface.h" | 81 | #include "scripting/LocationScriptingInterface.h" |
| 82 | 82 | ||
| 83 | #include "ui/InfoView.h" | 83 | #include "ui/InfoView.h" |
| 84 | #include "ui/OAuthWebViewHandler.h" | ||
| 84 | #include "ui/Snapshot.h" | 85 | #include "ui/Snapshot.h" |
| 85 | #include "ui/TextRenderer.h" | ||
| 86 | #include "ui/Stats.h" | 86 | #include "ui/Stats.h" |
| 87 | #include "ui/TextRenderer.h" | ||
| 87 | 88 | ||
| 88 | using namespace std; | 89 | using namespace std; |
| 89 | 90 | ||
| @@ -361,12 +362,17 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 271 unmodified lines | |||
| 361 | QMutexLocker locker(&_settingsMutex); | 362 | QMutexLocker locker(&_settingsMutex); |
| 362 | _previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString(); | 363 | _previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString(); |
| 363 | } | 364 | } |
| 364 | 365 | ||
| 365 | connect(_window, &MainWindow::windowGeometryChanged, | 366 | connect(_window, &MainWindow::windowGeometryChanged, |
| 366 | _runningScriptsWidget, &RunningScriptsWidget::setBoundary); | 367 | _runningScriptsWidget, &RunningScriptsWidget::setBoundary); |
| 367 | 368 | ||
| 368 | //When -url in command line, teleport to location | 369 | //When -url in command line, teleport to location |
| 369 | urlGoTo(argc, constArgv); | 370 | urlGoTo(argc, constArgv); |
| 371 | |||
| 372 | // call the OAuthWebviewHandler static getter so that its instance lives in our thread | ||
| 373 | OAuthWebViewHandler::getInstance(); | ||
| 374 | // make sure the High Fidelity root CA is in our list of trusted certs | ||
| 375 | OAuthWebViewHandler::addHighFidelityRootCAToSSLConfig(); | ||
| 370 | } | 376 | } |
| 371 | 377 | ||
| 372 | Application::~Application() { | 378 | Application::~Application() { |
| @@ -555,41 +561,42 @@ void Application::paintGL() { · 182 unmodified lines | |||
| 555 | _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition()); | 561 | _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition()); |
| 556 | _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); | 562 | _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation()); |
| 557 | 563 | ||
| 558 | glm::vec3 planeNormal = _myCamera.getTargetRotation() * IDENTITY_FRONT; | 564 | if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithAvatars)) { |
| 559 | const float BASE_PUSHBACK_RADIUS = 0.25f; | 565 | glm::vec3 planeNormal = _myCamera.getTargetRotation() * IDENTITY_FRONT; |
| 560 | float pushbackRadius = _myCamera.getNearClip() + _myAvatar->getScale() * BASE_PUSHBACK_RADIUS; | 566 | const float BASE_PUSHBACK_RADIUS = 0.25f; |
| 561 | glm::vec4 plane(planeNormal, -glm::dot(planeNormal, _myCamera.getTargetPosition()) - pushbackRadius); | 567 | float pushbackRadius = _myCamera.getNearClip() + _myAvatar->getScale() * BASE_PUSHBACK_RADIUS; |
| 562 | 568 | glm::vec4 plane(planeNormal, -glm::dot(planeNormal, _myCamera.getTargetPosition()) - pushbackRadius); | |
| 563 | // push camera out of any intersecting avatars | 569 | |
| 564 | foreach (const AvatarSharedPointer& avatarData, _avatarManager.getAvatarHash()) { | 570 | // push camera out of any intersecting avatars |
| 565 | Avatar* avatar = static_cast<Avatar*>(avatarData.data()); | 571 | foreach (const AvatarSharedPointer& avatarData, _avatarManager.getAvatarHash()) { |
| 566 | if (avatar->isMyAvatar()) { | 572 | Avatar* avatar = static_cast<Avatar*>(avatarData.data()); |
| 567 | continue; | 573 | if (avatar->isMyAvatar()) { |
| 568 | } | 574 | continue; |
| 569 | if (glm::distance(avatar->getPosition(), _myCamera.getTargetPosition()) > | 575 | } |
| 570 | avatar->getBoundingRadius() + pushbackRadius) { | 576 | if (glm::distance(avatar->getPosition(), _myCamera.getTargetPosition()) > |
| 571 | continue; | 577 | avatar->getBoundingRadius() + pushbackRadius) { |
| 572 | } | 578 | continue; |
| 573 | float angle = angleBetween(avatar->getPosition() - _myCamera.getTargetPosition(), planeNormal); | 579 | } |
| 574 | if (angle > PI_OVER_TWO) { | 580 | float angle = angleBetween(avatar->getPosition() - _myCamera.getTargetPosition(), planeNormal); |
| 575 | continue; | 581 | if (angle > PI_OVER_TWO) { |
| 576 | } | 582 | continue; |
| 577 | float scale = 1.0f - angle / PI_OVER_TWO; | 583 | } |
| 578 | scale = qMin(1.0f, scale * 2.5f); | 584 | float scale = 1.0f - angle / PI_OVER_TWO; |
| 579 | static CollisionList collisions(64); | 585 | scale = qMin(1.0f, scale * 2.5f); |
| 580 | collisions.clear(); | 586 | static CollisionList collisions(64); |
| 581 | if (!avatar->findPlaneCollisions(plane, collisions)) { | 587 | collisions.clear(); |
| 582 | continue; | 588 | if (!avatar->findPlaneCollisions(plane, collisions)) { |
| 583 | } | 589 | continue; |
| 584 | for (int i = 0; i < collisions.size(); i++) { | 590 | } |
| 585 | pushback = qMax(pushback, glm::length(collisions.getCollision(i)->_penetration) * scale); | 591 | for (int i = 0; i < collisions.size(); i++) { |
| 592 | pushback = qMax(pushback, glm::length(collisions.getCollision(i)->_penetration) * scale); | ||
| 593 | } | ||
| 586 | } | 594 | } |
| 595 | const float MAX_PUSHBACK = 0.35f; | ||
| 596 | pushback = qMin(pushback, MAX_PUSHBACK * _myAvatar->getScale()); | ||
| 597 | const float BASE_PUSHBACK_FOCAL_LENGTH = 0.5f; | ||
| 598 | pushbackFocalLength = BASE_PUSHBACK_FOCAL_LENGTH * _myAvatar->getScale(); | ||
| 587 | } | 599 | } |
| 588 | const float MAX_PUSHBACK = 0.35f; | ||
| 589 | pushback = qMin(pushback, MAX_PUSHBACK * _myAvatar->getScale()); | ||
| 590 | const float BASE_PUSHBACK_FOCAL_LENGTH = 0.5f; | ||
| 591 | pushbackFocalLength = BASE_PUSHBACK_FOCAL_LENGTH * _myAvatar->getScale(); | ||
| 592 | |||
| 593 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { | 600 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| 594 | _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing | 601 | _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing |
| 595 | _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition()); | 602 | _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition()); |
| @@ -3124,7 +3131,7 @@ void Application::updateWindowTitle(){ · 2528 unmodified lines | |||
| 3124 | QString buildVersion = " (build " + applicationVersion() + ")"; | 3131 | QString buildVersion = " (build " + applicationVersion() + ")"; |
| 3125 | NodeList* nodeList = NodeList::getInstance(); | 3132 | NodeList* nodeList = NodeList::getInstance(); |
| 3126 | 3133 | ||
| 3127 | QString username = AccountManager::getInstance().getUsername(); | 3134 | QString username = AccountManager::getInstance().getAccountInfo().getUsername(); |
| 3128 | QString title = QString() + (!username.isEmpty() ? username + " " : QString()) + nodeList->getSessionUUID().toString() | 3135 | QString title = QString() + (!username.isEmpty() ? username + " " : QString()) + nodeList->getSessionUUID().toString() |
| 3129 | + " @ " + nodeList->getDomainHandler().getHostname() + buildVersion; | 3136 | + " @ " + nodeList->getDomainHandler().getHostname() + buildVersion; |
| 3130 | qDebug("Application title set to: %s", title.toStdString().c_str()); | 3137 | qDebug("Application title set to: %s", title.toStdString().c_str()); |
| @@ -3150,6 +3157,9 @@ void Application::domainChanged(const QString& domainHostname) { · 19 unmodified lines | |||
| 3150 | 3157 | ||
| 3151 | // reset the voxels renderer | 3158 | // reset the voxels renderer |
| 3152 | _voxels.killLocalVoxels(); | 3159 | _voxels.killLocalVoxels(); |
| 3160 | |||
| 3161 | // reset the auth URL for OAuth web view handler | ||
| 3162 | OAuthWebViewHandler::getInstance().clearLastAuthorizationURL(); | ||
| 3153 | } | 3163 | } |
| 3154 | 3164 | ||
| 3155 | void Application::connectedToDomain(const QString& hostname) { | 3165 | void Application::connectedToDomain(const QString& hostname) { |