iw = 1.0f / out[3];
out[0] = r_view_x + (out[0] * iw + 1.0f) * r_view_width * 0.5f;
out[1] = r_view_y + (out[1] * iw + 1.0f) * r_view_height * 0.5f;
- out[2] = out[2] * iw;
+ out[2] = r_view_z + (out[2] * iw + 1.0f) * r_view_depth * 0.5f;
}
// called at beginning of frame
==============================================================================
*/
-qboolean SCR_ScreenShot(char *filename, int x, int y, int width, int height, qboolean jpeg)
+qboolean SCR_ScreenShot(char *filename, qbyte *buffer1, qbyte *buffer2, qbyte *buffer3, 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;
if (!r_render.integer)
return false;
- buffer = Mem_Alloc(tempmempool, width*height*3);
- qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer);
+ 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, buffer3);
- Mem_Free(buffer);
return ret;
}
float CalcFov (float fov_x, float width, float height)
{
// calculate vision size and alter by aspect, then convert back to angle
- return atan (height / (width / tan(fov_x/360*M_PI))) * 360 / M_PI;
+ return atan (((height/width)/vid_pixelaspect.value)*tan(fov_x/360.*M_PI))*360./M_PI;
}
/*