Skip to content

Commit

Permalink
Added: CVAR "rend-dev-sky-always" 1= Always render the sky, even if t…
Browse files Browse the repository at this point in the history
…here are no sky surfaces visible. For debug.
  • Loading branch information
danij-deng committed Nov 6, 2009
1 parent dbc65c1 commit 46d195d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 37 deletions.
5 changes: 4 additions & 1 deletion doomsday/engine/data/cphelp.txt
Expand Up @@ -1044,7 +1044,10 @@ desc = 1=Disable non-visible subsector culling.
desc = 1=Render mobj bounding boxes (as used for collision detection).

[rend-dev-sky]
desc = 1=Render the sky as a solid surface.
desc = 1=Render the sky as a solid surface. 2= Draw sky surface planes.

[rend-dev-sky-always]
desc = 1=Always render the sky, even if there are no sky surfaces visible.

[rend-dev-tex-showfix]
desc = 1=Render the missing texture instead of fixing with a suitable game texture.
Expand Down
21 changes: 15 additions & 6 deletions doomsday/engine/portable/src/rend_list.c
Expand Up @@ -206,7 +206,8 @@ typedef struct listhash_s {
// EXTERNAL DATA DECLARATIONS ----------------------------------------------

extern int skyhemispheres;
extern int devSkyMode;
extern int devRendSkyMode;
extern byte devRendSkyAlways;
extern int useDynLights, dlBlend, simpleSky;
extern boolean usingFog;

Expand Down Expand Up @@ -1778,19 +1779,27 @@ Con_Error("collectLists: Ran out of MAX_RLISTS.\n");
*/
void RL_RenderAllLists(void)
{
uint count;
uint count;
// Pointers to all the rendering lists.
rendlist_t* lists[MAX_RLISTS];
rendlist_t* lists[MAX_RLISTS];

BEGIN_PROF( PROF_RL_RENDER_ALL );

if(!freezeRLs) // only update when lists arn't frozen
rendSky = !P_IsInVoid(viewPlayer);
if(!freezeRLs) // Only update when lists are not frozen.
{
if(devRendSkyAlways)
{
rendSky = true;
skyhemispheres |= SKYHEMI_UPPER | SKYHEMI_LOWER;
}
else
rendSky = !P_IsInVoid(viewPlayer);
}

// 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 && !devSkyMode)
if(rendSky && !devRendSkyMode)
// The sky might be visible. Render the needed hemispheres.
Rend_RenderSky(skyhemispheres);

Expand Down
58 changes: 28 additions & 30 deletions doomsday/engine/portable/src/rend_main.c
Expand Up @@ -83,7 +83,8 @@ float vx, vy, vz, vang, vpitch;
float viewsidex, viewsidey;

byte freezeRLs = false;
int devSkyMode = false;
int devRendSkyMode = false;
byte devRendSkyAlways = false;

int missileBlend = 1;
// Ambient lighting, rAmbient is used within the renderer, ambientLight is
Expand Down Expand Up @@ -124,23 +125,20 @@ static boolean firstsubsector; // No range checking for the first one.

void Rend_Register(void)
{
C_VAR_INT("rend-dev-sky", &devSkyMode, CVF_NO_ARCHIVE, 0, 2);
C_VAR_BYTE("rend-dev-freeze", &freezeRLs, CVF_NO_ARCHIVE, 0, 1);
C_VAR_INT("rend-dev-cull-subsectors", &devNoCulling,CVF_NO_ARCHIVE,0,1);
C_VAR_INT("rend-dev-mobj-bbox", &devMobjBBox, CVF_NO_ARCHIVE, 0, 1);
C_VAR_FLOAT("rend-camera-fov", &fieldOfView, 0, 1, 179);
C_VAR_BYTE("rend-tex-anim-smooth", &smoothTexAnim, 0, 0, 1);
C_VAR_INT("rend-tex-shiny", &useShinySurfaces, 0, 0, 1);
C_VAR_FLOAT2("rend-light-compression", &lightRangeCompression, 0, -1, 1,
Rend_CalcLightModRange);
C_VAR_INT2("rend-light-ambient", &ambientLight, 0, 0, 255,
Rend_CalcLightModRange);
C_VAR_INT2("rend-light-sky", &rendSkyLight, 0, 0, 1,
LG_MarkAllForUpdate);
C_VAR_FLOAT("rend-light-wall-angle", &rendLightWallAngle, CVF_NO_MAX,
0, 0);
C_VAR_FLOAT("rend-light-attenuation", &rendLightDistanceAttentuation,
CVF_NO_MAX, 0, 0);
C_VAR_FLOAT2("rend-light-compression", &lightRangeCompression, 0, -1, 1, Rend_CalcLightModRange);
C_VAR_INT2("rend-light-ambient", &ambientLight, 0, 0, 255, Rend_CalcLightModRange);
C_VAR_INT2("rend-light-sky", &rendSkyLight, 0, 0, 1, LG_MarkAllForUpdate);
C_VAR_FLOAT("rend-light-wall-angle", &rendLightWallAngle, CVF_NO_MAX, 0, 0);
C_VAR_FLOAT("rend-light-attenuation", &rendLightDistanceAttentuation, CVF_NO_MAX, 0, 0);

C_VAR_INT("rend-dev-sky", &devRendSkyMode, CVF_NO_ARCHIVE, 0, 2);
C_VAR_BYTE("rend-dev-sky-always", &devRendSkyAlways, CVF_NO_ARCHIVE, 0, 1);
C_VAR_BYTE("rend-dev-freeze", &freezeRLs, CVF_NO_ARCHIVE, 0, 1);
C_VAR_INT("rend-dev-cull-subsectors", &devNoCulling,CVF_NO_ARCHIVE,0,1);
C_VAR_INT("rend-dev-mobj-bbox", &devMobjBBox, CVF_NO_ARCHIVE, 0, 1);
C_VAR_BYTE("rend-dev-light-mod", &devLightModRange, CVF_NO_ARCHIVE, 0, 1);
C_VAR_BYTE("rend-dev-tex-showfix", &devNoTexFix, CVF_NO_ARCHIVE, 0, 1);
C_VAR_BYTE("rend-dev-blockmap-debug", &bmapShowDebug, CVF_NO_ARCHIVE, 0, 3);
Expand Down Expand Up @@ -1990,9 +1988,9 @@ static void renderPlane(subsector_t* ssec, planetype_t type,
skyhemispheres |=
(type == PLN_FLOOR? SKYHEMI_LOWER : SKYHEMI_UPPER);

// In devSkyMode mode we render all polys destined for the
// In devRendSkyMode mode we render all polys destined for the
// skymask as regular world polys (with a few obvious properties).
if(devSkyMode)
if(devRendSkyMode)
{
params.type = RPT_NORMAL;
params.blendMode = BM_NORMAL;
Expand Down Expand Up @@ -2225,9 +2223,9 @@ static boolean rendSegSection(subsector_t* ssec, seg_t* seg,
// Fill in the remaining params data.
if(skyMask || R_IsSkySurface(surface))
{
// In devSkyMode mode we render all polys destined for the skymask
// In devRendSkyMode mode we render all polys destined for the skymask
// as regular world polys (with a few obvious properties).
if(devSkyMode)
if(devRendSkyMode)
{
mat = surface->material;
forceOpaque = true;
Expand Down Expand Up @@ -2768,7 +2766,7 @@ static void prepareSkyMaskPoly(rvertex_t verts[4], rtexcoord_t coords[4],
material_snapshot_t ms;
vec3_t texOrigin[2];

// In devSkyMode mode we render all polys destined for the skymask as
// In devRendSkyMode mode we render all polys destined for the skymask as
// regular world polys (with a few obvious properties).

Material_Prepare(&ms, mat, true, NULL);
Expand Down Expand Up @@ -2807,7 +2805,7 @@ static void Rend_SSectSkyFixes(subsector_t *ssec)
// Init the poly.
memset(rTU, 0, sizeof(rTU));

if(devSkyMode)
if(devRendSkyMode)
{
uint i;

Expand Down Expand Up @@ -2885,12 +2883,12 @@ static void Rend_SSectSkyFixes(subsector_t *ssec)
vTL[VZ] = vTR[VZ] = ffloor;
vBL[VZ] = vBR[VZ] = skyFix[PLN_FLOOR].height;

if(devSkyMode)
if(devRendSkyMode)
prepareSkyMaskPoly(rvertices, rtexcoords, rTU, seg->length,
frontsec->SP_floormaterial);

RL_AddPoly(PT_TRIANGLE_STRIP,
(devSkyMode? RPT_NORMAL : RPT_SKY_MASK),
(devRendSkyMode? RPT_NORMAL : RPT_SKY_MASK),
rvertices, rtexcoords, NULL, NULL,
rcolors, 4, 0, 0, NULL, rTU);
}
Expand All @@ -2903,12 +2901,12 @@ static void Rend_SSectSkyFixes(subsector_t *ssec)
vTL[VZ] = vTR[VZ] = skyFix[PLN_CEILING].height;
vBL[VZ] = vBR[VZ] = fceil;

if(devSkyMode)
if(devRendSkyMode)
prepareSkyMaskPoly(rvertices, rtexcoords, rTU, seg->length,
frontsec->SP_ceilmaterial);

RL_AddPoly(PT_TRIANGLE_STRIP,
(devSkyMode? RPT_NORMAL : RPT_SKY_MASK),
(devRendSkyMode? RPT_NORMAL : RPT_SKY_MASK),
rvertices, rtexcoords, NULL, NULL,
rcolors, 4, 0, 0, NULL, rTU);
}
Expand All @@ -2926,12 +2924,12 @@ static void Rend_SSectSkyFixes(subsector_t *ssec)
vTL[VZ] = vTR[VZ] = bfloor;
vBL[VZ] = vBR[VZ] = skyFix[PLN_FLOOR].height;

if(devSkyMode)
if(devRendSkyMode)
prepareSkyMaskPoly(rvertices, rtexcoords, rTU, seg->length,
frontsec->SP_floormaterial);

RL_AddPoly(PT_TRIANGLE_STRIP,
(devSkyMode? RPT_NORMAL : RPT_SKY_MASK),
(devRendSkyMode? RPT_NORMAL : RPT_SKY_MASK),
rvertices, rtexcoords, NULL, NULL,
rcolors, 4, 0, 0, NULL, rTU);
}
Expand All @@ -2949,13 +2947,13 @@ static void Rend_SSectSkyFixes(subsector_t *ssec)
vTL[VZ] = vTR[VZ] = skyFix[PLN_CEILING].height;
vBL[VZ] = vBR[VZ] = bceil;

if(devSkyMode)
if(devRendSkyMode)
prepareSkyMaskPoly(rvertices, rtexcoords, rTU, seg->length,
frontsec->SP_ceilmaterial);


RL_AddPoly(PT_TRIANGLE_STRIP,
(devSkyMode? RPT_NORMAL : RPT_SKY_MASK),
(devRendSkyMode? RPT_NORMAL : RPT_SKY_MASK),
rvertices, rtexcoords, NULL, NULL,
rcolors, 4, 0, 0, NULL, rTU);
}
Expand Down Expand Up @@ -3248,7 +3246,7 @@ static void Rend_RenderSubsector(uint ssecidx)
texMode);
}

if(devSkyMode == 2)
if(devRendSkyMode == 2)
{
/**
* In devSky mode 2, we draw additional geometry, showing the
Expand Down

0 comments on commit 46d195d

Please sign in to comment.