History

merge upstream/master into andrew/bispinor

Andrew Meadows committed 11 years ago

Commit d5119b32 parents 0a04dc8 81cd3e998 files · +3172 −867Browse files

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

Unified · Split

interface/src/Application.cpp+66−15
@@ -91,6 +91,7 @@ · 90 unmodified lines
9191 #include "devices/DdeFaceTracker.h"
9292 #include "devices/Faceshift.h"
9393 #include "devices/Leapmotion.h"
94+#include "devices/RealSense.h"
9495 #include "devices/MIDIManager.h"
9596 #include "devices/OculusManager.h"
9697 #include "devices/TV3DManager.h"
@@ -254,6 +255,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 157 unmodified lines
254255
255256 qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
256257
258+ _bookmarks = new Bookmarks(); // Before setting up the menu
259+
257260 // call Menu getInstance static method to set up the menu
258261 _window->setMenuBar(Menu::getInstance());
259262
@@ -333,6 +336,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 73 unmodified lines
333336 // use our MyAvatar position and quat for address manager path
334337 addressManager->setPositionGetter(getPositionForPath);
335338 addressManager->setOrientationGetter(getOrientationForPath);
339+
340+ connect(addressManager.data(), &AddressManager::rootPlaceNameChanged, this, &Application::updateWindowTitle);
336341
337342 _settings = new QSettings(this);
338343 _numChangedSettings = 0;
@@ -911,13 +916,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 572 unmodified lines
911916 Menu::getInstance()->triggerOption(MenuOption::Chat);
912917 break;
913918
914− case Qt::Key_N:
915− if (isMeta) {
916− Menu::getInstance()->triggerOption(MenuOption::NameLocation);
917− }
918−
919− break;
920−
921919 case Qt::Key_Up:
922920 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
923921 if (!isShifted) {
@@ -1683,6 +1681,7 @@ void Application::init() { · 759 unmodified lines
16831681 DependencyManager::get<Visage>()->init();
16841682
16851683 Leapmotion::init();
1684+ RealSense::init();
16861685
16871686 // fire off an immediate domain-server check in now that settings are loaded
16881687 DependencyManager::get<NodeList>()->sendDomainServerCheckIn();
@@ -2129,12 +2128,17 @@ void Application::updateMyAvatar(float deltaTime) { · 440 unmodified lines
21292128
21302129 _myAvatar->update(deltaTime);
21312130
2132− {
2131+ quint64 now = usecTimestampNow();
2132+ quint64 dt = now - _lastSendAvatarDataTime;
2133+
2134+ if (dt > MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS) {
21332135 // send head/hand data to the avatar mixer and voxel server
21342136 PerformanceTimer perfTimer("send");
21352137 QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData);
21362138 packet.append(_myAvatar->toByteArray());
21372139 controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer);
2140+
2141+ _lastSendAvatarDataTime = now;
21382142 }
21392143 }
21402144
@@ -2787,7 +2791,7 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 646 unmodified lines
27872791 }
27882792 glEnable(GL_LIGHTING);
27892793 glEnable(GL_DEPTH_TEST);
2790−
2794+
27912795 DependencyManager::get<DeferredLightingEffect>()->prepare();
27922796
27932797 if (!selfAvatarOnly) {
@@ -2838,6 +2842,8 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 44 unmodified lines
28382842
28392843
28402844 {
2845+ DependencyManager::get<DeferredLightingEffect>()->setAmbientLightMode(getRenderAmbientLight());
2846+
28412847 PROFILE_RANGE("DeferredLighting");
28422848 PerformanceTimer perfTimer("lighting");
28432849 DependencyManager::get<DeferredLightingEffect>()->render();
@@ -3136,8 +3142,14 @@ void Application::updateWindowTitle(){ · 292 unmodified lines
31363142
31373143 QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) ";
31383144 QString username = AccountManager::getInstance().getAccountInfo().getUsername();
3145+ QString currentPlaceName = DependencyManager::get<AddressManager>()->getRootPlaceName();
3146+
3147+ if (currentPlaceName.isEmpty()) {
3148+ currentPlaceName = nodeList->getDomainHandler().getHostname();
3149+ }
3150+
31393151 QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
3140− + DependencyManager::get<AddressManager>()->getCurrentDomain() + connectionStatus + buildVersion;
3152+ + currentPlaceName + connectionStatus + buildVersion;
31413153
31423154 #ifndef WIN32
31433155 // crashes with vs2013/win32
@@ -3149,23 +3161,34 @@ void Application::updateWindowTitle(){ · 5 unmodified lines
31493161 void Application::updateLocationInServer() {
31503162
31513163 AccountManager& accountManager = AccountManager::getInstance();
3164+ auto addressManager = DependencyManager::get<AddressManager>();
31523165 DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
31533166
3154− if (accountManager.isLoggedIn() && domainHandler.isConnected() && !domainHandler.getUUID().isNull()) {
3167+ if (accountManager.isLoggedIn() && domainHandler.isConnected()
3168+ && (!addressManager->getRootPlaceID().isNull() || !domainHandler.getUUID().isNull())) {
31553169
31563170 // construct a QJsonObject given the user's current address information
31573171 QJsonObject rootObject;
31583172
31593173 QJsonObject locationObject;
31603174
3161− QString pathString = DependencyManager::get<AddressManager>()->currentPath();
3175+ QString pathString = addressManager->currentPath();
31623176
31633177 const QString LOCATION_KEY_IN_ROOT = "location";
3164− const QString PATH_KEY_IN_LOCATION = "path";
3165− const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id";
31663178
3179+ const QString PATH_KEY_IN_LOCATION = "path";
31673180 locationObject.insert(PATH_KEY_IN_LOCATION, pathString);
3168− locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION, domainHandler.getUUID().toString());
3181+
3182+ if (!addressManager->getRootPlaceID().isNull()) {
3183+ const QString PLACE_ID_KEY_IN_LOCATION = "place_id";
3184+ locationObject.insert(PLACE_ID_KEY_IN_LOCATION,
3185+ uuidStringWithoutCurlyBraces(addressManager->getRootPlaceID()));
3186+
3187+ } else {
3188+ const QString DOMAIN_ID_KEY_IN_LOCATION = "domain_id";
3189+ locationObject.insert(DOMAIN_ID_KEY_IN_LOCATION,
3190+ uuidStringWithoutCurlyBraces(domainHandler.getUUID()));
3191+ }
31693192
31703193 rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject);
31713194
@@ -3946,3 +3969,31 @@ float Application::getRenderResolutionScale() const { · 774 unmodified lines
39463969 return 1.0f;
39473970 }
39483971 }
3972+
3973+int Application::getRenderAmbientLight() const {
3974+ if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLightGlobal)) {
3975+ return -1;
3976+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight0)) {
3977+ return 0;
3978+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight1)) {
3979+ return 1;
3980+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight2)) {
3981+ return 2;
3982+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight3)) {
3983+ return 3;
3984+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight4)) {
3985+ return 4;
3986+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight5)) {
3987+ return 5;
3988+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight6)) {
3989+ return 6;
3990+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight7)) {
3991+ return 7;
3992+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight8)) {
3993+ return 8;
3994+ } else if (Menu::getInstance()->isOptionChecked(MenuOption::RenderAmbientLight9)) {
3995+ return 9;
3996+ } else {
3997+ return -1;
3998+ }
3999+}

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