]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
new cvar r_draw2d to turn off all 2D drawing (except for console, r_speeds and showfps)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 1 Jul 2010 18:37:11 +0000 (18:37 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 1 Jul 2010 18:37:11 +0000 (18:37 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10259 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
console.c
gl_draw.c
gl_rmain.c
render.h
sbar.c

index 632366d42f8a56bbd52103b305ed8b5b8d6d9445..df18256641d92eaa474697b5d10ce6efd401ed00 100644 (file)
@@ -807,6 +807,7 @@ void R_TimeReport_EndFrame(void)
                                lines++;
                y = vid_conheight.integer - sb_lines - lines * 8;
                i = j = 0;
+               r_draw2d_force = true;
                DrawQ_Fill(0, y, vid_conwidth.integer, lines * 8, 0, 0, 0, 0.5, 0);
                while (string[i])
                {
@@ -819,6 +820,7 @@ void R_TimeReport_EndFrame(void)
                                i++;
                        y += 8;
                }
+               r_draw2d_force = false;
        }
 }
 
index 78f6c0c559e8fe7690c8113f9da17c5ad08b0757..332c6800449df1cab5214e8d4bfc5644a54b5497 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1836,6 +1836,8 @@ void Con_DrawConsole (int lines)
 
        con_vislines = lines;
 
+       r_draw2d_force = true;
+
 // draw the background
        alpha = cls.signon == SIGNONS ? scr_conalpha.value : 1.0f; // always full alpha when not in game
        if(alpha > 0)
@@ -1919,6 +1921,8 @@ void Con_DrawConsole (int lines)
 
 // draw the input prompt, user text, and cursor if desired
        Con_DrawInput ();
+
+       r_draw2d_force = false;
 }
 
 /*
index 36fcac778854bd0e5d863f3147dc2fbe8312ce3c..44aef37643e48bd7279a1a4543fa5737acd2e315 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -983,10 +983,13 @@ void _DrawQ_Setup(void)
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 }
 
+qboolean r_draw2d_force = false;
 static void _DrawQ_ProcessDrawFlag(int flags)
 {
        _DrawQ_Setup();
        CHECKGLERROR
+       if(!r_draw2d.integer && !r_draw2d_force)
+               return;
        if(flags == DRAWFLAG_ADDITIVE)
                GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
        else if(flags == DRAWFLAG_MODULATE)
@@ -1004,6 +1007,8 @@ void DrawQ_Pic(float x, float y, cachepic_t *pic, float width, float height, flo
        float floats[36];
 
        _DrawQ_ProcessDrawFlag(flags);
+       if(!r_draw2d.integer && !r_draw2d_force)
+               return;
 
        R_Mesh_ResetTextureState();
        floats[12] = 0.0f;floats[13] = 0.0f;
@@ -1059,6 +1064,8 @@ void DrawQ_RotPic(float x, float y, cachepic_t *pic, float width, float height,
        float cosar = cos(ar);
 
        _DrawQ_ProcessDrawFlag(flags);
+       if(!r_draw2d.integer && !r_draw2d_force)
+               return;
 
        R_Mesh_ResetTextureState();
        if (pic)
@@ -1108,6 +1115,8 @@ void DrawQ_Fill(float x, float y, float width, float height, float red, float gr
        float floats[36];
 
        _DrawQ_ProcessDrawFlag(flags);
+       if(!r_draw2d.integer && !r_draw2d_force)
+               return;
 
        R_Mesh_ResetTextureState();
        R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
@@ -1431,6 +1440,8 @@ float DrawQ_String_Scale(float startx, float starty, const char *text, size_t ma
                maxlen = 1<<30;
 
        _DrawQ_ProcessDrawFlag(flags);
+       if(!r_draw2d.integer && !r_draw2d_force)
+               return startx + DrawQ_TextWidth_UntilWidth_TrackColors_Scale(text, &maxlen, w, h, sw, sh, NULL, ignorecolorcodes, fnt, 1000000000);
 
        R_Mesh_ResetTextureState();
        if (!fontmap)
@@ -1773,6 +1784,8 @@ void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height
        float floats[36];
 
        _DrawQ_ProcessDrawFlag(flags);
+       if(!r_draw2d.integer && !r_draw2d_force)
+               return;
 
        R_Mesh_ResetTextureState();
        if (pic)
@@ -1807,6 +1820,8 @@ void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height
 void DrawQ_Mesh (drawqueuemesh_t *mesh, int flags)
 {
        _DrawQ_ProcessDrawFlag(flags);
+       if(!r_draw2d.integer && !r_draw2d_force)
+               return;
 
        R_Mesh_ResetTextureState();
        R_SetupShader_Generic(mesh->texture, NULL, GL_MODULATE, 1);
@@ -1820,6 +1835,8 @@ void DrawQ_LineLoop (drawqueuemesh_t *mesh, int flags)
        int num;
 
        _DrawQ_ProcessDrawFlag(flags);
+       if(!r_draw2d.integer && !r_draw2d_force)
+               return;
 
        GL_Color(1,1,1,1);
        CHECKGLERROR
@@ -1838,6 +1855,8 @@ void DrawQ_LineLoop (drawqueuemesh_t *mesh, int flags)
 void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, float g, float b, float alpha, int flags)
 {
        _DrawQ_ProcessDrawFlag(flags);
+       if(!r_draw2d.integer && !r_draw2d_force)
+               return;
 
        R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1);
 
index 0234fdfb76bf4c3d18d44a889dd8e2a4e9c44261..1593e479331f96678ed14f25743344036bdfc1e2 100644 (file)
@@ -76,6 +76,7 @@ cvar_t r_showcollisionbrushes_polygonoffset = {0, "r_showcollisionbrushes_polygo
 cvar_t r_showdisabledepthtest = {0, "r_showdisabledepthtest", "0", "disables depth testing on r_show* cvars, allowing you to see what hidden geometry the graphics card is processing"};
 cvar_t r_drawportals = {0, "r_drawportals", "0", "shows portals (separating polygons) in world interior in quake1 maps"};
 cvar_t r_drawentities = {0, "r_drawentities","1", "draw entities (doors, players, projectiles, etc)"};
+cvar_t r_draw2d = {0, "r_draw2d","1", "draw 2D stuff (dangerous to turn off)"};
 cvar_t r_drawworld = {0, "r_drawworld","1", "draw world (most static stuff)"};
 cvar_t r_drawviewmodel = {0, "r_drawviewmodel","1", "draw your weapon model"};
 cvar_t r_drawexteriormodel = {0, "r_drawexteriormodel","1", "draw your player model (e.g. in chase cam, reflections)"};
@@ -6379,6 +6380,7 @@ void GL_Main_Init(void)
        Cvar_RegisterVariable(&r_showdisabledepthtest);
        Cvar_RegisterVariable(&r_drawportals);
        Cvar_RegisterVariable(&r_drawentities);
+       Cvar_RegisterVariable(&r_draw2d);
        Cvar_RegisterVariable(&r_drawworld);
        Cvar_RegisterVariable(&r_cullentities_trace);
        Cvar_RegisterVariable(&r_cullentities_trace_samples);
index 7cc1ae22b889bb64eef97295bd71969a7762a684..d81cc5656b55ed56716f7d8106a8b975728b00dc 100644 (file)
--- a/render.h
+++ b/render.h
@@ -114,6 +114,8 @@ extern cvar_t r_showdisabledepthtest;
 // view origin
 //
 extern cvar_t r_drawentities;
+extern cvar_t r_draw2d;
+extern qboolean r_draw2d_force;
 extern cvar_t r_drawviewmodel;
 extern cvar_t r_drawworld;
 extern cvar_t r_speeds;
diff --git a/sbar.c b/sbar.c
index e4390b6b86c15da145b7d3648163c46420ce6ca5..8b722295c253fba57851b8776d7800d42b9938b1 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -1203,6 +1203,7 @@ void Sbar_ShowFPS(void)
                }
                if (fpsstring[0])
                {
+                       r_draw2d_force = true;
                        fps_x = vid_conwidth.integer - DrawQ_TextWidth(fpsstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        if (red)
@@ -1210,6 +1211,7 @@ void Sbar_ShowFPS(void)
                        else
                                DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
                        fps_y += fps_scaley;
+                       r_draw2d_force = false;
                }
                if (timedemostring1[0])
                {