Skip to content

Commit

Permalink
Merge pull request #772 from Hoikas/fix_gui_screenshots
Browse files Browse the repository at this point in the history
Fix #765
  • Loading branch information
Hoikas committed Jan 13, 2021
2 parents ce1ecfc + 8037e24 commit c4e10aa
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,22 @@ void plCaptureRenderRequest::Render(plPipeline* pipe, plPageTreeMgr* pageMgr)
SetRenderState(GetRenderState() | plPipeline::kRenderClearDepth);
SetClearDepth(1);

// render all GUI items
std::vector<plPostEffectMod*> guiRenderMods = pfGameGUIMgr::GetInstance()->GetDlgRenderMods();
for (int i = (int)guiRenderMods.size() - 1; i >= 0; i--) // render in reverse, so dialogs on the bottom get rendered first
{
plPageTreeMgr* dlgPageMgr = guiRenderMods[i]->GetPageMgr();
if (dlgPageMgr)
{
SetViewTransform(guiRenderMods[i]->GetViewTransform());
// render all GUI items in reverse, so dialogs on the bottom get rendered first
pfGameGUIMgr::GetInstance()->SetAspectRatio((float)fRenderTarget->GetWidth() / (float)fRenderTarget->GetHeight());
auto guiRenderMods = pfGameGUIMgr::GetInstance()->GetDlgRenderMods();
for (auto it = guiRenderMods.rbegin(); it != guiRenderMods.rend(); ++it) {
plPageTreeMgr* dlgPageMgr = (*it)->GetPageMgr();
if (dlgPageMgr) {
auto dlgVt = (*it)->GetViewTransform();
dlgVt.SetViewPort(0, 0, fRenderTarget->GetWidth(), fRenderTarget->GetHeight());
SetViewTransform(dlgVt);
pipe->PushRenderRequest(this);
pipe->ClearRenderTarget();
dlgPageMgr->Render(pipe);
pipe->PopRenderRequest(this);
}
}
pfGameGUIMgr::GetInstance()->SetAspectRatio((float)pipe->Width() / (float)pipe->Height());

// Callback on plCaptureRender to process the render target into a mipmap
// and send it back to the requester.
Expand Down

0 comments on commit c4e10aa

Please sign in to comment.