OpenGL: Fix linedef type 10 not culling FOFs
This commit is contained in:
1 parent
b49a46646c
commit
ec80a4ccda
1 file changed
+67
-65
+67
-65
@@ -3372,6 +3372,47 @@ void HWR_AddPolyObjectPlanes(void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// HWR_DoCulling
|
||||
// Hardware version of R_DoCulling
|
||||
// (see r_main.c)
|
||||
static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float vz, float bottomh, float toph)
|
||||
{
|
||||
float cullplane;
|
||||
|
||||
if (!cullheight)
|
||||
return false;
|
||||
|
||||
cullplane = FIXED_TO_FLOAT(cullheight->frontsector->floorheight);
|
||||
if (cullheight->flags & ML_NOCLIMB) // Group culling
|
||||
{
|
||||
if (!viewcullheight)
|
||||
return false;
|
||||
|
||||
// Make sure this is part of the same group
|
||||
if (viewcullheight->frontsector == cullheight->frontsector)
|
||||
{
|
||||
// OK, we can cull
|
||||
if (vz > cullplane && toph < cullplane) // Cull if below plane
|
||||
return true;
|
||||
|
||||
if (bottomh > cullplane && vz <= cullplane) // Cull if above plane
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else // Quick culling
|
||||
{
|
||||
if (vz > cullplane && toph < cullplane) // Cull if below plane
|
||||
return true;
|
||||
|
||||
if (bottomh > cullplane && vz <= cullplane) // Cull if above plane
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_Subsector : Determine floor/ceiling planes.
|
||||
// : Add sprites of things in sector.
|
||||
@@ -3553,34 +3594,35 @@ void HWR_Subsector(size_t num)
|
||||
for (rover = gr_frontsector->ffloors;
|
||||
rover; rover = rover->next)
|
||||
{
|
||||
fixed_t cullHeight, centerHeight;
|
||||
|
||||
// bottom plane
|
||||
#ifdef ESLOPE
|
||||
if (*rover->b_slope)
|
||||
{
|
||||
cullHeight = P_GetZAt(*rover->b_slope, viewx, viewy);
|
||||
centerHeight = P_GetZAt(*rover->b_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
cullHeight = centerHeight = *rover->bottomheight;
|
||||
fixed_t bottomCullHeight, topCullHeight, centerHeight;
|
||||
|
||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES))
|
||||
continue;
|
||||
if (sub->validcount == validcount)
|
||||
continue;
|
||||
|
||||
// rendering heights for bottom and top planes
|
||||
bottomCullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy);
|
||||
topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy);
|
||||
|
||||
if (gr_frontsector->cullheight)
|
||||
{
|
||||
if (HWR_DoCulling(gr_frontsector->cullheight, viewsector->cullheight, gr_viewz, FIXED_TO_FLOAT(bottomCullHeight), FIXED_TO_FLOAT(topCullHeight)))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (centerHeight <= locCeilingHeight &&
|
||||
centerHeight >= locFloorHeight &&
|
||||
((viewz < cullHeight && !(rover->flags & FF_INVERTPLANES)) ||
|
||||
(viewz > cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
|
||||
// bottom plane
|
||||
centerHeight = P_GetFFloorBottomZAt(rover, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
|
||||
|
||||
if (centerHeight <= locCeilingHeight && centerHeight >= locFloorHeight &&
|
||||
((viewz < bottomCullHeight && !(rover->flags & FF_INVERTPLANES)) ||
|
||||
(viewz > bottomCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
|
||||
{
|
||||
if (rover->flags & FF_FOG)
|
||||
{
|
||||
UINT8 alpha;
|
||||
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
|
||||
|
||||
alpha = HWR_FogBlockAlpha(SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap);
|
||||
|
||||
@@ -3594,7 +3636,7 @@ void HWR_Subsector(size_t num)
|
||||
}
|
||||
else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256) // SoM: Flags are more efficient
|
||||
{
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
|
||||
HWR_AddTransparentFloor(levelflats[*rover->bottompic].lumpnum,
|
||||
&extrasubsectors[num],
|
||||
false,
|
||||
@@ -3606,7 +3648,7 @@ void HWR_Subsector(size_t num)
|
||||
else
|
||||
{
|
||||
HWR_GetFlat(levelflats[*rover->bottompic].lumpnum, R_NoEncore(gr_frontsector, false));
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < bottomCullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), levelflats[*rover->bottompic].lumpnum,
|
||||
rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
@@ -3616,23 +3658,22 @@ void HWR_Subsector(size_t num)
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
{
|
||||
cullHeight = P_GetZAt(*rover->t_slope, viewx, viewy);
|
||||
centerHeight = P_GetZAt(*rover->t_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
cullHeight = centerHeight = *rover->topheight;
|
||||
centerHeight = *rover->topheight;
|
||||
|
||||
if (centerHeight >= locFloorHeight &&
|
||||
centerHeight <= locCeilingHeight &&
|
||||
((viewz > cullHeight && !(rover->flags & FF_INVERTPLANES)) ||
|
||||
(viewz < cullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
|
||||
((viewz > topCullHeight && !(rover->flags & FF_INVERTPLANES)) ||
|
||||
(viewz < topCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES))))
|
||||
{
|
||||
if (rover->flags & FF_FOG)
|
||||
{
|
||||
UINT8 alpha;
|
||||
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < topCullHeight ? true : false);
|
||||
|
||||
alpha = HWR_FogBlockAlpha(SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap);
|
||||
|
||||
@@ -3646,7 +3687,7 @@ void HWR_Subsector(size_t num)
|
||||
}
|
||||
else if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256)
|
||||
{
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < topCullHeight ? true : false);
|
||||
HWR_AddTransparentFloor(levelflats[*rover->toppic].lumpnum,
|
||||
&extrasubsectors[num],
|
||||
true,
|
||||
@@ -3658,7 +3699,7 @@ void HWR_Subsector(size_t num)
|
||||
else
|
||||
{
|
||||
HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gr_frontsector, true));
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < cullHeight ? true : false);
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < topCullHeight ? true : false);
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, (rover->flags & FF_RIPPLE ? PF_Ripple : 0)|PF_Occlude, SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel), levelflats[*rover->toppic].lumpnum,
|
||||
rover->master->frontsector, 255, gr_frontsector->lightlist[light].extra_colormap);
|
||||
}
|
||||
@@ -3912,45 +3953,6 @@ static fixed_t HWR_OpaqueFloorAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t hei
|
||||
return floorz;
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_DoCulling
|
||||
// Hardware version of R_DoCulling
|
||||
// (see r_main.c)
|
||||
static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float vz, float bottomh, float toph)
|
||||
{
|
||||
float cullplane;
|
||||
|
||||
if (!cullheight)
|
||||
return false;
|
||||
|
||||
cullplane = FIXED_TO_FLOAT(cullheight->frontsector->floorheight);
|
||||
if (cullheight->flags & ML_NOCLIMB) // Group culling
|
||||
{
|
||||
if (!viewcullheight)
|
||||
return false;
|
||||
|
||||
// Make sure this is part of the same group
|
||||
if (viewcullheight->frontsector == cullheight->frontsector)
|
||||
{
|
||||
// OK, we can cull
|
||||
if (vz > cullplane && toph < cullplane) // Cull if below plane
|
||||
return true;
|
||||
|
||||
if (bottomh > cullplane && vz <= cullplane) // Cull if above plane
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else // Quick culling
|
||||
{
|
||||
if (vz > cullplane && toph < cullplane) // Cull if below plane
|
||||
return true;
|
||||
|
||||
if (bottomh > cullplane && vz <= cullplane) // Cull if above plane
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float this_scale)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user