History

Merge branch 'master' of https://github.com/highfidelity/hifi into removeParticles

ZappoMan committed 12 years ago

Commit fc507852 parents d886f4c a46610a102 files · +2684 −3930Browse files

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

Unified · Split

interface/src/Application.cpp+35−34
@@ -71,7 +71,6 @@ · 70 unmodified lines
7171 #include "InterfaceVersion.h"
7272 #include "Menu.h"
7373 #include "ModelUploader.h"
74−#include "PaymentManager.h"
7574 #include "Util.h"
7675 #include "devices/MIDIManager.h"
7776 #include "devices/OculusManager.h"
@@ -89,7 +88,6 @@ · 11 unmodified lines
8988 #include "scripting/WindowScriptingInterface.h"
9089
9190 #include "ui/InfoView.h"
92−#include "ui/OAuthWebViewHandler.h"
9391 #include "ui/Snapshot.h"
9492 #include "ui/Stats.h"
9593 #include "ui/TextRenderer.h"
@@ -178,7 +176,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 82 unmodified lines
178176 _runningScriptsWidgetWasVisible(false),
179177 _trayIcon(new QSystemTrayIcon(_window)),
180178 _lastNackTime(usecTimestampNow()),
181− _lastSendDownstreamAudioStats(usecTimestampNow())
179+ _lastSendDownstreamAudioStats(usecTimestampNow()),
180+ _renderResolutionScale(1.0f)
182181 {
183182 // read the ApplicationInfo.ini file for Name/Version/Domain information
184183 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
186185 // set the associated application properties
187186 applicationInfo.beginGroup("INFO");
188187
189− qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
190−
191188 setApplicationName(applicationInfo.value("name").toString());
192189 setApplicationVersion(BUILD_VERSION);
193190 setOrganizationName(applicationInfo.value("organizationName").toString());
@@ -206,6 +203,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 12 unmodified lines
206203
207204 qInstallMessageHandler(messageHandler);
208205
206+ qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
207+
209208 // call Menu getInstance static method to set up the menu
210209 _window->setMenuBar(Menu::getInstance());
211210
@@ -218,10 +217,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 6 unmodified lines
218217 listenPort = atoi(portStr);
219218 }
220219
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−
225220 // start the nodeThread so its event loop is running
226221 _nodeThread->start();
227222
@@ -254,11 +249,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 26 unmodified lines
254249 connect(&domainHandler, &DomainHandler::settingsReceived, this, &Application::domainSettingsReceived);
255250 connect(&domainHandler, &DomainHandler::hostnameChanged, Menu::getInstance(), &Menu::clearLoginDialogDisplayedFlag);
256251
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−
262252 // update our location every 5 seconds in the data-server, assuming that we are authenticated with one
263253 const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000;
264254
@@ -589,7 +579,8 @@ void Application::paintGL() { · 324 unmodified lines
589579 if (OculusManager::isConnected()) {
590580 _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize());
591581 } else {
592− _textureCache.setFrameBufferSize(_glWidget->getDeviceSize());
582+ QSize fbSize = _glWidget->getDeviceSize() * _renderResolutionScale;
583+ _textureCache.setFrameBufferSize(fbSize);
593584 }
594585
595586 glEnable(GL_LINE_SMOOTH);
@@ -687,6 +678,10 @@ void Application::paintGL() { · 91 unmodified lines
687678 } else {
688679 _glowEffect.prepare();
689680
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+
690685 glMatrixMode(GL_MODELVIEW);
691686 glPushMatrix();
692687 glLoadIdentity();
@@ -1541,9 +1536,8 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox · 848 unmodified lines
15411536
15421537 FaceTracker* Application::getActiveFaceTracker() {
15431538 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)));
15471541 }
15481542
15491543 struct SendVoxelsOperationArgs {
@@ -1831,7 +1825,6 @@ void Application::init() { · 281 unmodified lines
18311825
18321826 // initialize our face trackers after loading the menu settings
18331827 _faceshift.init();
1834− _faceplus.init();
18351828 _visage.init();
18361829
18371830 Leapmotion::init();
@@ -3045,6 +3038,10 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { · 1207 unmodified lines
30453038 }
30463039
30473040 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+
30483045 bool eyeRelativeCamera = false;
30493046 if (billboard) {
30503047 _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees
@@ -3076,14 +3073,17 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 25 unmodified lines
30763073
30773074 // set the bounds of rear mirror view
30783075 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());
30813079 } else {
30823080 // if not rendering the billboard, the region is in device independent coordinates; must convert to device
3081+ QSize size = getTextureCache()->getFrameBufferSize();
30833082 float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio();
3083+ ratio = size.height() / (float)_glWidget->getDeviceHeight();
30843084 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);
30873087 }
30883088 bool updateViewFrustum = false;
30893089 updateProjectionMatrix(_mirrorCamera, updateViewFrustum);
@@ -3151,7 +3151,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 61 unmodified lines
31513151 }
31523152
31533153 // reset Viewport and projection matrix
3154− glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
3154+ glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
31553155 glDisable(GL_SCISSOR_TEST);
31563156 updateProjectionMatrix(_myCamera, updateViewFrustum);
31573157 }
@@ -3336,7 +3336,6 @@ void Application::resetSensors() { · 178 unmodified lines
33363336 _mouseX = _glWidget->width() / 2;
33373337 _mouseY = _glWidget->height() / 2;
33383338
3339− _faceplus.reset();
33403339 _faceshift.reset();
33413340 _visage.reset();
33423341 _dde.reset();
@@ -3431,7 +3430,7 @@ void Application::updateLocationInServer() { · 88 unmodified lines
34313430
34323431 rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject);
34333432
3434− accountManager.authenticatedRequest("/api/v1/users/location", QNetworkAccessManager::PutOperation,
3433+ accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation,
34353434 JSONCallbackParameters(), QJsonDocument(rootObject).toJson());
34363435 }
34373436 }
@@ -3467,20 +3466,18 @@ void Application::domainChanged(const QString& domainHostname) { · 29 unmodified lines
34673466
34683467 // reset the voxels renderer
34693468 _voxels.killLocalVoxels();
3470−
3471− // reset the auth URL for OAuth web view handler
3472− OAuthWebViewHandler::getInstance().clearLastAuthorizationURL();
34733469 }
34743470
34753471 void Application::connectedToDomain(const QString& hostname) {
34763472 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
34773477
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) + "\"}}";
34823479
3483− accountManager.authenticatedRequest("/api/v1/users/address", QNetworkAccessManager::PutOperation,
3480+ accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation,
34843481 JSONCallbackParameters(), domainPutJsonString.toUtf8());
34853482 }
34863483 }
@@ -4137,3 +4134,7 @@ void Application::takeSnapshot() { · 650 unmodified lines
41374134 }
41384135 _snapshotShareDialog->show();
41394136 }
4137+
4138+void Application::setRenderResolutionScale(float scale) {
4139+ _renderResolutionScale = scale;
4140+}

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