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
18611861
18621862 if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {
18631863 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();
18701864 }
18711865
18721866 {
@@ -2337,7 +2331,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 464 unmodified lines
23372331 DependencyManager::get<PickManager>()->setPrecisionPicking(rayPickID, value);
23382332 });
23392333
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) {
23412335 if (billboardMode == BillboardMode::YAW) {
23422336 //rotate about vertical to face the camera
23432337 glm::vec3 dPosition = frustumPos - position;
@@ -2365,7 +2359,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 21 unmodified lines
23652359
23662360 DependencyManager::get<UsersScriptingInterface>()->setKickConfirmationOperator([this] (const QUuid& nodeID) { userKickConfirmation(nodeID); });
23672361
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) {
23692363 bool isTablet = url == TabletScriptingInterface::QML;
23702364 if (htmlContent) {
23712365 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
24052399 const uint8_t TABLET_FPS = 90;
24062400 webSurface->setMaxFps(isTablet ? TABLET_FPS : DEFAULT_MAX_FPS);
24072401 });
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) {
24092403 QQuickItem* rootItem = webSurface->getRootItem();
24102404
24112405 // Fix for crash in QtWebEngineCore when rapidly switching domains
@@ -5758,9 +5752,6 @@ void Application::cycleCamera() { · 3346 unmodified lines
57585752 menu->setIsOptionChecked(MenuOption::ThirdPerson, false);
57595753 menu->setIsOptionChecked(MenuOption::FullscreenMirror, true);
57605754
5761− } else if (menu->isOptionChecked(MenuOption::IndependentMode) || menu->isOptionChecked(MenuOption::CameraEntityMode)) {
5762− // do nothing if in independent or camera entity modes
5763− return;
57645755 }
57655756 cameraMenuChanged(); // handle the menu change
57665757 }
@@ -5776,12 +5767,6 @@ void Application::cameraModeChanged() { · 9 unmodified lines
57765767 case CAMERA_MODE_MIRROR:
57775768 Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, true);
57785769 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;
57855770 default:
57865771 break;
57875772 }
@@ -5825,14 +5810,6 @@ void Application::cameraMenuChanged() { · 37 unmodified lines
58255810 getMyAvatar()->setBoomLength(MyAvatar::ZOOM_DEFAULT);
58265811 }
58275812 }
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− }
58365813 }
58375814 }
58385815
@@ -6747,6 +6724,11 @@ void Application::updateRenderArgs(float deltaTime) { · 908 unmodified lines
67476724 }
67486725 }
67496726
6727+ appRenderArgs._renderArgs._stencilMaskMode = getActiveDisplayPlugin()->getStencilMaskMode();
6728+ if (appRenderArgs._renderArgs._stencilMaskMode == StencilMaskMode::MESH) {
6729+ appRenderArgs._renderArgs._stencilMaskOperator = getActiveDisplayPlugin()->getStencilMaskMeshOperator();
6730+ }
6731+
67506732 {
67516733 QMutexLocker viewLocker(&_viewMutex);
67526734 _myCamera.loadViewFrustum(_displayViewFrustum);
@@ -8434,11 +8416,23 @@ void Application::loadAvatarBrowser() const { · 1681 unmodified lines
84348416 DependencyManager::get<HMDScriptingInterface>()->openTablet();
84358417 }
84368418
8419+void 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+
8425+bool 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+
84378433 void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) {
8438− postLambdaEvent([notify, includeAnimated, aspectRatio, filename, this] {
8439− // Get a screenshot and save it
8440− QString path = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio), filename,
8441− TestScriptingInterface::getInstance()->getTestResultsLocation());
8434+ addSnapshotOperator(std::make_tuple([notify, includeAnimated, aspectRatio, filename](const QImage& snapshot) {
8435+ QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
84428436
84438437 // If we're not doing an animated snapshot as well...
84448438 if (!includeAnimated) {
@@ -8447,19 +8441,20 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa · 2 unmodified lines
84478441 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);
84488442 }
84498443 } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {
8450− // Get an animated GIF snapshot and save it
8451− SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, qApp, DependencyManager::get<WindowScriptingInterface>());
8444+ qApp->postLambdaEvent([path, aspectRatio] {
8445+ // Get an animated GIF snapshot and save it
8446+ SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, DependencyManager::get<WindowScriptingInterface>());
8447+ });
84528448 }
8453− });
8449+ }, aspectRatio, true));
84548450 }
84558451
84568452 void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {
8457− postLambdaEvent([notify, filename, this] {
8458− QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getSecondaryCameraScreenshot(), filename,
8459− TestScriptingInterface::getInstance()->getTestResultsLocation());
8453+ addSnapshotOperator(std::make_tuple([notify, filename](const QImage& snapshot) {
8454+ QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
84608455
84618456 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);
8462− });
8457+ }, 0.0f, false));
84638458 }
84648459
84658460 void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) {