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
91#include "devices/DdeFaceTracker.h"91#include "devices/DdeFaceTracker.h"
92#include "devices/Faceshift.h"92#include "devices/Faceshift.h"
93#include "devices/Leapmotion.h"93#include "devices/Leapmotion.h"
94#include "devices/RealSense.h"
94#include "devices/MIDIManager.h"95#include "devices/MIDIManager.h"
95#include "devices/OculusManager.h"96#include "devices/OculusManager.h"
96#include "devices/TV3DManager.h"97#include "devices/TV3DManager.h"
@@ -254,6 +255,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 157 unmodified lines
254 255
255 qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());256 qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
256 257
258 _bookmarks = new Bookmarks(); // Before setting up the menu
259
257 // call Menu getInstance static method to set up the menu260 // call Menu getInstance static method to set up the menu
258 _window->setMenuBar(Menu::getInstance());261 _window->setMenuBar(Menu::getInstance());
259 262
@@ -333,6 +336,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 73 unmodified lines
333 // use our MyAvatar position and quat for address manager path336 // use our MyAvatar position and quat for address manager path
334 addressManager->setPositionGetter(getPositionForPath);337 addressManager->setPositionGetter(getPositionForPath);
335 addressManager->setOrientationGetter(getOrientationForPath);338 addressManager->setOrientationGetter(getOrientationForPath);
339
340 connect(addressManager.data(), &AddressManager::rootPlaceNameChanged, this, &Application::updateWindowTitle);
336 341
337 _settings = new QSettings(this);342 _settings = new QSettings(this);
338 _numChangedSettings = 0;343 _numChangedSettings = 0;
@@ -911,13 +916,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 572 unmodified lines
911 Menu::getInstance()->triggerOption(MenuOption::Chat);916 Menu::getInstance()->triggerOption(MenuOption::Chat);
912 break;917 break;
913 918
914 case Qt::Key_N:
915 if (isMeta) {
916 Menu::getInstance()->triggerOption(MenuOption::NameLocation);
917 }
918
919 break;
920
921 case Qt::Key_Up:919 case Qt::Key_Up:
922 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {920 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
923 if (!isShifted) {921 if (!isShifted) {
@@ -1683,6 +1681,7 @@ void Application::init() { · 759 unmodified lines
1683 DependencyManager::get<Visage>()->init();1681 DependencyManager::get<Visage>()->init();
1684 1682
1685 Leapmotion::init();1683 Leapmotion::init();
1684 RealSense::init();
1686 1685
1687 // fire off an immediate domain-server check in now that settings are loaded1686 // fire off an immediate domain-server check in now that settings are loaded
1688 DependencyManager::get<NodeList>()->sendDomainServerCheckIn();1687 DependencyManager::get<NodeList>()->sendDomainServerCheckIn();
@@ -2129,12 +2128,17 @@ void Application::updateMyAvatar(float deltaTime) { · 440 unmodified lines
2129 2128
2130 _myAvatar->update(deltaTime);2129 _myAvatar->update(deltaTime);
2131 2130
2132 {2131 quint64 now = usecTimestampNow();
2132 quint64 dt = now - _lastSendAvatarDataTime;
2133
2134 if (dt > MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS) {
2133 // send head/hand data to the avatar mixer and voxel server2135 // send head/hand data to the avatar mixer and voxel server
2134 PerformanceTimer perfTimer("send");2136 PerformanceTimer perfTimer("send");
2135 QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData);2137 QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData);
2136 packet.append(_myAvatar->toByteArray());2138 packet.append(_myAvatar->toByteArray());
2137 controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer);2139 controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer);
2140
2141 _lastSendAvatarDataTime = now;
2138 }2142 }
2139}2143}
2140 2144
@@ -2787,7 +2791,7 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 646 unmodified lines
2787 }2791 }
2788 glEnable(GL_LIGHTING);2792 glEnable(GL_LIGHTING);
2789 glEnable(GL_DEPTH_TEST);2793 glEnable(GL_DEPTH_TEST);
2790 2794
2791 DependencyManager::get<DeferredLightingEffect>()->prepare();2795 DependencyManager::get<DeferredLightingEffect>()->prepare();
2792 2796
2793 if (!selfAvatarOnly) {2797 if (!selfAvatarOnly) {
@@ -2838,6 +2842,8 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 44 unmodified lines
2838 2842
2839 2843
2840 {2844 {
2845 DependencyManager::get<DeferredLightingEffect>()->setAmbientLightMode(getRenderAmbientLight());
2846
2841 PROFILE_RANGE("DeferredLighting"); 2847 PROFILE_RANGE("DeferredLighting");
2842 PerformanceTimer perfTimer("lighting");2848 PerformanceTimer perfTimer("lighting");
2843 DependencyManager::get<DeferredLightingEffect>()->render();2849 DependencyManager::get<DeferredLightingEffect>()->render();
@@ -3136,8 +3142,14 @@ void Application::updateWindowTitle(){ · 292 unmodified lines
3136 3142
3137 QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) ";3143 QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) ";
3138 QString username = AccountManager::getInstance().getAccountInfo().getUsername();3144 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
3139 QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())3151 QString title = QString() + (!username.isEmpty() ? username + " @ " : QString())
3140 + DependencyManager::get<AddressManager>()->getCurrentDomain() + connectionStatus + buildVersion;3152 + currentPlaceName + connectionStatus + buildVersion;
3141 3153
3142#ifndef WIN323154#ifndef WIN32
3143 // crashes with vs2013/win323155 // crashes with vs2013/win32
@@ -3149,23 +3161,34 @@ void Application::updateWindowTitle(){ · 5 unmodified lines
3149void Application::updateLocationInServer() {3161void Application::updateLocationInServer() {
3150 3162
3151 AccountManager& accountManager = AccountManager::getInstance();3163 AccountManager& accountManager = AccountManager::getInstance();
3164 auto addressManager = DependencyManager::get<AddressManager>();
3152 DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();3165 DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
3153 3166
3154 if (accountManager.isLoggedIn() && domainHandler.isConnected() && !domainHandler.getUUID().isNull()) {3167 if (accountManager.isLoggedIn() && domainHandler.isConnected()
3168 && (!addressManager->getRootPlaceID().isNull() || !domainHandler.getUUID().isNull())) {
3155 3169
3156 // construct a QJsonObject given the user's current address information3170 // construct a QJsonObject given the user's current address information
3157 QJsonObject rootObject;3171 QJsonObject rootObject;
3158 3172
3159 QJsonObject locationObject;3173 QJsonObject locationObject;
3160 3174
3161 QString pathString = DependencyManager::get<AddressManager>()->currentPath();3175 QString pathString = addressManager->currentPath();
3162 3176
3163 const QString LOCATION_KEY_IN_ROOT = "location";3177 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";
3166 3178
3179 const QString PATH_KEY_IN_LOCATION = "path";
3167 locationObject.insert(PATH_KEY_IN_LOCATION, pathString);3180 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 }
3169 3192
3170 rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject);3193 rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject);
3171 3194
@@ -3946,3 +3969,31 @@ float Application::getRenderResolutionScale() const { · 774 unmodified lines
3946 return 1.0f;3969 return 1.0f;
3947 }3970 }
3948}3971}
3972
3973int 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