History

Merge remote-tracking branch 'upstream/master' into ovr6

Brad Davis committed 11 years ago

Commit 4f8ea3f2 parents e5a9fa8 ab73905114 files · +2745 −1385Browse files

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

Unified · Split

interface/src/Application.cpp+54−28
@@ -57,6 +57,7 @@ · 56 unmodified lines
57 57
58#include <AccountManager.h>58#include <AccountManager.h>
59#include <AddressManager.h>59#include <AddressManager.h>
60#include <CursorManager.h>
60#include <AmbientOcclusionEffect.h>61#include <AmbientOcclusionEffect.h>
61#include <AudioInjector.h>62#include <AudioInjector.h>
62#include <DeferredLightingEffect.h>63#include <DeferredLightingEffect.h>
@@ -100,6 +101,7 @@ · 37 unmodified lines
100#include "ModelPackager.h"101#include "ModelPackager.h"
101#include "Util.h"102#include "Util.h"
102#include "InterfaceLogging.h"103#include "InterfaceLogging.h"
104#include "InterfaceActionFactory.h"
103 105
104#include "avatar/AvatarManager.h"106#include "avatar/AvatarManager.h"
105 107
@@ -257,6 +259,7 @@ bool setupEssentials(int& argc, char** argv) { · 151 unmodified lines
257 259
258 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();260 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
259 DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();261 DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
262 DependencyManager::registerInheritance<EntityActionFactoryInterface, InterfaceActionFactory>();
260 263
261 Setting::init();264 Setting::init();
262 265
@@ -293,7 +296,8 @@ bool setupEssentials(int& argc, char** argv) { · 30 unmodified lines
293 auto discoverabilityManager = DependencyManager::set<DiscoverabilityManager>();296 auto discoverabilityManager = DependencyManager::set<DiscoverabilityManager>();
294 auto sceneScriptingInterface = DependencyManager::set<SceneScriptingInterface>();297 auto sceneScriptingInterface = DependencyManager::set<SceneScriptingInterface>();
295 auto offscreenUi = DependencyManager::set<OffscreenUi>();298 auto offscreenUi = DependencyManager::set<OffscreenUi>();
296 auto pathUtils = DependencyManager::set<PathUtils>();299 auto pathUtils = DependencyManager::set<PathUtils>();
300 auto actionFactory = DependencyManager::set<InterfaceActionFactory>();
297 301
298 return true;302 return true;
299}303}
@@ -336,7 +340,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 36 unmodified lines
336 _enableProcessOctreeThread(true),340 _enableProcessOctreeThread(true),
337 _octreeProcessor(),341 _octreeProcessor(),
338 _nodeBoundsDisplay(this),342 _nodeBoundsDisplay(this),
339 _applicationOverlay(),
340 _runningScriptsWidget(NULL),343 _runningScriptsWidget(NULL),
341 _runningScriptsWidgetWasVisible(false),344 _runningScriptsWidgetWasVisible(false),
342 _trayIcon(new QSystemTrayIcon(_window)),345 _trayIcon(new QSystemTrayIcon(_window)),
@@ -347,7 +350,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 4 unmodified lines
347 _notifiedPacketVersionMismatchThisDomain(false),350 _notifiedPacketVersionMismatchThisDomain(false),
348 _domainConnectionRefusals(QList<QString>()),351 _domainConnectionRefusals(QList<QString>()),
349 _maxOctreePPS(maxOctreePacketsPerSecond.get()),352 _maxOctreePPS(maxOctreePacketsPerSecond.get()),
350 _lastFaceTrackerUpdate(0)353 _lastFaceTrackerUpdate(0),
354 _applicationOverlay()
351{355{
352 setInstance(this);356 setInstance(this);
353#ifdef Q_OS_WIN357#ifdef Q_OS_WIN
@@ -421,6 +425,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 67 unmodified lines
421 connect(audioIO.data(), &AudioClient::muteToggled, this, &Application::audioMuteToggled);425 connect(audioIO.data(), &AudioClient::muteToggled, this, &Application::audioMuteToggled);
422 connect(audioIO.data(), &AudioClient::receivedFirstPacket,426 connect(audioIO.data(), &AudioClient::receivedFirstPacket,
423 &AudioScriptingInterface::getInstance(), &AudioScriptingInterface::receivedFirstPacket);427 &AudioScriptingInterface::getInstance(), &AudioScriptingInterface::receivedFirstPacket);
428 connect(audioIO.data(), &AudioClient::disconnected,
429 &AudioScriptingInterface::getInstance(), &AudioScriptingInterface::disconnected);
424 430
425 audioThread->start();431 audioThread->start();
426 432
@@ -524,7 +530,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 97 unmodified lines
524 _window->setVisible(true);530 _window->setVisible(true);
525 _glWidget->setFocusPolicy(Qt::StrongFocus);531 _glWidget->setFocusPolicy(Qt::StrongFocus);
526 _glWidget->setFocus();532 _glWidget->setFocus();
527 533#ifdef Q_OS_MAC
534 // OSX doesn't seem to provide for hiding the cursor only on the GL widget
535 _window->setCursor(Qt::BlankCursor);
536#else
537 // On windows and linux, hiding the top level cursor also means it's invisible
538 // when hovering over the window menu, which is a pain, so only hide it for
539 // the GL surface
540 _glWidget->setCursor(Qt::BlankCursor);
541#endif
542
528 // enable mouse tracking; otherwise, we only get drag events543 // enable mouse tracking; otherwise, we only get drag events
529 _glWidget->setMouseTracking(true);544 _glWidget->setMouseTracking(true);
530 545
@@ -942,12 +957,15 @@ void Application::paintGL() { · 411 unmodified lines
942 displaySide(&renderArgs, _myCamera);957 displaySide(&renderArgs, _myCamera);
943 glPopMatrix();958 glPopMatrix();
944 959
960 renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
945 if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {961 if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
946 _rearMirrorTools->render(&renderArgs, true, _glWidget->mapFromGlobal(QCursor::pos()));962 _rearMirrorTools->render(&renderArgs, true, _glWidget->mapFromGlobal(QCursor::pos()));
947 } else if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {963 } else if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
948 renderRearViewMirror(&renderArgs, _mirrorViewRect); 964 renderRearViewMirror(&renderArgs, _mirrorViewRect);
949 }965 }
950 966
967 renderArgs._renderMode = RenderArgs::NORMAL_RENDER_MODE;
968
951 auto finalFbo = DependencyManager::get<GlowEffect>()->render(&renderArgs);969 auto finalFbo = DependencyManager::get<GlowEffect>()->render(&renderArgs);
952 970
953 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);971 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
@@ -1228,9 +1246,20 @@ void Application::keyPressEvent(QKeyEvent* event) { · 274 unmodified lines
1228 }1246 }
1229 break;1247 break;
1230 1248
1231 case Qt::Key_Apostrophe:1249 case Qt::Key_Apostrophe: {
1232 resetSensors();1250 if (isMeta) {
1251 auto cursor = Cursor::Manager::instance().getCursor();
1252 auto curIcon = cursor->getIcon();
1253 if (curIcon == Cursor::Icon::DEFAULT) {
1254 cursor->setIcon(Cursor::Icon::LINK);
1255 } else {
1256 cursor->setIcon(Cursor::Icon::DEFAULT);
1257 }
1258 } else {
1259 resetSensors();
1260 }
1233 break;1261 break;
1262 }
1234 1263
1235 case Qt::Key_A:1264 case Qt::Key_A:
1236 if (isShifted) {1265 if (isShifted) {
@@ -1354,12 +1383,27 @@ void Application::keyPressEvent(QKeyEvent* event) { · 117 unmodified lines
1354 case Qt::Key_Slash:1383 case Qt::Key_Slash:
1355 Menu::getInstance()->triggerOption(MenuOption::Stats);1384 Menu::getInstance()->triggerOption(MenuOption::Stats);
1356 break;1385 break;
1357 case Qt::Key_Plus:1386
1358 _myAvatar->increaseSize();1387 case Qt::Key_Plus: {
1388 if (isMeta && event->modifiers().testFlag(Qt::KeypadModifier)) {
1389 auto& cursorManager = Cursor::Manager::instance();
1390 cursorManager.setScale(cursorManager.getScale() * 1.1f);
1391 } else {
1392 _myAvatar->increaseSize();
1393 }
1359 break;1394 break;
1360 case Qt::Key_Minus:1395 }
1361 _myAvatar->decreaseSize();1396
1397 case Qt::Key_Minus: {
1398 if (isMeta && event->modifiers().testFlag(Qt::KeypadModifier)) {
1399 auto& cursorManager = Cursor::Manager::instance();
1400 cursorManager.setScale(cursorManager.getScale() / 1.1f);
1401 } else {
1402 _myAvatar->decreaseSize();
1403 }
1362 break;1404 break;
1405 }
1406
1363 case Qt::Key_Equal:1407 case Qt::Key_Equal:
1364 _myAvatar->resetSize();1408 _myAvatar->resetSize();
1365 break;1409 break;
@@ -1895,8 +1939,6 @@ void Application::setEnableVRMode(bool enableVRMode) { · 529 unmodified lines
1895 }1939 }
1896 1940
1897 resizeGL();1941 resizeGL();
1898
1899 updateCursorVisibility();
1900}1942}
1901 1943
1902void Application::setLowVelocityFilter(bool lowVelocityFilter) {1944void Application::setLowVelocityFilter(bool lowVelocityFilter) {
@@ -2398,19 +2440,8 @@ void Application::updateCursor(float deltaTime) { · 495 unmodified lines
2398 lastMousePos = QCursor::pos();2440 lastMousePos = QCursor::pos();
2399}2441}
2400 2442
2401void Application::updateCursorVisibility() {
2402 if (!_cursorVisible ||
2403 Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode) ||
2404 Menu::getInstance()->isOptionChecked(MenuOption::Enable3DTVMode)) {
2405 _window->setCursor(Qt::BlankCursor);
2406 } else {
2407 _window->unsetCursor();
2408 }
2409}
2410
2411void Application::setCursorVisible(bool visible) {2443void Application::setCursorVisible(bool visible) {
2412 _cursorVisible = visible;2444 _cursorVisible = visible;
2413 updateCursorVisibility();
2414}2445}
2415 2446
2416void Application::update(float deltaTime) {2447void Application::update(float deltaTime) {
@@ -3409,7 +3440,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 992 unmodified lines
3409 "Application::displaySide() ... entities...");3440 "Application::displaySide() ... entities...");
3410 3441
3411 RenderArgs::DebugFlags renderDebugFlags = RenderArgs::RENDER_DEBUG_NONE;3442 RenderArgs::DebugFlags renderDebugFlags = RenderArgs::RENDER_DEBUG_NONE;
3412 RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE;
3413 3443
3414 if (Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowHulls)) {3444 if (Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowHulls)) {
3415 renderDebugFlags = (RenderArgs::DebugFlags) (renderDebugFlags | (int) RenderArgs::RENDER_DEBUG_HULLS);3445 renderDebugFlags = (RenderArgs::DebugFlags) (renderDebugFlags | (int) RenderArgs::RENDER_DEBUG_HULLS);
@@ -3418,10 +3448,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 2 unmodified lines
3418 renderDebugFlags =3448 renderDebugFlags =
3419 (RenderArgs::DebugFlags) (renderDebugFlags | (int) RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP);3449 (RenderArgs::DebugFlags) (renderDebugFlags | (int) RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP);
3420 }3450 }
3421 if (theCamera.getMode() == CAMERA_MODE_MIRROR) {
3422 renderMode = RenderArgs::MIRROR_RENDER_MODE;
3423 }
3424 renderArgs->_renderMode = renderMode;
3425 renderArgs->_debugFlags = renderDebugFlags;3451 renderArgs->_debugFlags = renderDebugFlags;
3426 _entities.render(renderArgs);3452 _entities.render(renderArgs);
3427 }3453 }

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