mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-05-31 09:11:43 +00:00
- cleanup of savegame picture code.
* re-added screen blends for images from the hardware renderer. * moved all postprocessing of the image out of the renderers. * cleaned out a large piece of cruft for handling the palette in the frame buffer class. This was all a remnant of the old paletted backend that no longer exists. Nowadays the screen blend is just a postprocessing effect drawn over the 3D screen, there is no need to maintain any of it as global state anymore. * since the engine doesn't produce paletted screenshots anymore there is no need to have handling for it in the generation code. This depended on otherwise obsolete information so it got removed along with that information.
This commit is contained in:
parent
392ba7ed2e
commit
b7d09c95dd
14 changed files with 62 additions and 120 deletions
|
@ -67,6 +67,8 @@ EXTERN_CVAR(Bool, cl_capfps)
|
|||
|
||||
extern bool NoInterpolateView;
|
||||
|
||||
void DoWriteSavePic(FileWriter *file, ESSType ssformat, uint8_t *scr, int width, int height, sector_t *viewsector, bool upsidedown);
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
|
@ -370,9 +372,11 @@ void FGLRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, i
|
|||
// strictly speaking not needed as the glReadPixels should block until the scene is rendered, but this is to safeguard against shitty drivers
|
||||
glFinish();
|
||||
|
||||
uint8_t * scr = (uint8_t *)M_Malloc(width * height * 3);
|
||||
int numpixels = width * height;
|
||||
uint8_t * scr = (uint8_t *)M_Malloc(numpixels * 3);
|
||||
glReadPixels(0,0,width, height,GL_RGB,GL_UNSIGNED_BYTE,scr);
|
||||
M_CreatePNG (file, scr + ((height-1) * width * 3), NULL, SS_RGB, width, height, -width * 3, Gamma);
|
||||
|
||||
DoWriteSavePic(file, SS_RGB, scr, width, height, viewsector, true);
|
||||
M_Free(scr);
|
||||
|
||||
// Switch back the screen render buffers
|
||||
|
|
|
@ -208,10 +208,11 @@ void FSoftwareRenderer::RenderView(player_t *player, DCanvas *target, void *vide
|
|||
});
|
||||
}
|
||||
|
||||
void DoWriteSavePic(FileWriter *file, ESSType ssformat, uint8_t *scr, int width, int height, sector_t *viewsector, bool upsidedown);
|
||||
|
||||
void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, int height)
|
||||
{
|
||||
DCanvas pic(width, height, false);
|
||||
PalEntry palette[256];
|
||||
|
||||
// Take a snapshot of the player's view
|
||||
if (V_IsPolyRenderer())
|
||||
|
@ -230,11 +231,7 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
|
|||
r_viewpoint = mScene.MainThread()->Viewport->viewpoint;
|
||||
r_viewwindow = mScene.MainThread()->Viewport->viewwindow;
|
||||
}
|
||||
auto blend = screen->CalcBlend(r_viewpoint.sector, nullptr);
|
||||
const PalEntry bcolor(255, uint8_t(blend.X), uint8_t(blend.Y), uint8_t(blend.Z));
|
||||
screen->SetFlash(bcolor, int(blend.W * 256));
|
||||
screen->GetFlashedPalette (palette);
|
||||
M_CreatePNG (file, pic.GetPixels(), palette, SS_PAL, width, height, pic.GetPitch(), Gamma);
|
||||
DoWriteSavePic(file, SS_PAL, pic.GetPixels(), width, height, r_viewpoint.sector, false);
|
||||
}
|
||||
|
||||
void FSoftwareRenderer::DrawRemainingPlayerSprites()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue