else
sprintf(filename, "%s%06d.tga", base, shotnumber);
- if (SCR_ScreenShot(filename, vid.realx, vid.realy, vid.realwidth, vid.realheight, jpeg))
+ if (SCR_ScreenShot(filename, vid.realx, vid.realy, vid.realwidth, vid.realheight, false, false, false, jpeg))
Con_Printf("Wrote %s\n", filename);
else
Con_Printf("unable to write %s\n", filename);
else
sprintf(filename, "video/dp%06d.tga", cl_avidemo_frame);
- if (SCR_ScreenShot(filename, vid.realx, vid.realy, vid.realwidth, vid.realheight, jpeg))
+ if (SCR_ScreenShot(filename, vid.realx, vid.realy, vid.realwidth, vid.realheight, false, false, false, jpeg))
cl_avidemo_frame++;
else
{
{
float angles[3];
char *name;
+ qboolean flipx, flipy;
}
envmapinfo[6] =
{
- {{ 0, 0, 0}, "ft"},
- {{ 0, 90, 0}, "rt"},
- {{ 0, 180, 0}, "bk"},
- {{ 0, 270, 0}, "lf"},
- {{-90, 90, 0}, "up"},
- {{ 90, 90, 0}, "dn"}
+ {{ 0, 0, 0}, "rt", true, false},
+ {{ 0, 90, 0}, "ft", true, false},
+ {{ 0, 180, 0}, "lf", true, false},
+ {{ 0, 270, 0}, "bk", true, false},
+ {{-90, 180, 0}, "up", false, true},
+ {{ 90, 180, 0}, "dn", false, true}
};
static void R_Envmap_f (void)
sprintf(filename, "env/%s%s.tga", basename, envmapinfo[j].name);
Matrix4x4_CreateFromQuakeEntity(&r_refdef.viewentitymatrix, r_vieworigin[0], r_vieworigin[1], r_vieworigin[2], envmapinfo[j].angles[0], envmapinfo[j].angles[1], envmapinfo[j].angles[2], 1);
R_ClearScreen();
+ R_Mesh_Start();
R_RenderView();
- SCR_ScreenShot(filename, vid.realx, vid.realy + vid.realheight - (r_refdef.y + r_refdef.height), size, size, false);
+ R_Mesh_Finish();
+ SCR_ScreenShot(filename, vid.realx, vid.realy + vid.realheight - (r_refdef.y + r_refdef.height), size, size, envmapinfo[j].flipx, envmapinfo[j].flipy, false, false);
}
envmap = false;
==============================================================================
*/
-qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qboolean jpeg)
+qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qboolean flipx, qboolean flipy, qboolean flipdiagonal, qboolean jpeg)
{
+ int indices[3] = {0,1,2};
qboolean ret;
- qbyte *buffer;
+ qbyte *buffer1, *buffer2;
if (!r_render.integer)
return false;
- buffer = Mem_Alloc(tempmempool, width*height*3);
- qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer);
+ buffer1 = Mem_Alloc(tempmempool, width*height*3);
+ buffer2 = Mem_Alloc(tempmempool, width*height*3);
+ qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer1);
CHECKGLERROR
+ Image_CopyMux (buffer2, buffer1, width, height, flipx, flipy, flipdiagonal, 3, 3, indices);
+
if (jpeg)
- ret = JPEG_SaveImage_preflipped (filename, width, height, buffer);
+ ret = JPEG_SaveImage_preflipped (filename, width, height, buffer2);
else
- ret = Image_WriteTGARGB_preflipped (filename, width, height, buffer);
+ ret = Image_WriteTGARGB_preflipped (filename, width, height, buffer2);
- Mem_Free(buffer);
+ Mem_Free(buffer1);
+ Mem_Free(buffer2);
return ret;
}
void R_Mesh_Draw_ShowTris(int numverts, int numtriangles, const int *elements);
// saves a section of the rendered frame to a .tga or .jpg file
-qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qboolean jpeg);
+qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qboolean flipx, qboolean flipy, qboolean flipdiagonal, qboolean jpeg);
// used by R_Envmap_f and internally in backend, clears the frame
void R_ClearScreen(void);
// invoke refresh of frame