Update SGCT to enable taking screenshots of individual windows

This commit is contained in:
Alexander Bock
2022-01-07 12:00:00 +01:00
parent c78ff28109
commit 2222d3d9e0
5 changed files with 21 additions and 5 deletions
+2 -2
View File
@@ -865,11 +865,11 @@ void setSgctDelegateFunctions() {
currentWindow->viewports().front()->nonLinearProjection()
) != nullptr;
};
sgctDelegate.takeScreenshot = [](bool applyWarping) {
sgctDelegate.takeScreenshot = [](bool applyWarping, std::vector<int> windowIds) {
ZoneScoped
Settings::instance().setCaptureFromBackBuffer(applyWarping);
Engine::instance().takeScreenshot();
Engine::instance().takeScreenshot(std::move(windowIds));
return Engine::instance().screenShotNumber();
};
sgctDelegate.swapBuffer = []() {
+2 -1
View File
@@ -76,7 +76,8 @@ struct WindowDelegate {
bool (*isFisheyeRendering)() = []() { return false; };
unsigned int (*takeScreenshot)(bool applyWarping) = [](bool) { return 0u; };
unsigned int (*takeScreenshot)(bool applyWarping, std::vector<int> windowIds) =
[](bool, std::vector<int>) { return 0u; };
void (*swapBuffer)() = []() {};
@@ -28,6 +28,7 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/list/intlistproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
@@ -177,6 +178,7 @@ private:
properties::BoolProperty _showVersionInfo;
properties::BoolProperty _showCameraInfo;
properties::IntListProperty _screenshotWindowIds;
properties::BoolProperty _applyWarping;
properties::BoolProperty _screenshotUseDate;
properties::BoolProperty _showFrameInformation;
+14 -1
View File
@@ -130,6 +130,14 @@ namespace {
"shown on the screen"
};
constexpr openspace::properties::Property::PropertyInfo ScreenshotWindowIdsInfo = {
"ScreenshotWindowId",
"Screenshow Window Ids",
"The list of window identifiers whose screenshot will be taken the next time "
"anyone triggers a screenshot. If this list is empty (the default), all windows "
"will have their screenshot taken. Id's that do not exist are silently ignored."
};
constexpr openspace::properties::Property::PropertyInfo ApplyWarpingInfo = {
"ApplyWarpingScreenshot",
"Apply Warping to Screenshots",
@@ -277,6 +285,7 @@ RenderEngine::RenderEngine()
, _verticalLogOffset(VerticalLogOffsetInfo, 0.f, 0.f, 1.f)
, _showVersionInfo(ShowVersionInfo, true)
, _showCameraInfo(ShowCameraInfo, true)
, _screenshotWindowIds(ScreenshotWindowIdsInfo)
, _applyWarping(ApplyWarpingInfo, false)
, _screenshotUseDate(ScreenshotUseDateInfo, false)
, _showFrameInformation(ShowFrameNumberInfo, false)
@@ -342,6 +351,7 @@ RenderEngine::RenderEngine()
addProperty(_value);
addProperty(_globalBlackOutFactor);
addProperty(_screenshotWindowIds);
addProperty(_applyWarping);
_screenshotUseDate.onChange([this]() {
@@ -1046,7 +1056,10 @@ void RenderEngine::takeScreenshot() {
std::filesystem::create_directories(absPath("${SCREENSHOTS}"));
}
_latestScreenshotNumber = global::windowDelegate->takeScreenshot(_applyWarping);
_latestScreenshotNumber = global::windowDelegate->takeScreenshot(
_applyWarping,
_screenshotWindowIds
);
}
unsigned int RenderEngine::latestScreenshotNumber() const {