From a218e323b1ce068686ea262aa23f59eccfd615f1 Mon Sep 17 00:00:00 2001 From: danij Date: Tue, 15 Aug 2006 12:09:39 +0000 Subject: [PATCH] Added cvar "rend-dev-sky": render the sky as a solid surface (for debug). Fixed: Fog should not be enabled when drawing the mobj bounding boxes. --- doomsday/engine/data/cphelp.txt | 3 +++ doomsday/engine/portable/src/gl_tex.c | 2 +- doomsday/engine/portable/src/rend_list.c | 20 +++++++++++++++++++- doomsday/engine/portable/src/rend_main.c | 6 ++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/doomsday/engine/data/cphelp.txt b/doomsday/engine/data/cphelp.txt index 1d3f122dde..cc07d54641 100644 --- a/doomsday/engine/data/cphelp.txt +++ b/doomsday/engine/data/cphelp.txt @@ -1048,6 +1048,9 @@ desc = 1=Disable non-visible subsector culling. [rend-dev-mobj-bbox] desc = 1=Render mobj bounding boxes (as used for collision detection). +[rend-dev-sky] +desc = 1=Render the sky as a solid surface. + [rend-camera-fov] desc = Field of view. diff --git a/doomsday/engine/portable/src/gl_tex.c b/doomsday/engine/portable/src/gl_tex.c index 0776742382..dee4e65c57 100644 --- a/doomsday/engine/portable/src/gl_tex.c +++ b/doomsday/engine/portable/src/gl_tex.c @@ -1626,7 +1626,7 @@ unsigned int GL_BindTexFlat(flat_t * fl) image_t image; boolean hasExternal = false; - if(lump < 0 || lump >= numlumps || lump == skyflatnum) + if(lump < 0 || lump >= numlumps) { // The sky flat is not a real flat at all. GL_BindTexture(0); diff --git a/doomsday/engine/portable/src/rend_list.c b/doomsday/engine/portable/src/rend_list.c index e8f3fc8334..5e998a507e 100644 --- a/doomsday/engine/portable/src/rend_list.c +++ b/doomsday/engine/portable/src/rend_list.c @@ -180,7 +180,9 @@ extern int skyhemispheres; extern int useDynLights, dlBlend, simpleSky; extern boolean usingFog; extern float maxLightDist; + extern int freezeRLs; +extern int skyflatnum; // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -239,12 +241,14 @@ static listhash_t shadowHash[RL_HASH_SIZE]; static rendlist_t skyMaskList; static boolean rendSky; +static byte debugSky = false; // CODE -------------------------------------------------------------------- void RL_Register(void) { // TODO: Move cvars here. + C_VAR_INT("rend-dev-sky", &debugSky, 0, 0, 1); } /* @@ -1571,6 +1575,20 @@ void RL_AddPoly(rendpoly_t *poly) return; } + // In debugSky mode we render all polys destined for the skymask as + // regular world polys (with a few obvious properties). + if((poly->flags & RPF_SKY_MASK) && debugSky) + { + poly->tex.id = curtex = GL_PrepareFlat(skyflatnum); + poly->tex.width = texw; + poly->tex.height = texh; + poly->tex.detail = 0; + poly->texoffy = poly->texoffx = 0; + poly->lights = NULL; + poly->flags &= ~RPF_SKY_MASK; + poly->flags |= RPF_GLOW; + } + // Are lights allowed? if(!(poly->flags & (RPF_SKY_MASK | RPF_SHADOW | RPF_SHINY))) { @@ -2328,7 +2346,7 @@ void RL_RenderAllLists(void) // When in the void we don't render a sky. // FIXME: We could use a stencil when rendering the sky, using the // already collected skymask polys as a mask. - if(rendSky) + if(rendSky && !debugSky) // The sky might be visible. Render the needed hemispheres. Rend_RenderSky(skyhemispheres); diff --git a/doomsday/engine/portable/src/rend_main.c b/doomsday/engine/portable/src/rend_main.c index 8240b0f38d..2b6951cab1 100644 --- a/doomsday/engine/portable/src/rend_main.c +++ b/doomsday/engine/portable/src/rend_main.c @@ -2236,6 +2236,9 @@ static void Rend_RenderBoundingBoxes(void) if(!devMobjBBox || netgame) return; + if(usingFog) + gl.Disable(DGL_FOG); + gl.Disable(DGL_DEPTH_TEST); gl.Enable(DGL_TEXTURING); gl.Disable(DGL_CULL_FACE); @@ -2282,6 +2285,9 @@ static void Rend_RenderBoundingBoxes(void) gl.Enable(DGL_CULL_FACE); gl.Enable(DGL_DEPTH_TEST); + + if(usingFog) + gl.Enable(DGL_FOG); } // Console commands.