History

Merge branch 'master' into oculus_old_renderer

Bradley Austin Davis committed 11 years ago

Commit 5e5bdec2 parents 1d56266 10af592126 files · +5432 −4193Browse files

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

Unified · Split

interface/src/Application.cpp+35−30
@@ -297,7 +297,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 296 unmodified lines
297297 _lastSendDownstreamAudioStats(usecTimestampNow()),
298298 _isVSyncOn(true),
299299 _aboutToQuit(false),
300− _notifiedPacketVersionMismatchThisDomain(false)
300+ _notifiedPacketVersionMismatchThisDomain(false),
301+ _domainConnectionRefusals(QList<QString>())
301302 {
302303 #ifdef Q_OS_WIN
303304 installNativeEventFilter(&MyNativeEventFilter::getInstance());
@@ -344,6 +345,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 40 unmodified lines
344345 // put the NodeList and datagram processing on the node thread
345346 nodeList->moveToThread(nodeThread);
346347
348+ // geometry background downloads need to happen on the Datagram Processor Thread. The idle loop will
349+ // emit checkBackgroundDownloads to cause the GeometryCache to check it's queue for requested background
350+ // downloads.
351+ QSharedPointer<GeometryCache> geometryCacheP = DependencyManager::get<GeometryCache>();
352+ ResourceCache *geometryCache = geometryCacheP.data();
353+ connect(this, &Application::checkBackgroundDownloads, geometryCache, &ResourceCache::checkAsynchronousGets);
354+
347355 // connect the DataProcessor processDatagrams slot to the QUDPSocket readyRead() signal
348356 connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, _datagramProcessor, &DatagramProcessor::processDatagrams);
349357
@@ -382,6 +390,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 32 unmodified lines
382390 auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>();
383391 connect(locationUpdateTimer, &QTimer::timeout, discoverabilityManager.data(), &DiscoverabilityManager::updateLocation);
384392 locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS);
393+
394+ // if we get a domain change, immediately attempt update location in metaverse server
395+ connect(&nodeList->getDomainHandler(), &DomainHandler::connectedToDomain,
396+ discoverabilityManager.data(), &DiscoverabilityManager::updateLocation);
385397
386398 connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded);
387399 connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled);
@@ -781,7 +793,7 @@ void Application::paintGL() { · 393 unmodified lines
781793
782794 DependencyManager::get<GlowEffect>()->render();
783795
784− if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) {
796+ {
785797 PerformanceTimer perfTimer("renderOverlay");
786798 _applicationOverlay.renderOverlay(true);
787799 _applicationOverlay.displayOverlayTexture();
@@ -979,12 +991,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 191 unmodified lines
979991 resetSensors();
980992 break;
981993
982− case Qt::Key_G:
983− if (isShifted) {
984− Menu::getInstance()->triggerOption(MenuOption::ObeyEnvironmentalGravity);
985− }
986− break;
987−
988994 case Qt::Key_A:
989995 if (isShifted) {
990996 Menu::getInstance()->triggerOption(MenuOption::Atmosphere);
@@ -1119,13 +1125,10 @@ void Application::keyPressEvent(QKeyEvent* event) { · 128 unmodified lines
11191125 Menu::getInstance()->triggerOption(MenuOption::FullscreenMirror);
11201126 }
11211127 break;
1122− case Qt::Key_Slash:
1123− Menu::getInstance()->triggerOption(MenuOption::UserInterface);
1124− break;
11251128 case Qt::Key_P:
11261129 Menu::getInstance()->triggerOption(MenuOption::FirstPerson);
11271130 break;
1128− case Qt::Key_Percent:
1131+ case Qt::Key_Slash:
11291132 Menu::getInstance()->triggerOption(MenuOption::Stats);
11301133 break;
11311134 case Qt::Key_Plus:
@@ -1160,10 +1163,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 28 unmodified lines
11601163 break;
11611164 }
11621165
1163− case Qt::Key_Comma: {
1164− _myAvatar->togglePhysicsEnabled();
1165− }
1166−
11671166 default:
11681167 event->ignore();
11691168 break;
@@ -1561,6 +1560,9 @@ void Application::idle() { · 391 unmodified lines
15611560 idleTimer->start(2);
15621561 }
15631562 }
1563+
1564+ // check for any requested background downloads.
1565+ emit checkBackgroundDownloads();
15641566 }
15651567
15661568 void Application::setFullscreen(bool fullscreen) {
@@ -1747,7 +1749,7 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt · 180 unmodified lines
17471749 exportTree.addEntity(entityItem->getEntityItemID(), properties);
17481750 }
17491751
1750− exportTree.writeToSVOFile(filename.toLocal8Bit().constData());
1752+ exportTree.writeToJSONFile(filename.toLocal8Bit().constData());
17511753
17521754 // restore the main window's active state
17531755 _window->activateWindow();
@@ -1782,6 +1784,7 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa · 28 unmodified lines
17821784 void Application::loadSettings() {
17831785
17841786 DependencyManager::get<AudioClient>()->loadSettings();
1787+ DependencyManager::get<LODManager>()->loadSettings();
17851788
17861789 Menu::getInstance()->loadSettings();
17871790 _myAvatar->loadData();
@@ -1789,6 +1792,7 @@ void Application::loadSettings() { · 1 unmodified line
17891792
17901793 void Application::saveSettings() {
17911794 DependencyManager::get<AudioClient>()->saveSettings();
1795+ DependencyManager::get<LODManager>()->saveSettings();
17921796
17931797 Menu::getInstance()->saveSettings();
17941798 _myAvatar->saveData();
@@ -1899,8 +1903,6 @@ void Application::init() { · 104 unmodified lines
18991903 _physicsEngine.init(&_entityEditSender);
19001904
19011905
1902− _physicsEngine.setAvatarData(_myAvatar);
1903−
19041906 auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
19051907
19061908 connect(&_physicsEngine, &EntitySimulation::entityCollisionWithEntity,
@@ -1965,7 +1967,7 @@ bool Application::isLookingAtMyAvatar(Avatar* avatar) { · 58 unmodified lines
19651967 void Application::updateLOD() {
19661968 PerformanceTimer perfTimer("LOD");
19671969 // adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode
1968− if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD) && !isThrottleRendering()) {
1970+ if (!isThrottleRendering()) {
19691971 DependencyManager::get<LODManager>()->autoAdjustLOD(_fps);
19701972 } else {
19711973 DependencyManager::get<LODManager>()->resetLODAdjust();
@@ -3010,8 +3012,7 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 1038 unmodified lines
30103012 _nodeBoundsDisplay.draw();
30113013
30123014 // Render the world box
3013− if (theCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
3014− Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) {
3015+ if (theCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
30153016 PerformanceTimer perfTimer("worldBox");
30163017 renderWorldBox();
30173018 }
@@ -3131,7 +3132,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 113 unmodified lines
31313132 int viewport[4];
31323133 glGetIntegerv(GL_VIEWPORT, viewport);
31333134
3134− bool eyeRelativeCamera = false;
3135+ // bool eyeRelativeCamera = false;
31353136 if (billboard) {
31363137 _mirrorCamera.setFieldOfView(BILLBOARD_FIELD_OF_VIEW); // degees
31373138 _mirrorCamera.setPosition(_myAvatar->getPosition() +
@@ -3284,6 +3285,14 @@ void Application::clearDomainOctreeDetails() { · 146 unmodified lines
32843285 void Application::domainChanged(const QString& domainHostname) {
32853286 updateWindowTitle();
32863287 clearDomainOctreeDetails();
3288+ _domainConnectionRefusals.clear();
3289+}
3290+
3291+void Application::domainConnectionDenied(const QString& reason) {
3292+ if (!_domainConnectionRefusals.contains(reason)) {
3293+ _domainConnectionRefusals.append(reason);
3294+ emit domainConnectionRefused(reason);
3295+ }
32873296 }
32883297
32893298 void Application::connectedToDomain(const QString& hostname) {
@@ -3291,11 +3300,6 @@ void Application::connectedToDomain(const QString& hostname) { · 1 unmodified line
32913300 const QUuid& domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID();
32923301
32933302 if (accountManager.isLoggedIn() && !domainID.isNull()) {
3294− // update our data-server with the domain-server we're logged in with
3295− QString domainPutJsonString = "{\"location\":{\"domain_id\":\"" + uuidStringWithoutCurlyBraces(domainID) + "\"}}";
3296− accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation,
3297− JSONCallbackParameters(), domainPutJsonString.toUtf8());
3298−
32993303 _notifiedPacketVersionMismatchThisDomain = false;
33003304 }
33013305 }
@@ -3595,6 +3599,7 @@ void Application::initializeAcceptedFiles() { · 293 unmodified lines
35953599 if (_acceptedExtensions.size() == 0) {
35963600 _acceptedExtensions[SNAPSHOT_EXTENSION] = &Application::acceptSnapshot;
35973601 _acceptedExtensions[SVO_EXTENSION] = &Application::importSVOFromURL;
3602+ _acceptedExtensions[SVO_JSON_EXTENSION] = &Application::importSVOFromURL;
35983603 _acceptedExtensions[JS_EXTENSION] = &Application::askToLoadScript;
35993604 _acceptedExtensions[FST_EXTENSION] = &Application::askToSetAvatarUrl;
36003605 }
@@ -4203,7 +4208,7 @@ void Application::checkSkeleton() { · 602 unmodified lines
42034208 _myAvatar->setSkeletonModelURL(DEFAULT_BODY_MODEL_URL);
42044209 _myAvatar->sendIdentityPacket();
42054210 } else {
4206− _myAvatar->updateLocalAABox();
4207− _physicsEngine.setAvatarData(_myAvatar);
4211+ _myAvatar->updateCharacterController();
4212+ _physicsEngine.setCharacterController(_myAvatar->getCharacterController());
42084213 }
42094214 }