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
71#include "InterfaceVersion.h"71#include "InterfaceVersion.h"
72#include "Menu.h"72#include "Menu.h"
73#include "ModelUploader.h"73#include "ModelUploader.h"
74#include "PaymentManager.h"
75#include "Util.h"74#include "Util.h"
76#include "devices/MIDIManager.h"75#include "devices/MIDIManager.h"
77#include "devices/OculusManager.h"76#include "devices/OculusManager.h"
@@ -89,7 +88,6 @@ · 11 unmodified lines
89#include "scripting/WindowScriptingInterface.h"88#include "scripting/WindowScriptingInterface.h"
90 89
91#include "ui/InfoView.h"90#include "ui/InfoView.h"
92#include "ui/OAuthWebViewHandler.h"
93#include "ui/Snapshot.h"91#include "ui/Snapshot.h"
94#include "ui/Stats.h"92#include "ui/Stats.h"
95#include "ui/TextRenderer.h"93#include "ui/TextRenderer.h"
@@ -178,7 +176,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 82 unmodified lines
178 _runningScriptsWidgetWasVisible(false),176 _runningScriptsWidgetWasVisible(false),
179 _trayIcon(new QSystemTrayIcon(_window)),177 _trayIcon(new QSystemTrayIcon(_window)),
180 _lastNackTime(usecTimestampNow()),178 _lastNackTime(usecTimestampNow()),
181 _lastSendDownstreamAudioStats(usecTimestampNow())179 _lastSendDownstreamAudioStats(usecTimestampNow()),
180 _renderResolutionScale(1.0f)
182{181{
183 // read the ApplicationInfo.ini file for Name/Version/Domain information182 // read the ApplicationInfo.ini file for Name/Version/Domain information
184 QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);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 // set the associated application properties185 // set the associated application properties
187 applicationInfo.beginGroup("INFO");186 applicationInfo.beginGroup("INFO");
188 187
189 qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
190
191 setApplicationName(applicationInfo.value("name").toString());188 setApplicationName(applicationInfo.value("name").toString());
192 setApplicationVersion(BUILD_VERSION);189 setApplicationVersion(BUILD_VERSION);
193 setOrganizationName(applicationInfo.value("organizationName").toString());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 qInstallMessageHandler(messageHandler);204 qInstallMessageHandler(messageHandler);
208 205
206 qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
207
209 // call Menu getInstance static method to set up the menu208 // call Menu getInstance static method to set up the menu
210 _window->setMenuBar(Menu::getInstance());209 _window->setMenuBar(Menu::getInstance());
211 210
@@ -218,10 +217,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 6 unmodified lines
218 listenPort = atoi(portStr);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 // start the nodeThread so its event loop is running220 // start the nodeThread so its event loop is running
226 _nodeThread->start();221 _nodeThread->start();
227 222
@@ -254,11 +249,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 26 unmodified lines
254 connect(&domainHandler, &DomainHandler::settingsReceived, this, &Application::domainSettingsReceived);249 connect(&domainHandler, &DomainHandler::settingsReceived, this, &Application::domainSettingsReceived);
255 connect(&domainHandler, &DomainHandler::hostnameChanged, Menu::getInstance(), &Menu::clearLoginDialogDisplayedFlag);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 // update our location every 5 seconds in the data-server, assuming that we are authenticated with one252 // update our location every 5 seconds in the data-server, assuming that we are authenticated with one
263 const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000;253 const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000;
264 254
@@ -589,7 +579,8 @@ void Application::paintGL() { · 324 unmodified lines
589 if (OculusManager::isConnected()) {579 if (OculusManager::isConnected()) {
590 _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize());580 _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize());
591 } else {581 } else {
592 _textureCache.setFrameBufferSize(_glWidget->getDeviceSize());582 QSize fbSize = _glWidget->getDeviceSize() * _renderResolutionScale;
583 _textureCache.setFrameBufferSize(fbSize);
593 }584 }
594 585
595 glEnable(GL_LINE_SMOOTH);586 glEnable(GL_LINE_SMOOTH);
@@ -687,6 +678,10 @@ void Application::paintGL() { · 91 unmodified lines
687 } else {678 } else {
688 _glowEffect.prepare();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 glMatrixMode(GL_MODELVIEW);685 glMatrixMode(GL_MODELVIEW);
691 glPushMatrix();686 glPushMatrix();
692 glLoadIdentity();687 glLoadIdentity();
@@ -1541,9 +1536,8 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox · 848 unmodified lines
1541 1536
1542FaceTracker* Application::getActiveFaceTracker() {1537FaceTracker* Application::getActiveFaceTracker() {
1543 return (_dde.isActive() ? static_cast<FaceTracker*>(&_dde) :1538 return (_dde.isActive() ? static_cast<FaceTracker*>(&_dde) :
1544 (_faceshift.isActive() ? static_cast<FaceTracker*>(&_faceshift) :1539 (_faceshift.isActive() ? static_cast<FaceTracker*>(&_faceshift) :
1545 (_faceplus.isActive() ? static_cast<FaceTracker*>(&_faceplus) :1540 (_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL)));
1546 (_visage.isActive() ? static_cast<FaceTracker*>(&_visage) : NULL))));
1547}1541}
1548 1542
1549struct SendVoxelsOperationArgs {1543struct SendVoxelsOperationArgs {
@@ -1831,7 +1825,6 @@ void Application::init() { · 281 unmodified lines
1831 1825
1832 // initialize our face trackers after loading the menu settings1826 // initialize our face trackers after loading the menu settings
1833 _faceshift.init();1827 _faceshift.init();
1834 _faceplus.init();
1835 _visage.init();1828 _visage.init();
1836 1829
1837 Leapmotion::init();1830 Leapmotion::init();
@@ -3045,6 +3038,10 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { · 1207 unmodified lines
3045}3038}
3046 3039
3047void Application::renderRearViewMirror(const QRect& region, bool billboard) {3040void 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 bool eyeRelativeCamera = false;3045 bool eyeRelativeCamera = false;
3049 if (billboard) {3046 if (billboard) {
3050 _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees3047 _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 // set the bounds of rear mirror view3074 // set the bounds of rear mirror view
3078 if (billboard) {3075 if (billboard) {
3079 glViewport(region.x(), _glWidget->getDeviceHeight() - region.y() - region.height(), region.width(), region.height());3076 QSize size = getTextureCache()->getFrameBufferSize();
3080 glScissor(region.x(), _glWidget->getDeviceHeight() - region.y() - region.height(), region.width(), region.height()); 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 } else {3079 } else {
3082 // if not rendering the billboard, the region is in device independent coordinates; must convert to device3080 // if not rendering the billboard, the region is in device independent coordinates; must convert to device
3081 QSize size = getTextureCache()->getFrameBufferSize();
3083 float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio();3082 float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio();
3083 ratio = size.height() / (float)_glWidget->getDeviceHeight();
3084 int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio;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);3085 glViewport(x, size.height() - y - height, width, height);
3086 glScissor(x, _glWidget->getDeviceHeight() - y - height, width, height);3086 glScissor(x, size.height() - y - height, width, height);
3087 }3087 }
3088 bool updateViewFrustum = false;3088 bool updateViewFrustum = false;
3089 updateProjectionMatrix(_mirrorCamera, updateViewFrustum);3089 updateProjectionMatrix(_mirrorCamera, updateViewFrustum);
@@ -3151,7 +3151,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 61 unmodified lines
3151 }3151 }
3152 3152
3153 // reset Viewport and projection matrix3153 // reset Viewport and projection matrix
3154 glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());3154 glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
3155 glDisable(GL_SCISSOR_TEST);3155 glDisable(GL_SCISSOR_TEST);
3156 updateProjectionMatrix(_myCamera, updateViewFrustum);3156 updateProjectionMatrix(_myCamera, updateViewFrustum);
3157}3157}
@@ -3336,7 +3336,6 @@ void Application::resetSensors() { · 178 unmodified lines
3336 _mouseX = _glWidget->width() / 2;3336 _mouseX = _glWidget->width() / 2;
3337 _mouseY = _glWidget->height() / 2;3337 _mouseY = _glWidget->height() / 2;
3338 3338
3339 _faceplus.reset();
3340 _faceshift.reset();3339 _faceshift.reset();
3341 _visage.reset();3340 _visage.reset();
3342 _dde.reset();3341 _dde.reset();
@@ -3431,7 +3430,7 @@ void Application::updateLocationInServer() { · 88 unmodified lines
3431 3430
3432 rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject);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 JSONCallbackParameters(), QJsonDocument(rootObject).toJson());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 // reset the voxels renderer3467 // reset the voxels renderer
3469 _voxels.killLocalVoxels();3468 _voxels.killLocalVoxels();
3470
3471 // reset the auth URL for OAuth web view handler
3472 OAuthWebViewHandler::getInstance().clearLastAuthorizationURL();
3473}3469}
3474 3470
3475void Application::connectedToDomain(const QString& hostname) {3471void Application::connectedToDomain(const QString& hostname) {
3476 AccountManager& accountManager = AccountManager::getInstance();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()) {3478 QString domainPutJsonString = "{\"location\":{\"domain_id\":\"" + uuidStringWithoutCurlyBraces(domainID) + "\"}}";
3479 // update our domain-server with the data-server we're logged in with
3480
3481 QString domainPutJsonString = "{\"address\":{\"domain\":\"" + hostname + "\"}}";
3482 3479
3483 accountManager.authenticatedRequest("/api/v1/users/address", QNetworkAccessManager::PutOperation,3480 accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation,
3484 JSONCallbackParameters(), domainPutJsonString.toUtf8());3481 JSONCallbackParameters(), domainPutJsonString.toUtf8());
3485 }3482 }
3486}3483}
@@ -4137,3 +4134,7 @@ void Application::takeSnapshot() { · 650 unmodified lines
4137 }4134 }
4138 _snapshotShareDialog->show();4135 _snapshotShareDialog->show();
4139}4136}
4137
4138void 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