skip some stuffs when theres no portals
skip some portal checking incases wheres no portals
This commit is contained in:
1 parent
58d0b5ffc6
commit
f0df97589f
1 file changed
+13
-36
+13
-36
@@ -2350,6 +2350,9 @@ static void HWR_AddLine(seg_t *line)
|
||||
|
||||
gl_backsector = line->backsector;
|
||||
|
||||
if (!cv_glportals.value || !gl_maphasportals)
|
||||
goto doaddline;
|
||||
|
||||
// do extra checks on the seg when rendering portals:
|
||||
// don't render segs that are behind the portal destination line
|
||||
if (portalclipline &&
|
||||
@@ -2811,29 +2814,6 @@ static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float v
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void HWR_PortalSubsector(seg_t *line, subsector_t *sub, INT16 count)
|
||||
{
|
||||
if (line)
|
||||
{
|
||||
//Hurdler: at this point validcount must be the same, but is not because
|
||||
// gl_frontsector doesn't point anymore to sub->sector due to
|
||||
// the call gl_frontsector = R_FakeFlat(...)
|
||||
// if it's not done, the sprite is drawn more than once,
|
||||
// what looks really bad with translucency or dynamic light,
|
||||
// without talking about the overdraw of course.
|
||||
sub->sector->validcount = validcount;/// \todo fix that in a better way
|
||||
|
||||
while (count--)
|
||||
{
|
||||
if (!line->polyseg) // ignore segs that belong to polyobjects
|
||||
HWR_AddLine(line);
|
||||
line++;
|
||||
}
|
||||
}
|
||||
|
||||
sub->validcount = validcount;
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_Subsector : Determine floor/ceiling planes.
|
||||
// : Add sprites of things in sector.
|
||||
@@ -2886,8 +2866,7 @@ static void HWR_Subsector(size_t num)
|
||||
|
||||
if (gl_portal_state == GLPORTAL_SEARCH)
|
||||
{
|
||||
HWR_PortalSubsector(line, sub, count);
|
||||
return;
|
||||
goto doaddline;
|
||||
}
|
||||
|
||||
floorcolormap = ceilingcolormap = gl_frontsector->extra_colormap;
|
||||
@@ -3123,6 +3102,7 @@ static void HWR_Subsector(size_t num)
|
||||
}
|
||||
}
|
||||
|
||||
doaddline:
|
||||
// Hurdler: here interesting things are happening!
|
||||
// we have just drawn the floor and ceiling
|
||||
// we now draw the sprites first and then the walls
|
||||
@@ -3143,9 +3123,9 @@ static void HWR_Subsector(size_t num)
|
||||
|
||||
while (count--)
|
||||
{
|
||||
if (!line->polyseg) // ignore segs that belong to polyobjects
|
||||
HWR_AddLine(line);
|
||||
line++;
|
||||
if (!line->polyseg) // ignore segs that belong to polyobjects
|
||||
HWR_AddLine(line);
|
||||
line++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5326,6 +5306,8 @@ void HWR_SetStencilState(int state, int level)
|
||||
GL_SetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
}
|
||||
|
||||
typedef void (*bspfunc)(INT32 bspnum);
|
||||
|
||||
// Renders the current viewpoint, though takes portal arguments for recursive portals.
|
||||
void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals)
|
||||
{
|
||||
@@ -5333,6 +5315,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
const boolean useportals = cv_glportals.value && gl_maphasportals && allow_portals;
|
||||
bspfunc bspFunc = portalclipline ? HWR_RenderPortalBSPNode : HWR_RenderBSPNode;
|
||||
|
||||
portallist.base = portallist.cap = NULL;
|
||||
|
||||
@@ -5352,10 +5335,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
validcount++;
|
||||
|
||||
// no actual rendering happens
|
||||
if (portalclipline)
|
||||
HWR_RenderPortalBSPNode((INT32)numnodes-1);
|
||||
else
|
||||
HWR_RenderBSPNode((INT32)numnodes-1);
|
||||
bspFunc((INT32)numnodes-1);
|
||||
|
||||
// for each found portal:
|
||||
// note: if necessary, could sort the portals here?
|
||||
@@ -5406,10 +5386,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
HWR_SetPortalState(GLPORTAL_INSIDE); // TURN IT OFF
|
||||
|
||||
// Recursively "render" the BSP tree.
|
||||
if (!portalclipline)
|
||||
HWR_RenderBSPNode((INT32)numnodes-1);
|
||||
else
|
||||
HWR_RenderPortalBSPNode((INT32)numnodes-1);
|
||||
bspFunc((INT32)numnodes-1);
|
||||
|
||||
// woo we back
|
||||
HWR_SetPortalState(oldgl_portal_state);
|
||||
|
||||
Reference in new issue
Block a user