Skip to content

Commit 2b71e3a

Browse files
authored
Use the output size when rendering screenshots (#1007)
1 parent d2a94b4 commit 2b71e3a

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎common/graphics/renderer.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,12 +2708,12 @@ void Renderer::drawAmbient(Encoder<CommandBuffer>& cmd, const WorldView& view) {
27082708
cmd.draw(nullptr, 0, 3);
27092709
}
27102710

2711-
Tempest::Attachment Renderer::screenshoot(uint8_t frameId) {
2711+
Tempest::Attachment Renderer::screenshoot(uint8_t frameId, Tempest::Size size) {
27122712
auto& device = Resources::device();
27132713
device.waitIdle();
27142714

2715-
uint32_t w = uint32_t(zbuffer.w());
2716-
uint32_t h = uint32_t(zbuffer.h());
2715+
uint32_t w = uint32_t(size.w);
2716+
uint32_t h = uint32_t(size.h);
27172717
auto img = device.attachment(Tempest::TextureFormat::RGBA8,w,h);
27182718

27192719
auto wview = Gothic::inst().worldView();

‎common/graphics/renderer.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Renderer final {
3232

3333
void dbgDraw(Tempest::Painter& painter);
3434

35-
Tempest::Attachment screenshoot(uint8_t frameId);
35+
Tempest::Attachment screenshoot(uint8_t frameId, Tempest::Size size);
3636

3737
private:
3838
enum Quality : uint8_t {

‎common/mainwindow.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ void MainWindow::keyDownEvent(KeyEvent &event) {
458458
player.onKeyPressed(act,event.key,mapping);
459459

460460
if(event.key==Event::K_F11) {
461-
auto tex = renderer.screenshoot(cmdId);
461+
auto tex = renderer.screenshoot(cmdId, Size(int(swapchain.w()),int(swapchain.h())));
462462
auto pm = device.readPixels(textureCast<const Texture2d&>(tex));
463463
pm.save("dbg.png");
464464
}
@@ -1074,7 +1074,7 @@ void MainWindow::saveGame(std::string_view slot, std::string_view name) {
10741074
if(auto w = Gothic::inst().world(); w!=nullptr && w->currentCs()!=nullptr)
10751075
return;
10761076

1077-
auto tex = renderer.screenshoot(cmdId);
1077+
auto tex = renderer.screenshoot(cmdId, Size(int(swapchain.w()),int(swapchain.h())));
10781078
auto lres = Attachment();
10791079

10801080
static int32_t kThumbW = 800;

0 commit comments

Comments
 (0)