move horizonline check to hw_bsp

to where maps also get checked for portals
should speed up levelload slightly
This commit is contained in:
Alug committed 2025-07-29 04:23:26 +02:00
1 parent 1504684f7f
commit c3fcc69668
5 files changed
+11 -43

No files matched your search

+7
View File
@@ -48,6 +48,10 @@ typedef struct
// if no portals are found, the portal scanning phase can be skipped while rendering, saving a bit of time.
boolean gl_maphasportals = false;
// Determine on mapload if current map has any Horizonlines present
// so we can avoid rather hot checks in HWR_Subsector
boolean gl_maphashorizonlines = false;
// ==========================================================================
// FLOOR & CEILING CONVEX POLYS GENERATION
// ==========================================================================
@@ -370,6 +374,9 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
gl_maphasportals = 1;
}
if (!gl_maphashorizonlines && line->special == HORIZONSPECIAL)
gl_maphashorizonlines = true;
if (line->sidenum[1] != 0xffff)
{
if (sides[line->sidenum[0]].sector == sides[line->sidenum[1]].sector)
+1 -41
View File
@@ -97,8 +97,6 @@ line_t *gl_linedef;
sector_t *gl_frontsector;
sector_t *gl_backsector;
static boolean gl_maphashorizonlines = false;
// values for the far clipping plane
static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
// values for bsp culling
@@ -5777,42 +5775,7 @@ void HWR_RenderPlayerView(void)
HWR_RenderFrame(player, false);
}
// Determine on mapload if current map has any Horizonlines present
// so we can avoid rather hot checks in HWR_Subsector
static void HWR_CheckForHorizonLines(void)
{
size_t i;
INT32 h;
gl_maphashorizonlines = false;
if (!cv_glhorizonlines.value)
return;
for (i = 0; i < numsubsectors; i++)
{
subsector_t *subsec = &subsectors[i];
// sector checked already?
if (subsec->validcount == validcount)
continue;
subsec->validcount = validcount;
seg_t *line = &segs[subsec->firstline];
for (h = 0; h < subsec->numlines; h++, line++)
{
if (line->linedef->special != HORIZONSPECIAL)
continue;
gl_maphashorizonlines = true;
break;
}
}
}
void HWR_LoadLevel(boolean reloadinggamestate)
void HWR_LoadLevel(void)
{
HWR_CreatePlanePolygons((INT32)numnodes - 1);
@@ -5820,9 +5783,6 @@ void HWR_LoadLevel(boolean reloadinggamestate)
HWR_ClearSkyDome();
HWR_BuildSkyDome();
if (!reloadinggamestate)
HWR_CheckForHorizonLines();
if (HWR_ShouldUsePaletteRendering())
HWR_SetMapPalette();
}
+1
View File
@@ -178,6 +178,7 @@ void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
// hw_bsp.c
void HWR_CreatePlanePolygons(INT32 bspnum);
extern boolean gl_maphasportals;
extern boolean gl_maphashorizonlines;
// Console variables
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
+1 -1
View File
@@ -2998,7 +2998,7 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
{
HWR_FreeExtraSubsectors();
// Create plane polygons.
HWR_LoadLevel(reloadinggamestate);
HWR_LoadLevel();
}
#endif
+1 -1
View File
@@ -68,7 +68,7 @@ void P_SetupLevelSky(INT32 skynum, boolean global);
boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate);
#ifdef HWRENDER
void HWR_LoadLevel(boolean reloadinggamestate);
void HWR_LoadLevel(void);
#endif
boolean P_AddWadFile(const char *wadfilename, boolean local);