History

Merge pull request #15405 from SamGondelman/stencil2

Case 20060: Grab correct stencil masks from display plugins

Sam Gateau committed 7 years ago

Commit dfce7dc2 parents 4148ebf 48aef3e28 files · +360 −142Browse files

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

Unified · Split

interface/src/Application.cpp+29−11
@@ -6723,6 +6723,11 @@ void Application::updateRenderArgs(float deltaTime) { · 6722 unmodified lines
67236723 }
67246724 }
67256725
6726+ appRenderArgs._renderArgs._stencilMaskMode = getActiveDisplayPlugin()->getStencilMaskMode();
6727+ if (appRenderArgs._renderArgs._stencilMaskMode == StencilMaskMode::MESH) {
6728+ appRenderArgs._renderArgs._stencilMaskOperator = getActiveDisplayPlugin()->getStencilMaskMeshOperator();
6729+ }
6730+
67266731 {
67276732 QMutexLocker viewLocker(&_viewMutex);
67286733 _myCamera.loadViewFrustum(_displayViewFrustum);
@@ -8410,11 +8415,23 @@ void Application::loadAvatarBrowser() const { · 1681 unmodified lines
84108415 DependencyManager::get<HMDScriptingInterface>()->openTablet();
84118416 }
84128417
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+
84138432 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());
84188435
84198436 // If we're not doing an animated snapshot as well...
84208437 if (!includeAnimated) {
@@ -8423,19 +8440,20 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa · 2 unmodified lines
84238440 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);
84248441 }
84258442 } 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+ });
84288447 }
8429− });
8448+ }, aspectRatio, true));
84308449 }
84318450
84328451 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());
84368454
84378455 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);
8438− });
8456+ }, 0.0f, false));
84398457 }
84408458
84418459 void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) {