Case 20060: Grab correct stencil masks from display plugins
Showing the changes to interface/src/Application.cpp (1 of 28 files). Show all
Unified · Split
| @@ -6723,6 +6723,11 @@ void Application::updateRenderArgs(float deltaTime) { · 6722 unmodified lines | ||
| 6723 | 6723 | } |
| 6724 | 6724 | } |
| 6725 | 6725 | |
| 6726 | + appRenderArgs._renderArgs._stencilMaskMode = getActiveDisplayPlugin()->getStencilMaskMode(); | |
| 6727 | + if (appRenderArgs._renderArgs._stencilMaskMode == StencilMaskMode::MESH) { | |
| 6728 | + appRenderArgs._renderArgs._stencilMaskOperator = getActiveDisplayPlugin()->getStencilMaskMeshOperator(); | |
| 6729 | + } | |
| 6730 | + | |
| 6726 | 6731 | { |
| 6727 | 6732 | QMutexLocker viewLocker(&_viewMutex); |
| 6728 | 6733 | _myCamera.loadViewFrustum(_displayViewFrustum); |
| @@ -8410,11 +8415,23 @@ void Application::loadAvatarBrowser() const { · 1681 unmodified lines | ||
| 8410 | 8415 | DependencyManager::get<HMDScriptingInterface>()->openTablet(); |
| 8411 | 8416 | } |
| 8412 | 8417 | |
| 8418 | +void Application::addSnapshotOperator(const SnapshotOperator& snapshotOperator) { | |
| 8419 | + std::lock_guard<std::mutex> lock(_snapshotMutex); | |
| 8420 | + _snapshotOperators.push(snapshotOperator); | |
| 8421 | + _hasPrimarySnapshot = _hasPrimarySnapshot || std::get<2>(snapshotOperator); | |
| 8422 | +} | |
| 8423 | + | |
| 8424 | +bool Application::takeSnapshotOperators(std::queue<SnapshotOperator>& snapshotOperators) { | |
| 8425 | + std::lock_guard<std::mutex> lock(_snapshotMutex); | |
| 8426 | + bool hasPrimarySnapshot = _hasPrimarySnapshot; | |
| 8427 | + _hasPrimarySnapshot = false; | |
| 8428 | + _snapshotOperators.swap(snapshotOperators); | |
| 8429 | + return hasPrimarySnapshot; | |
| 8430 | +} | |
| 8431 | + | |
| 8413 | 8432 | void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) { |
| 8414 | − postLambdaEvent([notify, includeAnimated, aspectRatio, filename, this] { | |
| 8415 | − // Get a screenshot and save it | |
| 8416 | − QString path = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio), filename, | |
| 8417 | − TestScriptingInterface::getInstance()->getTestResultsLocation()); | |
| 8433 | + addSnapshotOperator(std::make_tuple([notify, includeAnimated, aspectRatio, filename](const QImage& snapshot) { | |
| 8434 | + QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation()); | |
| 8418 | 8435 | |
| 8419 | 8436 | // If we're not doing an animated snapshot as well... |
| 8420 | 8437 | if (!includeAnimated) { |
| @@ -8423,19 +8440,20 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa · 2 unmodified lines | ||
| 8423 | 8440 | emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify); |
| 8424 | 8441 | } |
| 8425 | 8442 | } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) { |
| 8426 | − // Get an animated GIF snapshot and save it | |
| 8427 | − SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, qApp, DependencyManager::get<WindowScriptingInterface>()); | |
| 8443 | + qApp->postLambdaEvent([path, aspectRatio] { | |
| 8444 | + // Get an animated GIF snapshot and save it | |
| 8445 | + SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, DependencyManager::get<WindowScriptingInterface>()); | |
| 8446 | + }); | |
| 8428 | 8447 | } |
| 8429 | − }); | |
| 8448 | + }, aspectRatio, true)); | |
| 8430 | 8449 | } |
| 8431 | 8450 | |
| 8432 | 8451 | void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) { |
| 8433 | − postLambdaEvent([notify, filename, this] { | |
| 8434 | − QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getSecondaryCameraScreenshot(), filename, | |
| 8435 | − TestScriptingInterface::getInstance()->getTestResultsLocation()); | |
| 8452 | + addSnapshotOperator(std::make_tuple([notify, filename](const QImage& snapshot) { | |
| 8453 | + QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation()); | |
| 8436 | 8454 | |
| 8437 | 8455 | emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify); |
| 8438 | − }); | |
| 8456 | + }, 0.0f, false)); | |
| 8439 | 8457 | } |
| 8440 | 8458 | |
| 8441 | 8459 | void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) { |