From 06545a90613fc6e6240138ed49c3d754d23a5f7c Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 22 Jul 2013 14:47:00 +0000 Subject: [PATCH] fix alpha screenshots git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11976 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=25c58f3e1261fe284d0baff0dc2cd058418a0b90 --- cl_screen.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cl_screen.c b/cl_screen.c index bf562e0c..d64a5f62 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -53,7 +53,7 @@ cvar_t scr_screenshot_jpeg_quality = {CVAR_SAVE, "scr_screenshot_jpeg_quality"," cvar_t scr_screenshot_png = {CVAR_SAVE, "scr_screenshot_png","0", "save png instead of targa"}; cvar_t scr_screenshot_gammaboost = {CVAR_SAVE, "scr_screenshot_gammaboost","1", "gamma correction on saved screenshots and videos, 1.0 saves unmodified images"}; cvar_t scr_screenshot_hwgamma = {CVAR_SAVE, "scr_screenshot_hwgamma","1", "apply the video gamma ramp to saved screenshots and videos"}; -cvar_t scr_screenshot_alpha = {CVAR_SAVE, "scr_screenshot_alpha","0", "try to write an alpha channel to screenshots (debugging feature)"}; +cvar_t scr_screenshot_alpha = {0, "scr_screenshot_alpha","0", "try to write an alpha channel to screenshots (debugging feature)"}; cvar_t scr_screenshot_timestamp = {CVAR_SAVE, "scr_screenshot_timestamp", "1", "use a timestamp based number of the type YYYYMMDDHHMMSSsss instead of sequential numbering"}; // scr_screenshot_name is defined in fs.c cvar_t cl_capturevideo = {0, "cl_capturevideo", "0", "enables saving of video to a .avi file using uncompressed I420 colorspace and PCM audio, note that scr_screenshot_gammaboost affects the brightness of the output)"}; @@ -2071,8 +2071,12 @@ static void SCR_DrawTouchscreenOverlay(void) void R_ClearScreen(qboolean fogcolor) { float clearcolor[4]; - // clear to opaque black (if we're being composited it might otherwise render as transparent) - Vector4Set(clearcolor, 0.0f, 0.0f, 0.0f, 1.0f); + if (scr_screenshot_alpha.integer) + // clear to transparency (so png screenshots can contain alpha channel, useful for building model pictures) + Vector4Set(clearcolor, 0.0f, 0.0f, 0.0f, 0.0f); + else + // clear to opaque black (if we're being composited it might otherwise render as transparent) + Vector4Set(clearcolor, 0.0f, 0.0f, 0.0f, 1.0f); if (fogcolor && r_fog_clear.integer) { R_UpdateFog(); -- 2.39.2