Skip to content
Snippets Groups Projects

Accumulation in Viewer Screenshots

Merged Jonathan Kunstwald requested to merge feature/variable-screenshot-accumulation into develop
4 files
+ 18
4
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -111,13 +111,16 @@ void ViewerApp::updateLayoutNodes(float dt, tg::ivec2 size)
layout::build_linear_nodes(rootNode, {0, 0}, size, mLayoutNodes, mSubviewMargin);
}
void ViewerApp::renderFrame(int width, int height)
void ViewerApp::renderFrame(int width, int height, bool maximizeSamples)
{
#ifdef GLOW_EXTRAS_OPENGL_DEBUG_GROUPS
GLOW_SCOPED(debugGroup, "Render Viewer");
#endif
mRenderer.beginFrame(mSubviewMarginColor);
if (maximizeSamples)
mRenderer.maximizeSamples();
for (auto& node : mLayoutNodes)
{
#ifdef GLOW_EXTRAS_OPENGL_DEBUG_GROUPS
@@ -139,7 +142,7 @@ void ViewerApp::renderFrame(int width, int height)
}
}
mRenderer.endFrame(getLastGpuTimeMs());
mRenderer.endFrame(maximizeSamples ? 0.f : getLastGpuTimeMs());
}
void ViewerApp::resetCameraToScene()
@@ -446,6 +449,8 @@ void ViewerApp::onGui()
ImGui::Checkbox("Show non-transparent pixels", &mShowNonTransparentPixels);
ImGui::SliderInt("Accumulation Count", &mScreenshotAccumulationCount, 1, 64);
ImGui::Checkbox("Custom Resolution", &mScreenshotCustomRes);
if (ImGui::SliderInt("Screenshot Width", &mScreenshotWidth, 1, 16000))
mScreenshotCustomRes = true;
@@ -477,7 +482,8 @@ void ViewerApp::renderScreenshot(const std::string& filename, int w, int h)
{
auto fbo = temporaryFbo->bind();
renderFrame(screenW, screenH);
for (auto _ = 0; _ < mScreenshotAccumulationCount; ++_)
renderFrame(screenW, screenH, true);
}
target->bind().writeToFile(filename);
Loading