Showing the changes to interface/src/Application.cpp (1 of 102 files). Show all
Unified · Split
| @@ -71,7 +71,6 @@ · 70 unmodified lines | ||
| 71 | 71 | #include "InterfaceVersion.h" |
| 72 | 72 | #include "Menu.h" |
| 73 | 73 | #include "ModelUploader.h" |
| 74 | −#include "PaymentManager.h" | |
| 75 | 74 | #include "Util.h" |
| 76 | 75 | #include "devices/MIDIManager.h" |
| 77 | 76 | #include "devices/OculusManager.h" |
| @@ -89,7 +88,6 @@ · 11 unmodified lines | ||
| 89 | 88 | #include "scripting/WindowScriptingInterface.h" |
| 90 | 89 | |
| 91 | 90 | #include "ui/InfoView.h" |
| 92 | −#include "ui/OAuthWebViewHandler.h" | |
| 93 | 91 | #include "ui/Snapshot.h" |
| 94 | 92 | #include "ui/Stats.h" |
| 95 | 93 | #include "ui/TextRenderer.h" |
| @@ -178,7 +176,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 82 unmodified lines | ||
| 178 | 176 | _runningScriptsWidgetWasVisible(false), |
| 179 | 177 | _trayIcon(new QSystemTrayIcon(_window)), |
| 180 | 178 | _lastNackTime(usecTimestampNow()), |
| 181 | − _lastSendDownstreamAudioStats(usecTimestampNow()) | |
| 179 | + _lastSendDownstreamAudioStats(usecTimestampNow()), | |
| 180 | + _renderResolutionScale(1.0f) | |
| 182 | 181 | { |
| 183 | 182 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| 184 | 183 | QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); |
| @@ -186,8 +185,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 1 unmodified line | ||
| 186 | 185 | // set the associated application properties |
| 187 | 186 | applicationInfo.beginGroup("INFO"); |
| 188 | 187 | |
| 189 | − qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion()); | |
| 190 | − | |
| 191 | 188 | setApplicationName(applicationInfo.value("name").toString()); |
| 192 | 189 | setApplicationVersion(BUILD_VERSION); |
| 193 | 190 | setOrganizationName(applicationInfo.value("organizationName").toString()); |
| @@ -206,6 +203,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 12 unmodified lines | ||
| 206 | 203 | |
| 207 | 204 | qInstallMessageHandler(messageHandler); |
| 208 | 205 | |
| 206 | + qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion()); | |
| 207 | + | |
| 209 | 208 | // call Menu getInstance static method to set up the menu |
| 210 | 209 | _window->setMenuBar(Menu::getInstance()); |
| 211 | 210 | |
| @@ -218,10 +217,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 6 unmodified lines | ||
| 218 | 217 | listenPort = atoi(portStr); |
| 219 | 218 | } |
| 220 | 219 | |
| 221 | − // call the OAuthWebviewHandler static getter so that its instance lives in our thread | |
| 222 | − // make sure it is ready before the NodeList might need it | |
| 223 | − OAuthWebViewHandler::getInstance(); | |
| 224 | − | |
| 225 | 220 | // start the nodeThread so its event loop is running |
| 226 | 221 | _nodeThread->start(); |
| 227 | 222 | |
| @@ -254,11 +249,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 26 unmodified lines | ||
| 254 | 249 | connect(&domainHandler, &DomainHandler::settingsReceived, this, &Application::domainSettingsReceived); |
| 255 | 250 | connect(&domainHandler, &DomainHandler::hostnameChanged, Menu::getInstance(), &Menu::clearLoginDialogDisplayedFlag); |
| 256 | 251 | |
| 257 | − // hookup VoxelEditSender to PaymentManager so we can pay for octree edits | |
| 258 | − const PaymentManager& paymentManager = PaymentManager::getInstance(); | |
| 259 | − connect(&_voxelEditSender, &VoxelEditPacketSender::octreePaymentRequired, | |
| 260 | − &paymentManager, &PaymentManager::sendSignedPayment); | |
| 261 | − | |
| 262 | 252 | // update our location every 5 seconds in the data-server, assuming that we are authenticated with one |
| 263 | 253 | const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000; |
| 264 | 254 | |
| @@ -589,7 +579,8 @@ void Application::paintGL() { · 324 unmodified lines | ||
| 589 | 579 | if (OculusManager::isConnected()) { |
| 590 | 580 | _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize()); |
| 591 | 581 | } else { |
| 592 | − _textureCache.setFrameBufferSize(_glWidget->getDeviceSize()); | |
| 582 | + QSize fbSize = _glWidget->getDeviceSize() * _renderResolutionScale; | |
| 583 | + _textureCache.setFrameBufferSize(fbSize); | |
| 593 | 584 | } |
| 594 | 585 | |
| 595 | 586 | glEnable(GL_LINE_SMOOTH); |
| @@ -687,6 +678,10 @@ void Application::paintGL() { · 91 unmodified lines | ||
| 687 | 678 | } else { |
| 688 | 679 | _glowEffect.prepare(); |
| 689 | 680 | |
| 681 | + // Viewport is assigned to the size of the framebuffer | |
| 682 | + QSize size = Application::getInstance()->getTextureCache()->getPrimaryFramebufferObject()->size(); | |
| 683 | + glViewport(0, 0, size.width(), size.height()); | |
| 684 | + | |
| 690 | 685 | glMatrixMode(GL_MODELVIEW); |
| 691 | 686 | glPushMatrix(); |
| 692 | 687 | glLoadIdentity(); |
| @@ -1541,9 +1536,8 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox · 848 unmodified lines | ||
| 1541 | 1536 | |
| 1542 | 1537 | FaceTracker* Application::getActiveFaceTracker() { |
| 1543 | 1538 | return (_dde.isActive() ? static_cast<FaceTracker*>(&_dde) : |
| 1544 | − (_faceshift.isActive() ? static_cast<FaceTracker*>(&_faceshift) : | |
| 1545 | − (_faceplus.isActive() ? static_cast<FaceTracker*>(&_faceplus) : | |
| 1546 | − (_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL)))); | |
| 1539 | + (_faceshift.isActive() ? static_cast<FaceTracker*>(&_faceshift) : | |
| 1540 | + (_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL))); | |
| 1547 | 1541 | } |
| 1548 | 1542 | |
| 1549 | 1543 | struct SendVoxelsOperationArgs { |
| @@ -1831,7 +1825,6 @@ void Application::init() { · 281 unmodified lines | ||
| 1831 | 1825 | |
| 1832 | 1826 | // initialize our face trackers after loading the menu settings |
| 1833 | 1827 | _faceshift.init(); |
| 1834 | − _faceplus.init(); | |
| 1835 | 1828 | _visage.init(); |
| 1836 | 1829 | |
| 1837 | 1830 | Leapmotion::init(); |
| @@ -3045,6 +3038,10 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { · 1207 unmodified lines | ||
| 3045 | 3038 | } |
| 3046 | 3039 | |
| 3047 | 3040 | void Application::renderRearViewMirror(const QRect& region, bool billboard) { |
| 3041 | + // Grab current viewport to reset it at the end | |
| 3042 | + int viewport[4]; | |
| 3043 | + glGetIntegerv(GL_VIEWPORT, viewport); | |
| 3044 | + | |
| 3048 | 3045 | bool eyeRelativeCamera = false; |
| 3049 | 3046 | if (billboard) { |
| 3050 | 3047 | _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees |
| @@ -3076,14 +3073,17 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 25 unmodified lines | ||
| 3076 | 3073 | |
| 3077 | 3074 | // set the bounds of rear mirror view |
| 3078 | 3075 | if (billboard) { |
| 3079 | − glViewport(region.x(), _glWidget->getDeviceHeight() - region.y() - region.height(), region.width(), region.height()); | |
| 3080 | − glScissor(region.x(), _glWidget->getDeviceHeight() - region.y() - region.height(), region.width(), region.height()); | |
| 3076 | + QSize size = getTextureCache()->getFrameBufferSize(); | |
| 3077 | + glViewport(region.x(), size.height() - region.y() - region.height(), region.width(), region.height()); | |
| 3078 | + glScissor(region.x(), size.height() - region.y() - region.height(), region.width(), region.height()); | |
| 3081 | 3079 | } else { |
| 3082 | 3080 | // if not rendering the billboard, the region is in device independent coordinates; must convert to device |
| 3081 | + QSize size = getTextureCache()->getFrameBufferSize(); | |
| 3083 | 3082 | float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio(); |
| 3083 | + ratio = size.height() / (float)_glWidget->getDeviceHeight(); | |
| 3084 | 3084 | int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio; |
| 3085 | − glViewport(x, _glWidget->getDeviceHeight() - y - height, width, height); | |
| 3086 | − glScissor(x, _glWidget->getDeviceHeight() - y - height, width, height); | |
| 3085 | + glViewport(x, size.height() - y - height, width, height); | |
| 3086 | + glScissor(x, size.height() - y - height, width, height); | |
| 3087 | 3087 | } |
| 3088 | 3088 | bool updateViewFrustum = false; |
| 3089 | 3089 | updateProjectionMatrix(_mirrorCamera, updateViewFrustum); |
| @@ -3151,7 +3151,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 61 unmodified lines | ||
| 3151 | 3151 | } |
| 3152 | 3152 | |
| 3153 | 3153 | // reset Viewport and projection matrix |
| 3154 | − glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | |
| 3154 | + glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); | |
| 3155 | 3155 | glDisable(GL_SCISSOR_TEST); |
| 3156 | 3156 | updateProjectionMatrix(_myCamera, updateViewFrustum); |
| 3157 | 3157 | } |
| @@ -3336,7 +3336,6 @@ void Application::resetSensors() { · 178 unmodified lines | ||
| 3336 | 3336 | _mouseX = _glWidget->width() / 2; |
| 3337 | 3337 | _mouseY = _glWidget->height() / 2; |
| 3338 | 3338 | |
| 3339 | − _faceplus.reset(); | |
| 3340 | 3339 | _faceshift.reset(); |
| 3341 | 3340 | _visage.reset(); |
| 3342 | 3341 | _dde.reset(); |
| @@ -3431,7 +3430,7 @@ void Application::updateLocationInServer() { · 88 unmodified lines | ||
| 3431 | 3430 | |
| 3432 | 3431 | rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject); |
| 3433 | 3432 | |
| 3434 | − accountManager.authenticatedRequest("/api/v1/users/location", QNetworkAccessManager::PutOperation, | |
| 3433 | + accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation, | |
| 3435 | 3434 | JSONCallbackParameters(), QJsonDocument(rootObject).toJson()); |
| 3436 | 3435 | } |
| 3437 | 3436 | } |
| @@ -3467,20 +3466,18 @@ void Application::domainChanged(const QString& domainHostname) { · 29 unmodified lines | ||
| 3467 | 3466 | |
| 3468 | 3467 | // reset the voxels renderer |
| 3469 | 3468 | _voxels.killLocalVoxels(); |
| 3470 | − | |
| 3471 | − // reset the auth URL for OAuth web view handler | |
| 3472 | − OAuthWebViewHandler::getInstance().clearLastAuthorizationURL(); | |
| 3473 | 3469 | } |
| 3474 | 3470 | |
| 3475 | 3471 | void Application::connectedToDomain(const QString& hostname) { |
| 3476 | 3472 | AccountManager& accountManager = AccountManager::getInstance(); |
| 3473 | + const QUuid& domainID = NodeList::getInstance()->getDomainHandler().getUUID(); | |
| 3474 | + | |
| 3475 | + if (accountManager.isLoggedIn() && !domainID.isNull()) { | |
| 3476 | + // update our data-server with the domain-server we're logged in with | |
| 3477 | 3477 | |
| 3478 | − if (accountManager.isLoggedIn()) { | |
| 3479 | − // update our domain-server with the data-server we're logged in with | |
| 3480 | − | |
| 3481 | − QString domainPutJsonString = "{\"address\":{\"domain\":\"" + hostname + "\"}}"; | |
| 3478 | + QString domainPutJsonString = "{\"location\":{\"domain_id\":\"" + uuidStringWithoutCurlyBraces(domainID) + "\"}}"; | |
| 3482 | 3479 | |
| 3483 | − accountManager.authenticatedRequest("/api/v1/users/address", QNetworkAccessManager::PutOperation, | |
| 3480 | + accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation, | |
| 3484 | 3481 | JSONCallbackParameters(), domainPutJsonString.toUtf8()); |
| 3485 | 3482 | } |
| 3486 | 3483 | } |
| @@ -4137,3 +4134,7 @@ void Application::takeSnapshot() { · 650 unmodified lines | ||
| 4137 | 4134 | } |
| 4138 | 4135 | _snapshotShareDialog->show(); |
| 4139 | 4136 | } |
| 4137 | + | |
| 4138 | +void Application::setRenderResolutionScale(float scale) { | |
| 4139 | + _renderResolutionScale = scale; | |
| 4140 | +} | |