History

merge upstream/master into andrew/isentropic

Andrew Meadows committed 11 years ago

Commit 49eee892 parents 59a70b5 ef66182246 files · +3085 −27917Browse files

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

Unified · Split

interface/src/Application.cpp+62−114
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 #include <QMediaPlayer>
5353 #include <QMimeData>
5454 #include <QMessageBox>
55+#include <QJsonDocument>
5556
5657 #include <AddressManager.h>
5758 #include <AccountManager.h>
@@ -75,13 +76,15 @@ · 17 unmodified lines
7576 #include <PhysicsEngine.h>
7677 #include <ProgramObject.h>
7778 #include <ResourceCache.h>
78−#include <ScriptCache.h>
79+//#include <ScriptCache.h>
7980 #include <SettingHandle.h>
8081 #include <SoundCache.h>
8182 #include <TextRenderer.h>
8283 #include <UserActivityLogger.h>
8384 #include <UUID.h>
8485
86+#include <SceneScriptingInterface.h>
87+
8588 #include "Application.h"
8689 #include "AudioClient.h"
8790 #include "InterfaceVersion.h"
@@ -215,11 +218,10 @@ bool setupEssentials(int& argc, char** argv) { · 127 unmodified lines
215218 DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
216219
217220 // Set dependencies
218− auto glCanvas = DependencyManager::set<GLCanvas>();
219221 auto addressManager = DependencyManager::set<AddressManager>();
220222 auto nodeList = DependencyManager::set<NodeList>(NodeType::Agent, listenPort);
221223 auto geometryCache = DependencyManager::set<GeometryCache>();
222− auto scriptCache = DependencyManager::set<ScriptCache>();
224+ //auto scriptCache = DependencyManager::set<ScriptCache>();
223225 auto soundCache = DependencyManager::set<SoundCache>();
224226 auto glowEffect = DependencyManager::set<GlowEffect>();
225227 auto faceshift = DependencyManager::set<Faceshift>();
@@ -240,6 +242,7 @@ bool setupEssentials(int& argc, char** argv) { · 14 unmodified lines
240242 auto dialogsManager = DependencyManager::set<DialogsManager>();
241243 auto bandwidthRecorder = DependencyManager::set<BandwidthRecorder>();
242244 auto resouceCacheSharedItems = DependencyManager::set<ResouceCacheSharedItems>();
245+ auto entityScriptingInterface = DependencyManager::set<EntityScriptingInterface>();
243246 #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
244247 auto speechRecognizer = DependencyManager::set<SpeechRecognizer>();
245248 #endif
@@ -307,7 +310,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 61 unmodified lines
307310
308311 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
309312
310− auto glCanvas = DependencyManager::get<GLCanvas>();
311313 auto nodeList = DependencyManager::get<NodeList>();
312314
313315 _myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
@@ -416,8 +418,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 102 unmodified lines
416418
417419 // tell the NodeList instance who to tell the domain server we care about
418420 nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer
419− << NodeType::EntityServer
420− << NodeType::MetavoxelServer);
421+ << NodeType::EntityServer);
421422
422423 // connect to the packet sent signal of the _entityEditSender
423424 connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
@@ -447,16 +448,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 23 unmodified lines
447448
448449 ResourceCache::setRequestLimit(3);
449450
450− _window->setCentralWidget(glCanvas.data());
451+ _window->setCentralWidget(_glWidget);
451452
452453 _window->restoreGeometry();
453454
454455 _window->setVisible(true);
455− glCanvas->setFocusPolicy(Qt::StrongFocus);
456− glCanvas->setFocus();
456+ _glWidget->setFocusPolicy(Qt::StrongFocus);
457+ _glWidget->setFocus();
457458
458459 // enable mouse tracking; otherwise, we only get drag events
459− glCanvas->setMouseTracking(true);
460+ _glWidget->setMouseTracking(true);
460461
461462 _toolWindow = new ToolWindow();
462463 _toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint);
@@ -474,7 +475,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 11 unmodified lines
474475
475476 checkVersion();
476477
477− _overlays.init(glCanvas.data()); // do this before scripts load
478+ _overlays.init(); // do this before scripts load
478479
479480 _runningScriptsWidget->setRunningScripts(getRunningScripts());
480481 connect(_runningScriptsWidget, &RunningScriptsWidget::stopScriptName, this, &Application::stopScript);
@@ -533,7 +534,7 @@ void Application::aboutToQuit() { · 52 unmodified lines
533534 }
534535
535536 void Application::cleanupBeforeQuit() {
536−
537+ _datagramProcessor.shutdown(); // tell the datagram processor we're shutting down, so it can short circuit
537538 _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
538539 ScriptEngine::stopAllScripts(this); // stop all currently running global scripts
539540
@@ -584,8 +585,6 @@ Application::~Application() { · 44 unmodified lines
584585 _entities.getTree()->setSimulation(NULL);
585586 tree->unlock();
586587
587− qInstallMessageHandler(NULL);
588−
589588 // ask the datagram processing thread to quit and wait until it is done
590589 _nodeThread->quit();
591590 _nodeThread->wait();
@@ -599,13 +598,13 @@ Application::~Application() { · 7 unmodified lines
599598
600599 ModelEntityItem::cleanupLoadedAnimations() ;
601600
602− DependencyManager::destroy<GLCanvas>();
603−
604601 DependencyManager::destroy<AnimationCache>();
605602 DependencyManager::destroy<TextureCache>();
606603 DependencyManager::destroy<GeometryCache>();
607− DependencyManager::destroy<ScriptCache>();
604+ //DependencyManager::destroy<ScriptCache>();
608605 DependencyManager::destroy<SoundCache>();
606+
607+ qInstallMessageHandler(NULL); // NOTE: Do this as late as possible so we continue to get our log messages
609608 }
610609
611610 void Application::initializeGL() {
@@ -690,7 +689,7 @@ void Application::paintGL() { · 78 unmodified lines
690689 if (OculusManager::isConnected()) {
691690 DependencyManager::get<TextureCache>()->setFrameBufferSize(OculusManager::getRenderTargetSize());
692691 } else {
693− QSize fbSize = DependencyManager::get<GLCanvas>()->getDeviceSize() * getRenderResolutionScale();
692+ QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale();
694693 DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize);
695694 }
696695
@@ -1057,8 +1056,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 360 unmodified lines
10571056 if (isShifted) {
10581057 _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f);
10591058 if (TV3DManager::isConnected()) {
1060− auto glCanvas = DependencyManager::get<GLCanvas>();
1061− TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
1059+ TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
10621060 }
10631061 } else {
10641062 _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0));
@@ -1070,8 +1068,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 5 unmodified lines
10701068 if (isShifted) {
10711069 _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f);
10721070 if (TV3DManager::isConnected()) {
1073− auto glCanvas = DependencyManager::get<GLCanvas>();
1074− TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
1071+ TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
10751072 }
10761073
10771074 } else {
@@ -1448,8 +1445,7 @@ void Application::sendPingPackets() { · 370 unmodified lines
14481445 QByteArray pingPacket = DependencyManager::get<NodeList>()->constructPingPacket();
14491446 controlledBroadcastToNodes(pingPacket, NodeSet()
14501447 << NodeType::EntityServer
1451− << NodeType::AudioMixer << NodeType::AvatarMixer
1452− << NodeType::MetavoxelServer);
1448+ << NodeType::AudioMixer << NodeType::AvatarMixer);
14531449 }
14541450
14551451 // Every second, check the frame rates and other stuff
@@ -1500,7 +1496,7 @@ void Application::idle() { · 44 unmodified lines
15001496 {
15011497 PerformanceTimer perfTimer("updateGL");
15021498 PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()");
1503− DependencyManager::get<GLCanvas>()->updateGL();
1499+ _glWidget->updateGL();
15041500 }
15051501 {
15061502 PerformanceTimer perfTimer("rest");
@@ -1541,8 +1537,7 @@ void Application::setFullscreen(bool fullscreen) { · 34 unmodified lines
15411537 }
15421538
15431539 void Application::setEnable3DTVMode(bool enable3DTVMode) {
1544− auto glCanvas = DependencyManager::get<GLCanvas>();
1545− resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
1540+ resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
15461541 }
15471542
15481543 void Application::setEnableVRMode(bool enableVRMode) {
@@ -1567,8 +1562,7 @@ void Application::setEnableVRMode(bool enableVRMode) { · 18 unmodified lines
15671562 _myCamera.setHmdRotation(glm::quat());
15681563 }
15691564
1570− auto glCanvas = DependencyManager::get<GLCanvas>();
1571− resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
1565+ resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
15721566
15731567 updateCursorVisibility();
15741568 }
@@ -1579,9 +1573,8 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) { · 4 unmodified lines
15791573
15801574 bool Application::mouseOnScreen() const {
15811575 if (OculusManager::isConnected()) {
1582− auto glCanvas = DependencyManager::get<GLCanvas>();
1583− return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() &&
1584− getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight();
1576+ return getMouseX() >= 0 && getMouseX() <= _glWidget->getDeviceWidth() &&
1577+ getMouseY() >= 0 && getMouseY() <= _glWidget->getDeviceHeight();
15851578 }
15861579 return true;
15871580 }
@@ -1773,8 +1766,10 @@ void Application::init() { · 185 unmodified lines
17731766 tree->setSimulation(&_physicsEngine);
17741767 _physicsEngine.init(&_entityEditSender);
17751768
1769+ auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
1770+
17761771 connect(&_physicsEngine, &EntitySimulation::entityCollisionWithEntity,
1777− ScriptEngine::getEntityScriptingInterface(), &EntityScriptingInterface::entityCollisionWithEntity);
1772+ entityScriptingInterface.data(), &EntityScriptingInterface::entityCollisionWithEntity);
17781773
17791774 // connect the _entityCollisionSystem to our EntityTreeRenderer since that's what handles running entity scripts
17801775 connect(&_physicsEngine, &EntitySimulation::entityCollisionWithEntity,
@@ -1782,16 +1777,13 @@ void Application::init() { · 1 unmodified line
17821777
17831778 // connect the _entities (EntityTreeRenderer) to our script engine's EntityScriptingInterface for firing
17841779 // of events related clicking, hovering over, and entering entities
1785− _entities.connectSignalsToSlots(ScriptEngine::getEntityScriptingInterface());
1780+ _entities.connectSignalsToSlots(entityScriptingInterface.data());
17861781
17871782 _entityClipboardRenderer.init();
17881783 _entityClipboardRenderer.setViewFrustum(getViewFrustum());
17891784 _entityClipboardRenderer.setTree(&_entityClipboard);
17901785
1791− _metavoxels.init();
1792−
1793− auto glCanvas = DependencyManager::get<GLCanvas>();
1794− _rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect);
1786+ _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect);
17951787
17961788 connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
17971789 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
@@ -1799,10 +1791,10 @@ void Application::init() { · 1 unmodified line
17991791 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
18001792
18011793 // make sure our texture cache knows about window size changes
1802− DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data());
1794+ DependencyManager::get<TextureCache>()->associateWithWidget(_glWidget);
18031795
18041796 // initialize the GlowEffect with our widget
1805− DependencyManager::get<GlowEffect>()->init(glCanvas.data(),
1797+ DependencyManager::get<GlowEffect>()->init(_glWidget,
18061798 Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect));
18071799 }
18081800
@@ -1868,35 +1860,6 @@ void Application::updateMouseRay() { · 59 unmodified lines
18681860 }
18691861 }
18701862
1871−void Application::updateFaceshift() {
1872− bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1873− PerformanceWarning warn(showWarnings, "Application::updateFaceshift()");
1874− auto faceshift = DependencyManager::get<Faceshift>();
1875− // Update faceshift
1876− faceshift->update();
1877−
1878− // Copy angular velocity if measured by faceshift, to the head
1879− if (faceshift->isActive()) {
1880− _myAvatar->getHead()->setAngularVelocity(faceshift->getHeadAngularVelocity());
1881− }
1882−}
1883−
1884−void Application::updateVisage() {
1885− bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1886− PerformanceWarning warn(showWarnings, "Application::updateVisage()");
1887−
1888− // Update Visage
1889− DependencyManager::get<Visage>()->update();
1890−}
1891−
1892−void Application::updateDDE() {
1893− bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1894− PerformanceWarning warn(showWarnings, "Application::updateDDE()");
1895−
1896− // Update Cara
1897− DependencyManager::get<DdeFaceTracker>()->update();
1898−}
1899−
19001863 void Application::updateMyAvatarLookAtPosition() {
19011864 PerformanceTimer perfTimer("lookAt");
19021865 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
@@ -1982,16 +1945,6 @@ void Application::updateThreads(float deltaTime) { · 79 unmodified lines
19821945 }
19831946 }
19841947
1985−void Application::updateMetavoxels(float deltaTime) {
1986− PerformanceTimer perfTimer("updateMetavoxels");
1987− bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1988− PerformanceWarning warn(showWarnings, "Application::updateMetavoxels()");
1989−
1990− if (Menu::getInstance()->isOptionChecked(MenuOption::Metavoxels)) {
1991− _metavoxels.simulate(deltaTime);
1992− }
1993−}
1994−
19951948 void Application::cameraMenuChanged() {
19961949 if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
19971950 if (_myCamera.getMode() != CAMERA_MODE_MIRROR) {
@@ -2056,9 +2009,9 @@ void Application::updateCursor(float deltaTime) { · 58 unmodified lines
20562009
20572010 void Application::updateCursorVisibility() {
20582011 if (!_cursorVisible || Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) {
2059− DependencyManager::get<GLCanvas>()->setCursor(Qt::BlankCursor);
2012+ _glWidget->setCursor(Qt::BlankCursor);
20602013 } else {
2061− DependencyManager::get<GLCanvas>()->unsetCursor();
2014+ _glWidget->unsetCursor();
20622015 }
20632016 }
20642017
@@ -2076,12 +2029,12 @@ void Application::update(float deltaTime) { · 11 unmodified lines
20762029 {
20772030 PerformanceTimer perfTimer("devices");
20782031 DeviceTracker::updateAll();
2079− updateFaceshift();
2080− updateVisage();
2032+ FaceTracker* tracker = getActiveFaceTracker();
2033+ if (tracker) {
2034+ tracker->update(deltaTime);
2035+ }
20812036 SixenseManager::getInstance().update(deltaTime);
20822037 JoystickScriptingInterface::getInstance().update();
2083− _prioVR.update(deltaTime);
2084−
20852038 }
20862039
20872040 // Dispatch input events
@@ -2091,7 +2044,6 @@ void Application::update(float deltaTime) { · 3 unmodified lines
20912044
20922045 DependencyManager::get<AvatarManager>()->updateOtherAvatars(deltaTime); //loop through all the other avatars and simulate them...
20932046
2094− updateMetavoxels(deltaTime); // update metavoxels
20952047 updateCamera(deltaTime); // handle various camera tweaks like off axis projection
20962048 updateDialogs(deltaTime); // update various stats dialogs if present
20972049 updateCursor(deltaTime); // Handle cursor updates
@@ -2500,7 +2452,8 @@ void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) { · 402 unmodified lines
25002452
25012453 glm::vec3 Application::getSunDirection() {
25022454 // Sun direction is in fact just the location of the sun relative to the origin
2503− return glm::normalize(_environment.getClosestData(_myCamera.getPosition()).getSunLocation(_myCamera.getPosition()));
2455+ auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
2456+ return skyStage->getSunLight()->getDirection();
25042457 }
25052458
25062459 void Application::updateShadowMap() {
@@ -2510,7 +2463,7 @@ void Application::updateShadowMap() { · 3 unmodified lines
25102463 glEnable(GL_DEPTH_TEST);
25112464 glClear(GL_DEPTH_BUFFER_BIT);
25122465
2513− glm::vec3 lightDirection = -getSunDirection();
2466+ glm::vec3 lightDirection = getSunDirection();
25142467 glm::quat rotation = rotationBetween(IDENTITY_FRONT, lightDirection);
25152468 glm::quat inverseRotation = glm::inverse(rotation);
25162469
@@ -2580,7 +2533,9 @@ void Application::updateShadowMap() { · 63 unmodified lines
25802533 glm::ortho(minima.x, maxima.x, minima.y, maxima.y, -maxima.z, -minima.z) * glm::mat4_cast(inverseRotation));
25812534
25822535 // update the shadow view frustum
2583− _shadowViewFrustum.setPosition(rotation * ((minima + maxima) * 0.5f));
2536+ // glm::vec3 shadowFrustumCenter = glm::vec3((minima.x + maxima.x) * 0.5f, (minima.y + maxima.y) * 0.5f, (minima.z + maxima.z) * 0.5f);
2537+ glm::vec3 shadowFrustumCenter = rotation * ((minima + maxima) * 0.5f);
2538+ _shadowViewFrustum.setPosition(shadowFrustumCenter);
25842539 _shadowViewFrustum.setOrientation(rotation);
25852540 _shadowViewFrustum.setOrthographic(true);
25862541 _shadowViewFrustum.setWidth(maxima.x - minima.x);
@@ -2610,8 +2565,10 @@ void Application::updateShadowMap() { · 23 unmodified lines
26102565 // this is what is used for rendering the Entities and avatars
26112566 Transform viewTransform;
26122567 viewTransform.setRotation(rotation);
2568+ // viewTransform.postTranslate(shadowFrustumCenter);
26132569 setViewTransform(viewTransform);
26142570
2571+
26152572 glEnable(GL_POLYGON_OFFSET_FILL);
26162573 glPolygonOffset(1.1f, 4.0f); // magic numbers courtesy http://www.eecs.berkeley.edu/~ravir/6160/papers/shadowmaps.ppt
26172574
@@ -2648,8 +2605,7 @@ void Application::updateShadowMap() { · 30 unmodified lines
26482605
26492606 fbo->release();
26502607
2651− auto glCanvas = DependencyManager::get<GLCanvas>();
2652− glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
2608+ glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
26532609 }
26542610
26552611 const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f };
@@ -2699,7 +2655,7 @@ QImage Application::renderAvatarBillboard() { · 43 unmodified lines
26992655 Glower glower;
27002656
27012657 const int BILLBOARD_SIZE = 64;
2702− renderRearViewMirror(QRect(0, DependencyManager::get<GLCanvas>()->getDeviceHeight() - BILLBOARD_SIZE,
2658+ renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE,
27032659 BILLBOARD_SIZE, BILLBOARD_SIZE),
27042660 true);
27052661
@@ -2837,14 +2793,6 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 131 unmodified lines
28372793 float originSphereRadius = 0.05f;
28382794 DependencyManager::get<GeometryCache>()->renderSphere(originSphereRadius, 15, 15, glm::vec4(1.0f, 0.0f, 0.0f, 1.0f));
28392795
2840− // also, metavoxels
2841− if (Menu::getInstance()->isOptionChecked(MenuOption::Metavoxels)) {
2842− PerformanceTimer perfTimer("metavoxels");
2843− PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
2844− "Application::displaySide() ... metavoxels...");
2845− _metavoxels.render();
2846− }
2847−
28482796 // render models...
28492797 if (Menu::getInstance()->isOptionChecked(MenuOption::Entities)) {
28502798 PerformanceTimer perfTimer("entities");
@@ -2880,7 +2828,9 @@ void Application::displaySide(Camera& theCamera, bool selfAvatarOnly, RenderArgs · 29 unmodified lines
28802828
28812829 {
28822830 DependencyManager::get<DeferredLightingEffect>()->setAmbientLightMode(getRenderAmbientLight());
2883− DependencyManager::get<DeferredLightingEffect>()->setGlobalLight(-getSunDirection(), GLOBAL_LIGHT_COLOR, GLOBAL_LIGHT_INTENSITY);
2831+ auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
2832+ DependencyManager::get<DeferredLightingEffect>()->setGlobalLight(skyStage->getSunLight()->getDirection(), skyStage->getSunLight()->getColor(), skyStage->getSunLight()->getIntensity());
2833+
28842834 PROFILE_RANGE("DeferredLighting");
28852835 PerformanceTimer perfTimer("lighting");
28862836 DependencyManager::get<DeferredLightingEffect>()->render();
@@ -2991,9 +2941,8 @@ bool Application::getCascadeShadowsEnabled() { · 104 unmodified lines
29912941 }
29922942
29932943 glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
2994− auto glCanvas = DependencyManager::get<GLCanvas>();
2995− float horizontalScale = glCanvas->getDeviceWidth() / 2.0f;
2996− float verticalScale = glCanvas->getDeviceHeight() / 2.0f;
2944+ float horizontalScale = _glWidget->getDeviceWidth() / 2.0f;
2945+ float verticalScale = _glWidget->getDeviceHeight() / 2.0f;
29972946
29982947 // -1,-1 is 0,windowHeight
29992948 // 1,1 is windowWidth,0
@@ -3012,7 +2961,7 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { · 12 unmodified lines
30122961 // -1,-1 1,-1
30132962
30142963 glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale,
3015− ((projectedPoint.y + 1.0) * -verticalScale) + glCanvas->getDeviceHeight());
2964+ ((projectedPoint.y + 1.0) * -verticalScale) + _glWidget->getDeviceHeight());
30162965
30172966 return screenPoint;
30182967 }
@@ -3142,13 +3091,12 @@ void Application::resetSensors() { · 123 unmodified lines
31423091
31433092 OculusManager::reset();
31443093
3145− _prioVR.reset();
31463094 //_leapmotion.reset();
31473095
31483096 QScreen* currentScreen = _window->windowHandle()->screen();
31493097 QWindow* mainWindow = _window->windowHandle();
31503098 QPoint windowCenter = mainWindow->geometry().center();
3151− DependencyManager::get<GLCanvas>()->cursor().setPos(currentScreen, windowCenter);
3099+ _glWidget->cursor().setPos(currentScreen, windowCenter);
31523100
31533101 _myAvatar->reset();
31543102
@@ -3476,8 +3424,9 @@ void joystickFromScriptValue(const QScriptValue &object, Joystick* &out) { · 321 unmodified lines
34763424 void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scriptEngine) {
34773425 // setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so
34783426 // we can use the same ones from the application.
3479− scriptEngine->getEntityScriptingInterface()->setPacketSender(&_entityEditSender);
3480− scriptEngine->getEntityScriptingInterface()->setEntityTree(_entities.getTree());
3427+ auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
3428+ entityScriptingInterface->setPacketSender(&_entityEditSender);
3429+ entityScriptingInterface->setEntityTree(_entities.getTree());
34813430
34823431 // AvatarManager has some custom types
34833432 AvatarManager::registerMetaTypes(scriptEngine);
@@ -3520,7 +3469,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 36 unmodified lines
35203469 scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data());
35213470 scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data());
35223471 scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance());
3523− scriptEngine->registerGlobalObject("Metavoxels", &_metavoxels);
35243472
35253473 scriptEngine->registerGlobalObject("GlobalServices", GlobalServicesScriptingInterface::getInstance());
35263474 qScriptRegisterMetaType(scriptEngine, DownloadInfoResultToScriptValue, DownloadInfoResultFromScriptValue);
@@ -3784,7 +3732,7 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio · 257 unmodified lines
37843732
37853733 void Application::loadDialog() {
37863734
3787− QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get<GLCanvas>().data(),
3735+ QString fileNameString = QFileDialog::getOpenFileName(_glWidget,
37883736 tr("Open Script"),
37893737 getPreviousScriptLocation(),
37903738 tr("JavaScript Files (*.js)"));
@@ -3825,7 +3773,7 @@ void Application::setScriptsLocation(const QString& scriptsLocation) { · 34 unmodified lines
38253773
38263774 void Application::toggleLogDialog() {
38273775 if (! _logDialog) {
3828− _logDialog = new LogDialog(DependencyManager::get<GLCanvas>().data(), getLogger());
3776+ _logDialog = new LogDialog(_glWidget, getLogger());
38293777 }
38303778
38313779 if (_logDialog->isVisible()) {
@@ -3882,7 +3830,7 @@ void Application::parseVersionXml() { · 50 unmodified lines
38823830 }
38833831
38843832 if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
3885− new UpdateDialog(DependencyManager::get<GLCanvas>().data(), releaseNotes, latestVersion, downloadUrl);
3833+ new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl);
38863834 }
38873835 sender->deleteLater();
38883836 }
@@ -3915,7 +3863,7 @@ void Application::takeSnapshot() { · 26 unmodified lines
39153863 }
39163864
39173865 if (!_snapshotShareDialog) {
3918− _snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get<GLCanvas>().data());
3866+ _snapshotShareDialog = new SnapshotShareDialog(fileName, _glWidget);
39193867 }
39203868 _snapshotShareDialog->show();
39213869 }

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