From: vortex Date: Wed, 28 Apr 2010 20:19:55 +0000 (+0000) Subject: Two more options for videos - vertical align (if video is scaled) and stipple effect... X-Git-Tag: xonotic-v0.1.0preview~230^2~370 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c4dbfc4fbf19b5199c2014eaca78475f8d2afb02;p=xonotic%2Fdarkplaces.git Two more options for videos - vertical align (if video is scaled) and stipple effect (static one, no annoying scrolling), it looks nice with some low res videos. Do not render 3D view when video is played. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10107 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_video.c b/cl_video.c index f97bb0a3..90f93069 100644 --- a/cl_video.c +++ b/cl_video.c @@ -9,6 +9,8 @@ cvar_t cl_video_subtitles = {CVAR_SAVE, "cl_video_subtitles", "0", "show subtitl cvar_t cl_video_subtitles_lines = {CVAR_SAVE, "cl_video_subtitles_lines", "4", "how many lines to occupy for subtitles"}; cvar_t cl_video_subtitles_textsize = {CVAR_SAVE, "cl_video_subtitles_textsize", "16", "textsize for subtitles"}; cvar_t cl_video_scale = {CVAR_SAVE, "cl_video_scale", "1", "scale of video, 1 = fullscreen, 0.75 - 3/4 of screen etc."}; +cvar_t cl_video_scale_vpos = {CVAR_SAVE, "cl_video_scale_vpos", "0", "vertial align of scaled video, -1 is top, 1 is bottom"}; +cvar_t cl_video_stipple = {CVAR_SAVE, "cl_video_stipple", "0", "draw interlacing-like effect on videos, similar to scr_stipple but static and used only with video playing."}; cvar_t cl_video_brightness = {CVAR_SAVE, "cl_video_brightness", "1", "brightness of video, 1 = fullbright, 0.75 - 3/4 etc."}; // constants (and semi-constants) @@ -435,14 +437,13 @@ void CL_DrawVideo(void) if (cl_video_brightness.value <= 0 || cl_video_brightness.value > 10) Cvar_SetValueQuick( &cl_video_brightness, 1); -#if 0 // enable video-only polygon stipple (of global stipple is not active) - if (qglPolygonStipple && !scr_stipple.integer) + if (qglPolygonStipple && !scr_stipple.integer && cl_video_stipple.integer) { GLubyte stipple[128]; int i, s, width, parts; - s = 1; + s = cl_video_stipple.integer; parts = (s & 007); width = (s & 070) >> 3; qglEnable(GL_POLYGON_STIPPLE);CHECKGLERROR // 0x0B42 @@ -453,25 +454,23 @@ void CL_DrawVideo(void) } qglPolygonStipple(stipple);CHECKGLERROR } -#endif // draw video if (cl_video_scale.value == 1) DrawQ_Pic(0, 0, &video->cpif, vid_conwidth.integer, vid_conheight.integer, cl_video_brightness.value, cl_video_brightness.value, cl_video_brightness.value, 1, 0); else { + int px = (int)(vid_conwidth.integer * (1 - cl_video_scale.value) * 0.5); + int py = (int)(vid_conheight.integer * (1 - cl_video_scale.value) * ((bound(-1, cl_video_scale_vpos.value, 1) + 1) / 2)); + int sx = (int)(vid_conwidth.integer * cl_video_scale.value); + int sy = (int)(vid_conheight.integer * cl_video_scale.value); DrawQ_Fill(0, 0, vid_conwidth.integer, vid_conheight.integer, 0, 0, 0, 1, 0); - DrawQ_Pic((int)(vid_conwidth.integer * (1 - cl_video_scale.value) * 0.5), (int)(vid_conheight.integer * (1 - cl_video_scale.value) * 0.5), &video->cpif, (int)(vid_conwidth.integer * cl_video_scale.value), (int)(vid_conheight.integer * cl_video_scale.value), cl_video_brightness.value, cl_video_brightness.value, cl_video_brightness.value, 1, 0); + DrawQ_Pic(px, py, &video->cpif, sx , sy, cl_video_brightness.value, cl_video_brightness.value, cl_video_brightness.value, 1, 0); } - -#if 0 // disable video-only stipple - if (qglPolygonStipple && !scr_stipple.integer) - { + if (qglPolygonStipple && !scr_stipple.integer && cl_video_stipple.integer) qglDisable(GL_POLYGON_STIPPLE);CHECKGLERROR - } -#endif // VorteX: draw subtitle_text if (!video->subtitles || !cl_video_subtitles.integer) @@ -606,7 +605,9 @@ void CL_Video_Init( void ) Cvar_RegisterVariable(&cl_video_subtitles_lines); Cvar_RegisterVariable(&cl_video_subtitles_textsize); Cvar_RegisterVariable(&cl_video_scale); + Cvar_RegisterVariable(&cl_video_scale_vpos); Cvar_RegisterVariable(&cl_video_brightness); + Cvar_RegisterVariable(&cl_video_stipple); R_RegisterModule( "CL_Video", cl_video_start, cl_video_shutdown, cl_video_newmap ); } diff --git a/cl_video.h b/cl_video.h index 9e3c47c0..de36e7e6 100644 --- a/cl_video.h +++ b/cl_video.h @@ -27,6 +27,8 @@ extern cvar_t cl_video_subtitles; extern cvar_t cl_video_subtitles_lines; extern cvar_t cl_video_subtitles_textsize; extern cvar_t cl_video_scale; +extern cvar_t cl_video_scale_vpos; +extern cvar_t cl_video_stipple; extern cvar_t cl_video_brightness; typedef struct clvideo_s diff --git a/gl_rmain.c b/gl_rmain.c index f0b60ce5..29acd58a 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "image.h" #include "ft2.h" #include "csprogs.h" +#include "cl_video.h" mempool_t *r_main_mempool; rtexturepool_t *r_main_texturepool; @@ -8430,7 +8431,7 @@ void R_RenderView(void) return; } - if (!r_refdef.scene.entities || r_refdef.view.width * r_refdef.view.height == 0 || !r_renderview.integer/* || !r_refdef.scene.worldmodel*/) + if (!r_refdef.scene.entities || r_refdef.view.width * r_refdef.view.height == 0 || !r_renderview.integer || cl_videoplaying/* || !r_refdef.scene.worldmodel*/) return; //Host_Error ("R_RenderView: NULL worldmodel"); r_refdef.view.colorscale = r_hdr_scenebrightness.value; diff --git a/screen.h b/screen.h index 2e42b72f..17d08517 100644 --- a/screen.h +++ b/screen.h @@ -55,6 +55,7 @@ extern cvar_t scr_conbrightness; extern cvar_t r_letterbox; extern cvar_t scr_refresh; +extern cvar_t scr_stipple; #endif