Showing the changes to interface/src/Application.cpp (1 of 78 files). Show all
Unified · Split
| @@ -64,6 +64,7 @@ · 63 unmodified lines | |||
| 64 | #include <HFBackEvent.h> | 64 | #include <HFBackEvent.h> |
| 65 | #include <LocalVoxelsList.h> | 65 | #include <LocalVoxelsList.h> |
| 66 | #include <LogHandler.h> | 66 | #include <LogHandler.h> |
| 67 | #include <MainWindow.h> | ||
| 67 | #include <NetworkAccessManager.h> | 68 | #include <NetworkAccessManager.h> |
| 68 | #include <OctalCode.h> | 69 | #include <OctalCode.h> |
| 69 | #include <OctreeSceneStats.h> | 70 | #include <OctreeSceneStats.h> |
| @@ -73,6 +74,7 @@ · 3 unmodified lines | |||
| 73 | #include <ProgramObject.h> | 74 | #include <ProgramObject.h> |
| 74 | #include <ResourceCache.h> | 75 | #include <ResourceCache.h> |
| 75 | #include <SoundCache.h> | 76 | #include <SoundCache.h> |
| 77 | #include <TextRenderer.h> | ||
| 76 | #include <UserActivityLogger.h> | 78 | #include <UserActivityLogger.h> |
| 77 | #include <UUID.h> | 79 | #include <UUID.h> |
| 78 | 80 | ||
| @@ -109,7 +111,6 @@ · 30 unmodified lines | |||
| 109 | #include "ui/InfoView.h" | 111 | #include "ui/InfoView.h" |
| 110 | #include "ui/Snapshot.h" | 112 | #include "ui/Snapshot.h" |
| 111 | #include "ui/Stats.h" | 113 | #include "ui/Stats.h" |
| 112 | #include "ui/TextRenderer.h" | ||
| 113 | 114 | ||
| 114 | 115 | ||
| 115 | 116 | ||
| @@ -142,7 +143,6 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt · 26 unmodified lines | |||
| 142 | Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : | 143 | Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : |
| 143 | QApplication(argc, argv), | 144 | QApplication(argc, argv), |
| 144 | _window(new MainWindow(desktop())), | 145 | _window(new MainWindow(desktop())), |
| 145 | _glWidget(new GLCanvas()), | ||
| 146 | _toolWindow(NULL), | 146 | _toolWindow(NULL), |
| 147 | _nodeThread(new QThread(this)), | 147 | _nodeThread(new QThread(this)), |
| 148 | _datagramProcessor(), | 148 | _datagramProcessor(), |
| @@ -155,9 +155,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 6 unmodified lines | |||
| 155 | _voxelImporter(), | 155 | _voxelImporter(), |
| 156 | _importSucceded(false), | 156 | _importSucceded(false), |
| 157 | _sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard), | 157 | _sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard), |
| 158 | _entities(true), | 158 | _entities(true, this, this), |
| 159 | _entityCollisionSystem(), | 159 | _entityCollisionSystem(), |
| 160 | _entityClipboardRenderer(false), | 160 | _entityClipboardRenderer(false, this, this), |
| 161 | _entityClipboard(), | 161 | _entityClipboard(), |
| 162 | _wantToKillLocalVoxels(false), | 162 | _wantToKillLocalVoxels(false), |
| 163 | _viewFrustum(), | 163 | _viewFrustum(), |
| @@ -191,8 +191,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 27 unmodified lines | |||
| 191 | _isVSyncOn(true), | 191 | _isVSyncOn(true), |
| 192 | _aboutToQuit(false) | 192 | _aboutToQuit(false) |
| 193 | { | 193 | { |
| 194 | Model::setViewStateInterface(this); // The model class will sometimes need to know view state details from us | 194 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); |
| 195 | 195 | Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us | |
| 196 | |||
| 196 | // read the ApplicationInfo.ini file for Name/Version/Domain information | 197 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| 197 | QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); | 198 | QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); |
| 198 | 199 | ||
| @@ -362,16 +363,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 163 unmodified lines | |||
| 362 | 363 | ||
| 363 | ResourceCache::setRequestLimit(3); | 364 | ResourceCache::setRequestLimit(3); |
| 364 | 365 | ||
| 365 | _window->setCentralWidget(_glWidget); | 366 | _window->setCentralWidget(glCanvas.data()); |
| 366 | 367 | ||
| 367 | restoreSizeAndPosition(); | 368 | restoreSizeAndPosition(); |
| 368 | 369 | ||
| 369 | _window->setVisible(true); | 370 | _window->setVisible(true); |
| 370 | _glWidget->setFocusPolicy(Qt::StrongFocus); | 371 | glCanvas->setFocusPolicy(Qt::StrongFocus); |
| 371 | _glWidget->setFocus(); | 372 | glCanvas->setFocus(); |
| 372 | 373 | ||
| 373 | // enable mouse tracking; otherwise, we only get drag events | 374 | // enable mouse tracking; otherwise, we only get drag events |
| 374 | _glWidget->setMouseTracking(true); | 375 | glCanvas->setMouseTracking(true); |
| 375 | 376 | ||
| 376 | _toolWindow = new ToolWindow(); | 377 | _toolWindow = new ToolWindow(); |
| 377 | _toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint); | 378 | _toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint); |
| @@ -390,7 +391,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 12 unmodified lines | |||
| 390 | 391 | ||
| 391 | checkVersion(); | 392 | checkVersion(); |
| 392 | 393 | ||
| 393 | _overlays.init(_glWidget); // do this before scripts load | 394 | _overlays.init(glCanvas.data()); // do this before scripts load |
| 394 | 395 | ||
| 395 | LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree()); | 396 | LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree()); |
| 396 | LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard); | 397 | LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard); |
| @@ -439,6 +440,7 @@ void Application::aboutToQuit() { · 42 unmodified lines | |||
| 439 | } | 440 | } |
| 440 | 441 | ||
| 441 | Application::~Application() { | 442 | Application::~Application() { |
| 443 | |||
| 442 | _entities.getTree()->setSimulation(NULL); | 444 | _entities.getTree()->setSimulation(NULL); |
| 443 | qInstallMessageHandler(NULL); | 445 | qInstallMessageHandler(NULL); |
| 444 | 446 | ||
| @@ -480,8 +482,6 @@ Application::~Application() { · 35 unmodified lines | |||
| 480 | Menu::getInstance()->deleteLater(); | 482 | Menu::getInstance()->deleteLater(); |
| 481 | 483 | ||
| 482 | _myAvatar = NULL; | 484 | _myAvatar = NULL; |
| 483 | |||
| 484 | delete _glWidget; | ||
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | void Application::saveSettings() { | 487 | void Application::saveSettings() { |
| @@ -621,7 +621,7 @@ void Application::paintGL() { · 133 unmodified lines | |||
| 621 | if (OculusManager::isConnected()) { | 621 | if (OculusManager::isConnected()) { |
| 622 | DependencyManager::get<TextureCache>()->setFrameBufferSize(OculusManager::getRenderTargetSize()); | 622 | DependencyManager::get<TextureCache>()->setFrameBufferSize(OculusManager::getRenderTargetSize()); |
| 623 | } else { | 623 | } else { |
| 624 | QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale(); | 624 | QSize fbSize = DependencyManager::get<GLCanvas>()->getDeviceSize() * getRenderResolutionScale(); |
| 625 | DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize); | 625 | DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize); |
| 626 | } | 626 | } |
| 627 | 627 | ||
| @@ -1045,7 +1045,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 417 unmodified lines | |||
| 1045 | if (isShifted) { | 1045 | if (isShifted) { |
| 1046 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f); | 1046 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f); |
| 1047 | if (TV3DManager::isConnected()) { | 1047 | if (TV3DManager::isConnected()) { |
| 1048 | TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | 1048 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); |
| 1049 | TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | ||
| 1049 | } | 1050 | } |
| 1050 | } else { | 1051 | } else { |
| 1051 | _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0)); | 1052 | _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0)); |
| @@ -1057,7 +1058,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 5 unmodified lines | |||
| 1057 | if (isShifted) { | 1058 | if (isShifted) { |
| 1058 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f); | 1059 | _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f); |
| 1059 | if (TV3DManager::isConnected()) { | 1060 | if (TV3DManager::isConnected()) { |
| 1060 | TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | 1061 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); |
| 1062 | TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | ||
| 1061 | } | 1063 | } |
| 1062 | 1064 | ||
| 1063 | } else { | 1065 | } else { |
| @@ -1503,7 +1505,7 @@ void Application::idle() { · 439 unmodified lines | |||
| 1503 | { | 1505 | { |
| 1504 | PerformanceTimer perfTimer("updateGL"); | 1506 | PerformanceTimer perfTimer("updateGL"); |
| 1505 | PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()"); | 1507 | PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()"); |
| 1506 | _glWidget->updateGL(); | 1508 | DependencyManager::get<GLCanvas>()->updateGL(); |
| 1507 | } | 1509 | } |
| 1508 | { | 1510 | { |
| 1509 | PerformanceTimer perfTimer("rest"); | 1511 | PerformanceTimer perfTimer("rest"); |
| @@ -1529,13 +1531,14 @@ void Application::idle() { · 19 unmodified lines | |||
| 1529 | 1531 | ||
| 1530 | void Application::checkBandwidthMeterClick() { | 1532 | void Application::checkBandwidthMeterClick() { |
| 1531 | // ... to be called upon button release | 1533 | // ... to be called upon button release |
| 1534 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); | ||
| 1532 | if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) && | 1535 | if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) && |
| 1533 | Menu::getInstance()->isOptionChecked(MenuOption::Stats) && | 1536 | Menu::getInstance()->isOptionChecked(MenuOption::Stats) && |
| 1534 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) && | 1537 | Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) && |
| 1535 | glm::compMax(glm::abs(glm::ivec2(getMouseX() - getMouseDragStartedX(), | 1538 | glm::compMax(glm::abs(glm::ivec2(getMouseX() - getMouseDragStartedX(), |
| 1536 | getMouseY() - getMouseDragStartedY()))) | 1539 | getMouseY() - getMouseDragStartedY()))) |
| 1537 | <= BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH | 1540 | <= BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH |
| 1538 | && _bandwidthMeter.isWithinArea(getMouseX(), getMouseY(), _glWidget->width(), _glWidget->height())) { | 1541 | && _bandwidthMeter.isWithinArea(getMouseX(), getMouseY(), glCanvas->width(), glCanvas->height())) { |
| 1539 | 1542 | ||
| 1540 | // The bandwidth meter is visible, the click didn't get dragged too far and | 1543 | // The bandwidth meter is visible, the click didn't get dragged too far and |
| 1541 | // we actually hit the bandwidth meter | 1544 | // we actually hit the bandwidth meter |
| @@ -1564,7 +1567,8 @@ void Application::setFullscreen(bool fullscreen) { · 22 unmodified lines | |||
| 1564 | } | 1567 | } |
| 1565 | 1568 | ||
| 1566 | void Application::setEnable3DTVMode(bool enable3DTVMode) { | 1569 | void Application::setEnable3DTVMode(bool enable3DTVMode) { |
| 1567 | resizeGL(_glWidget->getDeviceWidth(),_glWidget->getDeviceHeight()); | 1570 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); |
| 1571 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | ||
| 1568 | } | 1572 | } |
| 1569 | 1573 | ||
| 1570 | void Application::setEnableVRMode(bool enableVRMode) { | 1574 | void Application::setEnableVRMode(bool enableVRMode) { |
| @@ -1589,7 +1593,8 @@ void Application::setEnableVRMode(bool enableVRMode) { · 18 unmodified lines | |||
| 1589 | _myCamera.setHmdRotation(glm::quat()); | 1593 | _myCamera.setHmdRotation(glm::quat()); |
| 1590 | } | 1594 | } |
| 1591 | 1595 | ||
| 1592 | resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | 1596 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); |
| 1597 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | ||
| 1593 | } | 1598 | } |
| 1594 | 1599 | ||
| 1595 | void Application::setRenderVoxels(bool voxelRender) { | 1600 | void Application::setRenderVoxels(bool voxelRender) { |
| @@ -1651,8 +1656,9 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox · 55 unmodified lines | |||
| 1651 | 1656 | ||
| 1652 | bool Application::mouseOnScreen() const { | 1657 | bool Application::mouseOnScreen() const { |
| 1653 | if (OculusManager::isConnected()) { | 1658 | if (OculusManager::isConnected()) { |
| 1654 | return getMouseX() >= 0 && getMouseX() <= _glWidget->getDeviceWidth() && | 1659 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); |
| 1655 | getMouseY() >= 0 && getMouseY() <= _glWidget->getDeviceHeight(); | 1660 | return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() && |
| 1661 | getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight(); | ||
| 1656 | } | 1662 | } |
| 1657 | return true; | 1663 | return true; |
| 1658 | } | 1664 | } |
| @@ -1692,13 +1698,13 @@ int Application::getMouseDragStartedY() const { · 33 unmodified lines | |||
| 1692 | } | 1698 | } |
| 1693 | 1699 | ||
| 1694 | FaceTracker* Application::getActiveFaceTracker() { | 1700 | FaceTracker* Application::getActiveFaceTracker() { |
| 1695 | Faceshift* faceshift = DependencyManager::get<Faceshift>(); | 1701 | Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>(); |
| 1696 | Visage* visage = DependencyManager::get<Visage>(); | 1702 | Visage::SharedPointer visage = DependencyManager::get<Visage>(); |
| 1697 | DdeFaceTracker* dde = DependencyManager::get<DdeFaceTracker>(); | 1703 | DdeFaceTracker::SharedPointer dde = DependencyManager::get<DdeFaceTracker>(); |
| 1698 | 1704 | ||
| 1699 | return (dde->isActive() ? static_cast<FaceTracker*>(dde) : | 1705 | return (dde->isActive() ? static_cast<FaceTracker*>(dde.data()) : |
| 1700 | (faceshift->isActive() ? static_cast<FaceTracker*>(faceshift) : | 1706 | (faceshift->isActive() ? static_cast<FaceTracker*>(faceshift.data()) : |
| 1701 | (visage->isActive() ? static_cast<FaceTracker*>(visage) : NULL))); | 1707 | (visage->isActive() ? static_cast<FaceTracker*>(visage.data()) : NULL))); |
| 1702 | } | 1708 | } |
| 1703 | 1709 | ||
| 1704 | struct SendVoxelsOperationArgs { | 1710 | struct SendVoxelsOperationArgs { |
| @@ -1771,7 +1777,8 @@ void Application::exportVoxels(const VoxelDetail& sourceVoxel) { · 66 unmodified lines | |||
| 1771 | QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | 1777 | QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); |
| 1772 | QString suggestedName = desktopLocation.append("/voxels.svo"); | 1778 | QString suggestedName = desktopLocation.append("/voxels.svo"); |
| 1773 | 1779 | ||
| 1774 | QString fileNameString = QFileDialog::getSaveFileName(_glWidget, tr("Export Voxels"), suggestedName, | 1780 | QString fileNameString = QFileDialog::getSaveFileName(DependencyManager::get<GLCanvas>().data(), |
| 1781 | tr("Export Voxels"), suggestedName, | ||
| 1775 | tr("Sparse Voxel Octree Files (*.svo)")); | 1782 | tr("Sparse Voxel Octree Files (*.svo)")); |
| 1776 | QByteArray fileNameAscii = fileNameString.toLocal8Bit(); | 1783 | QByteArray fileNameAscii = fileNameString.toLocal8Bit(); |
| 1777 | const char* fileName = fileNameAscii.data(); | 1784 | const char* fileName = fileNameAscii.data(); |
| @@ -2025,9 +2032,9 @@ void Application::init() { · 247 unmodified lines | |||
| 2025 | 2032 | ||
| 2026 | _metavoxels.init(); | 2033 | _metavoxels.init(); |
| 2027 | 2034 | ||
| 2028 | _audio.init(_glWidget); | 2035 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); |
| 2029 | 2036 | _audio.init(glCanvas.data()); | |
| 2030 | _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings); | 2037 | _rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect, _settings); |
| 2031 | 2038 | ||
| 2032 | connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); | 2039 | connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); |
| 2033 | connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); | 2040 | connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); |
| @@ -2040,11 +2047,12 @@ void Application::init() { · 6 unmodified lines | |||
| 2040 | // save settings when avatar changes | 2047 | // save settings when avatar changes |
| 2041 | connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings); | 2048 | connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings); |
| 2042 | 2049 | ||
| 2043 | // make sure our texture cache knows about window size changes | 2050 | // make sure our texture cache knows about window size changes |
| 2044 | DependencyManager::get<TextureCache>()->associateWithWidget(getGLWidget()); | 2051 | DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data()); |
| 2045 | 2052 | ||
| 2046 | // initialize the GlowEffect with our widget | 2053 | // initialize the GlowEffect with our widget |
| 2047 | DependencyManager::get<GlowEffect>()->init(getGLWidget(), Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect)); | 2054 | DependencyManager::get<GlowEffect>()->init(glCanvas.data(), |
| 2055 | Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect)); | ||
| 2048 | } | 2056 | } |
| 2049 | 2057 | ||
| 2050 | void Application::closeMirrorView() { | 2058 | void Application::closeMirrorView() { |
| @@ -2112,7 +2120,7 @@ void Application::updateMouseRay() { · 61 unmodified lines | |||
| 2112 | void Application::updateFaceshift() { | 2120 | void Application::updateFaceshift() { |
| 2113 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 2121 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2114 | PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); | 2122 | PerformanceWarning warn(showWarnings, "Application::updateFaceshift()"); |
| 2115 | Faceshift* faceshift = DependencyManager::get<Faceshift>(); | 2123 | Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>(); |
| 2116 | // Update faceshift | 2124 | // Update faceshift |
| 2117 | faceshift->update(); | 2125 | faceshift->update(); |
| 2118 | 2126 | ||
| @@ -2916,8 +2924,9 @@ void Application::updateShadowMap() { · 797 unmodified lines | |||
| 2916 | } | 2924 | } |
| 2917 | 2925 | ||
| 2918 | fbo->release(); | 2926 | fbo->release(); |
| 2919 | 2927 | ||
| 2920 | glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); | 2928 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); |
| 2929 | glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | ||
| 2921 | } | 2930 | } |
| 2922 | 2931 | ||
| 2923 | const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f }; | 2932 | const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f }; |
| @@ -2944,6 +2953,18 @@ bool Application::shouldRenderMesh(float largestDimension, float distanceToCamer · 20 unmodified lines | |||
| 2944 | return Menu::getInstance()->shouldRenderMesh(largestDimension, distanceToCamera); | 2953 | return Menu::getInstance()->shouldRenderMesh(largestDimension, distanceToCamera); |
| 2945 | } | 2954 | } |
| 2946 | 2955 | ||
| 2956 | float Application::getSizeScale() const { | ||
| 2957 | return Menu::getInstance()->getVoxelSizeScale(); | ||
| 2958 | } | ||
| 2959 | |||
| 2960 | int Application::getBoundaryLevelAdjust() const { | ||
| 2961 | return Menu::getInstance()->getBoundaryLevelAdjust(); | ||
| 2962 | } | ||
| 2963 | |||
| 2964 | PickRay Application::computePickRay(float x, float y) { | ||
| 2965 | return getCamera()->computePickRay(x, y); | ||
| 2966 | } | ||
| 2967 | |||
| 2947 | QImage Application::renderAvatarBillboard() { | 2968 | QImage Application::renderAvatarBillboard() { |
| 2948 | DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind(); | 2969 | DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind(); |
| 2949 | 2970 | ||
| @@ -2951,7 +2972,9 @@ QImage Application::renderAvatarBillboard() { · 1 unmodified line | |||
| 2951 | Glower glower; | 2972 | Glower glower; |
| 2952 | 2973 | ||
| 2953 | const int BILLBOARD_SIZE = 64; | 2974 | const int BILLBOARD_SIZE = 64; |
| 2954 | renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE, BILLBOARD_SIZE, BILLBOARD_SIZE), true); | 2975 | renderRearViewMirror(QRect(0, DependencyManager::get<GLCanvas>()->getDeviceHeight() - BILLBOARD_SIZE, |
| 2976 | BILLBOARD_SIZE, BILLBOARD_SIZE), | ||
| 2977 | true); | ||
| 2955 | 2978 | ||
| 2956 | QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32); | 2979 | QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32); |
| 2957 | glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits()); | 2980 | glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits()); |
| @@ -3254,8 +3277,9 @@ bool Application::getCascadeShadowsEnabled() { · 296 unmodified lines | |||
| 3254 | } | 3277 | } |
| 3255 | 3278 | ||
| 3256 | glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { | 3279 | glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { |
| 3257 | float horizontalScale = _glWidget->getDeviceWidth() / 2.0f; | 3280 | GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>(); |
| 3258 | float verticalScale = _glWidget->getDeviceHeight() / 2.0f; | 3281 | float horizontalScale = glCanvas->getDeviceWidth() / 2.0f; |
| 3282 | float verticalScale = glCanvas->getDeviceHeight() / 2.0f; | ||
| 3259 | 3283 | ||
| 3260 | // -1,-1 is 0,windowHeight | 3284 | // -1,-1 is 0,windowHeight |
| 3261 | // 1,1 is windowWidth,0 | 3285 | // 1,1 is windowWidth,0 |
| @@ -3274,7 +3298,7 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { · 12 unmodified lines | |||
| 3274 | // -1,-1 1,-1 | 3298 | // -1,-1 1,-1 |
| 3275 | 3299 | ||
| 3276 | glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale, | 3300 | glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale, |
| 3277 | ((projectedPoint.y + 1.0) * -verticalScale) + _glWidget->getDeviceHeight()); | 3301 | ((projectedPoint.y + 1.0) * -verticalScale) + glCanvas->getDeviceHeight()); |
| 3278 | 3302 | ||
| 3279 | return screenPoint; | 3303 | return screenPoint; |
| 3280 | } | 3304 | } |
| @@ -3585,7 +3609,7 @@ void Application::resetSensors() { · 304 unmodified lines | |||
| 3585 | QScreen* currentScreen = _window->windowHandle()->screen(); | 3609 | QScreen* currentScreen = _window->windowHandle()->screen(); |
| 3586 | QWindow* mainWindow = _window->windowHandle(); | 3610 | QWindow* mainWindow = _window->windowHandle(); |
| 3587 | QPoint windowCenter = mainWindow->geometry().center(); | 3611 | QPoint windowCenter = mainWindow->geometry().center(); |
| 3588 | _glWidget->cursor().setPos(currentScreen, windowCenter); | 3612 | DependencyManager::get<GLCanvas>()->cursor().setPos(currentScreen, windowCenter); |
| 3589 | 3613 | ||
| 3590 | _myAvatar->reset(); | 3614 | _myAvatar->reset(); |
| 3591 | 3615 | ||
| @@ -4021,7 +4045,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 429 unmodified lines | |||
| 4021 | scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance()); | 4045 | scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance()); |
| 4022 | scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance()); | 4046 | scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance()); |
| 4023 | scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance()); | 4047 | scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance()); |
| 4024 | scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>()); | 4048 | scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data()); |
| 4025 | scriptEngine->registerGlobalObject("SoundCache", &SoundCache::getInstance()); | 4049 | scriptEngine->registerGlobalObject("SoundCache", &SoundCache::getInstance()); |
| 4026 | scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance()); | 4050 | scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance()); |
| 4027 | scriptEngine->registerGlobalObject("Metavoxels", &_metavoxels); | 4051 | scriptEngine->registerGlobalObject("Metavoxels", &_metavoxels); |
| @@ -4266,7 +4290,8 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio · 238 unmodified lines | |||
| 4266 | 4290 | ||
| 4267 | void Application::loadDialog() { | 4291 | void Application::loadDialog() { |
| 4268 | 4292 | ||
| 4269 | QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Open Script"), | 4293 | QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get<GLCanvas>().data(), |
| 4294 | tr("Open Script"), | ||
| 4270 | getPreviousScriptLocation(), | 4295 | getPreviousScriptLocation(), |
| 4271 | tr("JavaScript Files (*.js)")); | 4296 | tr("JavaScript Files (*.js)")); |
| 4272 | if (!fileNameString.isEmpty()) { | 4297 | if (!fileNameString.isEmpty()) { |
| @@ -4302,7 +4327,7 @@ void Application::loadScriptURLDialog() { · 29 unmodified lines | |||
| 4302 | 4327 | ||
| 4303 | void Application::toggleLogDialog() { | 4328 | void Application::toggleLogDialog() { |
| 4304 | if (! _logDialog) { | 4329 | if (! _logDialog) { |
| 4305 | _logDialog = new LogDialog(_glWidget, getLogger()); | 4330 | _logDialog = new LogDialog(DependencyManager::get<GLCanvas>().data(), getLogger()); |
| 4306 | } | 4331 | } |
| 4307 | 4332 | ||
| 4308 | if (_logDialog->isVisible()) { | 4333 | if (_logDialog->isVisible()) { |
| @@ -4362,7 +4387,7 @@ void Application::parseVersionXml() { · 53 unmodified lines | |||
| 4362 | } | 4387 | } |
| 4363 | 4388 | ||
| 4364 | if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) { | 4389 | if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) { |
| 4365 | new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl); | 4390 | new UpdateDialog(DependencyManager::get<GLCanvas>().data(), releaseNotes, latestVersion, downloadUrl); |
| 4366 | } | 4391 | } |
| 4367 | sender->deleteLater(); | 4392 | sender->deleteLater(); |
| 4368 | } | 4393 | } |
| @@ -4395,7 +4420,7 @@ void Application::takeSnapshot() { · 26 unmodified lines | |||
| 4395 | } | 4420 | } |
| 4396 | 4421 | ||
| 4397 | if (!_snapshotShareDialog) { | 4422 | if (!_snapshotShareDialog) { |
| 4398 | _snapshotShareDialog = new SnapshotShareDialog(fileName, _glWidget); | 4423 | _snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get<GLCanvas>().data()); |
| 4399 | } | 4424 | } |
| 4400 | _snapshotShareDialog->show(); | 4425 | _snapshotShareDialog->show(); |
| 4401 | } | 4426 | } |