]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
added r_view.showdebug flag, which is used to disable rendering of
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 4 Sep 2007 20:20:02 +0000 (20:20 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 4 Sep 2007 20:20:02 +0000 (20:20 +0000)
r_shownormals and r_showtris and such features when rendering with HDR

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7558 d7cf8633-e32d-0410-b094-e92efae38249

client.h
gl_rmain.c

index e30360b74b31473a1c6f1b6d5518fb21f38b6f67..b7d97b7c50e3c6ed5cab75aeb9355429703cce29 100644 (file)
--- a/client.h
+++ b/client.h
@@ -1423,6 +1423,11 @@ typedef struct r_view_s
 
        // global RGB color multiplier for rendering, this is required by HDR
        float colorscale;
+
+       // whether to draw r_showtris and such, this is only true for the main
+       // view render, all secondary renders (HDR, mirrors, portals, cameras,
+       // distortion effects, etc) omit such debugging information
+       qboolean showdebug;
 }
 r_view_t;
 
index 5ce992d643668ea89922fb5aa398d03abe76f9ba..d1f96ffbbd08b34456ae1fb0ce0e8e7e796b8fca 100644 (file)
@@ -2448,10 +2448,12 @@ void R_HDR_RenderBloomTexture(void)
        // TODO: add exposure compensation features
        // TODO: add fp16 framebuffer support
 
+       r_view.showdebug = false;
        r_view.colorscale = r_bloom_colorscale.value * r_hdr_scenebrightness.value;
        if (r_hdr.integer)
                r_view.colorscale /= r_hdr_range.value;
        R_RenderScene();
+       r_view.showdebug = true;
 
        R_ResetViewRendering2D();
 
@@ -2636,6 +2638,8 @@ void R_RenderView(void)
 
        R_Bloom_StartFrame();
 
+       r_view.showdebug = true;
+
        // this produces a bloom texture to be used in R_BlendView() later
        if (r_hdr.integer)
                R_HDR_RenderBloomTexture();
@@ -2761,25 +2765,28 @@ void R_RenderScene(void)
        }
        VM_CL_AddPolygonsToMeshQueue();
 
-       if (cl_locs_show.integer)
-       {
-               R_DrawLocs();
-               if (r_timereport_active)
-                       R_TimeReport("showlocs");
-       }
-
-       if (r_drawportals.integer)
-       {
-               R_DrawPortals();
-               if (r_timereport_active)
-                       R_TimeReport("portals");
-       }
-
-       if (r_showbboxes.value > 0)
+       if (r_view.showdebug)
        {
-               R_DrawEntityBBoxes();
-               if (r_timereport_active)
-                       R_TimeReport("bboxes");
+               if (cl_locs_show.integer)
+               {
+                       R_DrawLocs();
+                       if (r_timereport_active)
+                               R_TimeReport("showlocs");
+               }
+       
+               if (r_drawportals.integer)
+               {
+                       R_DrawPortals();
+                       if (r_timereport_active)
+                               R_TimeReport("portals");
+               }
+       
+               if (r_showbboxes.value > 0)
+               {
+                       R_DrawEntityBBoxes();
+                       if (r_timereport_active)
+                               R_TimeReport("bboxes");
+               }
        }
 
        if (gl_support_fragment_shader)
@@ -4985,7 +4992,10 @@ static void R_DrawTextureSurfaceList(int texturenumsurfaces, msurface_t **textur
                if (r_depthfirst.integer == 3)
                {
                        int i = (int)(texturesurfacelist[0] - rsurface.modelsurfaces);
-                       GL_Color(((i >> 6) & 7) / 7.0f, ((i >> 3) & 7) / 7.0f, (i & 7) / 7.0f,1);
+                       if (!r_view.showdebug)
+                               GL_Color(0, 0, 0, 1);
+                       else
+                               GL_Color(((i >> 6) & 7) / 7.0f, ((i >> 3) & 7) / 7.0f, (i & 7) / 7.0f,1);
                }
                else
                {
@@ -5008,6 +5018,11 @@ static void R_DrawTextureSurfaceList(int texturenumsurfaces, msurface_t **textur
        }
        else if (r_depthfirst.integer == 3)
                return;
+       else if (!r_view.showdebug && (r_showsurfaces.integer || gl_lightmaps.integer))
+       {
+               GL_Color(0, 0, 0, 1);
+               RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
+       }
        else if (r_showsurfaces.integer)
        {
                if (rsurface.mode != RSURFMODE_MULTIPASS)
@@ -5512,9 +5527,12 @@ void R_DrawModelSurfaces(entity_render_t *ent, qboolean skysurfaces, qboolean wr
        r_refdef.stats.entities_triangles += counttriangles;
        RSurf_CleanUp();
 
-       if (r_showcollisionbrushes.integer && !skysurfaces && !depthonly)
-               R_DrawCollisionBrushes(ent);
+       if (r_view.showdebug)
+       {
+               if (r_showcollisionbrushes.integer && !skysurfaces && !depthonly)
+                       R_DrawCollisionBrushes(ent);
 
-       if ((r_showtris.integer || r_shownormals.integer) && !depthonly)
-               R_DrawTrianglesAndNormals(ent, r_showtris.integer, r_shownormals.integer, flagsmask);
+               if ((r_showtris.integer || r_shownormals.integer) && !depthonly)
+                       R_DrawTrianglesAndNormals(ent, r_showtris.integer, r_shownormals.integer, flagsmask);
+       }
 }