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
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 QMutexLocker viewLocker(&_viewMutex);6732 QMutexLocker viewLocker(&_viewMutex);
6728 _myCamera.loadViewFrustum(_displayViewFrustum);6733 _myCamera.loadViewFrustum(_displayViewFrustum);
@@ -8410,11 +8415,23 @@ void Application::loadAvatarBrowser() const { · 1681 unmodified lines
8410 DependencyManager::get<HMDScriptingInterface>()->openTablet();8415 DependencyManager::get<HMDScriptingInterface>()->openTablet();
8411}8416}
8412 8417
8418void 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
8424bool 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
8413void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) {8432void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) {
8414 postLambdaEvent([notify, includeAnimated, aspectRatio, filename, this] {8433 addSnapshotOperator(std::make_tuple([notify, includeAnimated, aspectRatio, filename](const QImage& snapshot) {
8415 // Get a screenshot and save it8434 QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
8416 QString path = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio), filename,
8417 TestScriptingInterface::getInstance()->getTestResultsLocation());
8418 8435
8419 // If we're not doing an animated snapshot as well...8436 // If we're not doing an animated snapshot as well...
8420 if (!includeAnimated) {8437 if (!includeAnimated) {
@@ -8423,19 +8440,20 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa · 2 unmodified lines
8423 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);8440 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);
8424 }8441 }
8425 } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {8442 } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {
8426 // Get an animated GIF snapshot and save it8443 qApp->postLambdaEvent([path, aspectRatio] {
8427 SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, qApp, DependencyManager::get<WindowScriptingInterface>());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
8432void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {8451void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) {
8433 postLambdaEvent([notify, filename, this] {8452 addSnapshotOperator(std::make_tuple([notify, filename](const QImage& snapshot) {
8434 QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getSecondaryCameraScreenshot(), filename,8453 QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation());
8435 TestScriptingInterface::getInstance()->getTestResultsLocation());
8436 8454
8437 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);8455 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);
8438 });8456 }, 0.0f, false));
8439}8457}
8440 8458
8441void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) {8459void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) {