History

Merge remote-tracking branch 'upstream/master' into avatar-verification

Simon Walton committed 7 years ago

Commit f3efee52 parents a875ad2 164984b137 files · +4383 −2146Browse files

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

Unified · Split

interface/src/Application.cpp+32−37
@@ -1861,12 +1861,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1860 unmodified lines
1861 1861
1862 if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {1862 if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {
1863 getMyAvatar()->setBoomLength(MyAvatar::ZOOM_MIN); // So that camera doesn't auto-switch to third person.1863 getMyAvatar()->setBoomLength(MyAvatar::ZOOM_MIN); // So that camera doesn't auto-switch to third person.
1864 } else if (Menu::getInstance()->isOptionChecked(MenuOption::IndependentMode)) {
1865 Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, true);
1866 cameraMenuChanged();
1867 } else if (Menu::getInstance()->isOptionChecked(MenuOption::CameraEntityMode)) {
1868 Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, true);
1869 cameraMenuChanged();
1870 }1864 }
1871 1865
1872 {1866 {
@@ -2337,7 +2331,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 464 unmodified lines
2337 DependencyManager::get<PickManager>()->setPrecisionPicking(rayPickID, value);2331 DependencyManager::get<PickManager>()->setPrecisionPicking(rayPickID, value);
2338 });2332 });
2339 2333
2340 EntityItem::setBillboardRotationOperator([this](const glm::vec3& position, const glm::quat& rotation, BillboardMode billboardMode, const glm::vec3& frustumPos) {2334 EntityItem::setBillboardRotationOperator([](const glm::vec3& position, const glm::quat& rotation, BillboardMode billboardMode, const glm::vec3& frustumPos) {
2341 if (billboardMode == BillboardMode::YAW) {2335 if (billboardMode == BillboardMode::YAW) {
2342 //rotate about vertical to face the camera2336 //rotate about vertical to face the camera
2343 glm::vec3 dPosition = frustumPos - position;2337 glm::vec3 dPosition = frustumPos - position;
@@ -2365,7 +2359,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 21 unmodified lines
2365 2359
2366 DependencyManager::get<UsersScriptingInterface>()->setKickConfirmationOperator([this] (const QUuid& nodeID) { userKickConfirmation(nodeID); });2360 DependencyManager::get<UsersScriptingInterface>()->setKickConfirmationOperator([this] (const QUuid& nodeID) { userKickConfirmation(nodeID); });
2367 2361
2368 render::entities::WebEntityRenderer::setAcquireWebSurfaceOperator([this](const QString& url, bool htmlContent, QSharedPointer<OffscreenQmlSurface>& webSurface, bool& cachedWebSurface) {2362 render::entities::WebEntityRenderer::setAcquireWebSurfaceOperator([=](const QString& url, bool htmlContent, QSharedPointer<OffscreenQmlSurface>& webSurface, bool& cachedWebSurface) {
2369 bool isTablet = url == TabletScriptingInterface::QML;2363 bool isTablet = url == TabletScriptingInterface::QML;
2370 if (htmlContent) {2364 if (htmlContent) {
2371 webSurface = DependencyManager::get<OffscreenQmlSurfaceCache>()->acquire(render::entities::WebEntityRenderer::QML);2365 webSurface = DependencyManager::get<OffscreenQmlSurfaceCache>()->acquire(render::entities::WebEntityRenderer::QML);
@@ -2405,7 +2399,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 33 unmodified lines
2405 const uint8_t TABLET_FPS = 90;2399 const uint8_t TABLET_FPS = 90;
2406 webSurface->setMaxFps(isTablet ? TABLET_FPS : DEFAULT_MAX_FPS);2400 webSurface->setMaxFps(isTablet ? TABLET_FPS : DEFAULT_MAX_FPS);
2407 });2401 });
2408 render::entities::WebEntityRenderer::setReleaseWebSurfaceOperator([this](QSharedPointer<OffscreenQmlSurface>& webSurface, bool& cachedWebSurface, std::vector<QMetaObject::Connection>& connections) {2402 render::entities::WebEntityRenderer::setReleaseWebSurfaceOperator([=](QSharedPointer<OffscreenQmlSurface>& webSurface, bool& cachedWebSurface, std::vector<QMetaObject::Connection>& connections) {
2409 QQuickItem* rootItem = webSurface->getRootItem();2403 QQuickItem* rootItem = webSurface->getRootItem();
2410 2404
2411 // Fix for crash in QtWebEngineCore when rapidly switching domains2405 // Fix for crash in QtWebEngineCore when rapidly switching domains
@@ -5758,9 +5752,6 @@ void Application::cycleCamera() { · 3346 unmodified lines
5758 menu->setIsOptionChecked(MenuOption::ThirdPerson, false);5752 menu->setIsOptionChecked(MenuOption::ThirdPerson, false);
5759 menu->setIsOptionChecked(MenuOption::FullscreenMirror, true);5753 menu->setIsOptionChecked(MenuOption::FullscreenMirror, true);
5760 5754
5761 } else if (menu->isOptionChecked(MenuOption::IndependentMode) || menu->isOptionChecked(MenuOption::CameraEntityMode)) {
5762 // do nothing if in independent or camera entity modes
5763 return;
5764 }5755 }
5765 cameraMenuChanged(); // handle the menu change5756 cameraMenuChanged(); // handle the menu change
5766}5757}
@@ -5776,12 +5767,6 @@ void Application::cameraModeChanged() { · 9 unmodified lines
5776 case CAMERA_MODE_MIRROR:5767 case CAMERA_MODE_MIRROR:
5777 Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, true);5768 Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, true);
5778 break;5769 break;
5779 case CAMERA_MODE_INDEPENDENT:
5780 Menu::getInstance()->setIsOptionChecked(MenuOption::IndependentMode, true);
5781 break;
5782 case CAMERA_MODE_ENTITY:
5783 Menu::getInstance()->setIsOptionChecked(MenuOption::CameraEntityMode, true);
5784 break;
5785 default:5770 default:
5786 break;5771 break;
5787 }5772 }
@@ -5825,14 +5810,6 @@ void Application::cameraMenuChanged() { · 37 unmodified lines
5825 getMyAvatar()->setBoomLength(MyAvatar::ZOOM_DEFAULT);5810 getMyAvatar()->setBoomLength(MyAvatar::ZOOM_DEFAULT);
5826 }5811 }
5827 }5812 }
5828 } else if (menu->isOptionChecked(MenuOption::IndependentMode)) {
5829 if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) {
5830 _myCamera.setMode(CAMERA_MODE_INDEPENDENT);
5831 }
5832 } else if (menu->isOptionChecked(MenuOption::CameraEntityMode)) {
5833 if (_myCamera.getMode() != CAMERA_MODE_ENTITY) {
5834 _myCamera.setMode(CAMERA_MODE_ENTITY);
5835 }
5836 }5813 }
5837}5814}
5838 5815
@@ -6747,6 +6724,11 @@ void Application::updateRenderArgs(float deltaTime) { · 908 unmodified lines
6747 }6724 }
6748 }6725 }
6749 6726
6727 appRenderArgs._renderArgs._stencilMaskMode = getActiveDisplayPlugin()->getStencilMaskMode();
6728 if (appRenderArgs._renderArgs._stencilMaskMode == StencilMaskMode::MESH) {
6729 appRenderArgs._renderArgs._stencilMaskOperator = getActiveDisplayPlugin()->getStencilMaskMeshOperator();
6730 }
6731
6750 {6732 {
6751 QMutexLocker viewLocker(&_viewMutex);6733 QMutexLocker viewLocker(&_viewMutex);
6752 _myCamera.loadViewFrustum(_displayViewFrustum);6734 _myCamera.loadViewFrustum(_displayViewFrustum);
@@ -8434,11 +8416,23 @@ void Application::loadAvatarBrowser() const { · 1681 unmodified lines
8434 DependencyManager::get<HMDScriptingInterface>()->openTablet();8416 DependencyManager::get<HMDScriptingInterface>()->openTablet();
8435}8417}
8436 8418
8419void Application::addSnapshotOperator(const SnapshotOperator& snapshotOperator) {
8420 std::lock_guard<std::mutex> lock(_snapshotMutex);
8421 _snapshotOperators.push(snapshotOperator);
8422 _hasPrimarySnapshot = _hasPrimarySnapshot || std::get<2>(snapshotOperator);
8423}
8424
8425bool Application::takeSnapshotOperators(std::queue<SnapshotOperator>& snapshotOperators) {
8426 std::lock_guard<std::mutex> lock(_snapshotMutex);
8427 bool hasPrimarySnapshot = _hasPrimarySnapshot;
8428 _hasPrimarySnapshot = false;
8429 _snapshotOperators.swap(snapshotOperators);
8430 return hasPrimarySnapshot;
8431}
8432
8437void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) {8433void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) {
8438 postLambdaEvent([notify, includeAnimated, aspectRatio, filename, this] {8434 addSnapshotOperator(std::make_tuple([notify, includeAnimated, aspectRatio, filename](const QImage& snapshot) {
8439 // Get a screenshot and save it8435 QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
8440 QString path = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio), filename,
8441 TestScriptingInterface::getInstance()->getTestResultsLocation());
8442 8436
8443 // If we're not doing an animated snapshot as well...8437 // If we're not doing an animated snapshot as well...
8444 if (!includeAnimated) {8438 if (!includeAnimated) {
@@ -8447,19 +8441,20 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa · 2 unmodified lines
8447 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);8441 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);
8448 }8442 }
8449 } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {8443 } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {
8450 // Get an animated GIF snapshot and save it8444 qApp->postLambdaEvent([path, aspectRatio] {
8451 SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, qApp, DependencyManager::get<WindowScriptingInterface>());8445 // Get an animated GIF snapshot and save it
8446 SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, DependencyManager::get<WindowScriptingInterface>());
8447 });
8452 }8448 }
8453 });8449 }, aspectRatio, true));
8454}8450}
8455 8451
8456void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {8452void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {
8457 postLambdaEvent([notify, filename, this] {8453 addSnapshotOperator(std::make_tuple([notify, filename](const QImage& snapshot) {
8458 QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getSecondaryCameraScreenshot(), filename,8454 QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
8459 TestScriptingInterface::getInstance()->getTestResultsLocation());
8460 8455
8461 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);8456 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);
8462 });8457 }, 0.0f, false));
8463}8458}
8464 8459
8465void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) {8460void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) {