Skip to content

Commit

Permalink
Added cvar "rend-dev-sky": render the sky as a solid surface (for deb…
Browse files Browse the repository at this point in the history
…ug).

Fixed: Fog should not be enabled when drawing the mobj bounding boxes.
  • Loading branch information
danij committed Aug 15, 2006
1 parent 945aff5 commit a218e32
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
3 changes: 3 additions & 0 deletions doomsday/engine/data/cphelp.txt
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/gl_tex.c
Expand Up @@ -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);
Expand Down
20 changes: 19 additions & 1 deletion doomsday/engine/portable/src/rend_list.c
Expand Up @@ -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 -------------------------------------------------

Expand Down Expand Up @@ -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);
}

/*
Expand Down Expand Up @@ -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)))
{
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 6 additions & 0 deletions doomsday/engine/portable/src/rend_main.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a218e32

Please sign in to comment.