Compare commits

...
Author SHA1 Message Date
Alug 90b4bce087 0xffff moment
lmao oops didnt pay attention at all
2025-07-24 14:59:52 +02:00
Alug 19a9c425ac dont free our poly_subsectors twice
also use calloc for em
2025-07-24 14:59:49 +02:00
Alug 81e502c21b change back copyright header
though keep the correct date
2025-07-23 22:37:12 +02:00
Alug 11c6fc2cca fix occasional crash
first side may be also null
2025-07-23 22:37:08 +02:00
Alug dc2d1b4cd9 optimize hw_bsp stuff
was a little slow before
2025-07-23 22:37:05 +02:00
Alug cfa0bb0405 remove unused stuff + more cleanup 2025-07-23 22:37:02 +02:00
Alug b35a658249 more fixes and cleanup
ogl uses the "flenght" variable
and use hypotf instead of sqrt
2025-07-23 22:36:59 +02:00
Alug ff41198bce fix polyobjects
lululu oops
2025-07-23 22:36:56 +02:00
Alug 0c58228c21 obliterate hw_bsp and port over doom-legacy code
fixes numerous issues with rendering in ogl
like the holes in pentagon paradise
or infinite loops in SolveTProblem (sunset hill)
2025-07-23 22:36:52 +02:00
6 changed files with 2701 additions and 634 deletions

No files matched your search

+2664 -612
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -119,7 +119,7 @@ typedef struct
typedef struct
{
poly_t *planepoly; // the generated convex polygon
} extrasubsector_t;
} poly_subsector_t;
// Vanilla features
//#define USE_MODEL_NEXTFRAME
+4 -3
View File
@@ -52,10 +52,11 @@ void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32
// --------
// hw_bsp.c
// --------
extern extrasubsector_t *extrasubsectors;
extern size_t addsubsector;
extern poly_subsector_t *poly_subsectors;
extern size_t num_poly_subsector;
void HWR_FreeExtraSubsectors(void);
void HWR_Init_PolyPool(void);
void HWR_Free_PolyPool(void);
// --------
// hw_cache.c
+31 -16
View File
@@ -128,7 +128,7 @@ ps_metric_t ps_hw_batchdrawtime = {};
static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, boolean noencore, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags);
static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
static void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
static void HWR_AddTransparentFloor(lumpnum_t lumpnum, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
static void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
@@ -226,6 +226,17 @@ consvar_t cv_glanisotropicmode = {"gr_anisotropicmode", "1", CV_CALL|CV_SAVE, gl
consvar_t cv_glsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glpolytile = {"gr_polytile", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
CV_PossibleValue_t grpolyshape_cons_t[] = {
{0, "Subsector"},
{1, "Fat"},
{2, "Trim"},
{3, "NotConvex"},
{0, NULL}
};
consvar_t cv_glpolyshape = {"gr_polygon_shape", "Trim", CV_SAVE, grpolyshape_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glwireframe = {"gr_wireframe", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -532,7 +543,7 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t
// HWR_RenderPlane
// Render a floor or ceiling convex polygon
static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap)
static void HWR_RenderPlane(subsector_t *subsector, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap)
{
FSurfaceInfo Surf;
FOutVector *v3d;
@@ -2760,7 +2771,7 @@ static void HWR_AddPolyObjectPlanes(void)
sector_t *polyobjsector;
INT32 light = 0;
// Polyobject Planes need their own function for drawing because they don't have extrasubsectors by themselves
// Polyobject Planes need their own function for drawing because they don't have poly_subsectors by themselves
// It should be okay because polyobjects should always be convex anyway
for (i = 0; i < numpolys; i++)
@@ -2890,9 +2901,9 @@ static void HWR_Subsector(size_t num)
ffloor_t *rover;
#ifdef PARANOIA //no risk while developing, enough debugging nights!
if (num >= addsubsector)
if (num >= num_poly_subsector)
I_Error("HWR_Subsector: ss %s with numss = %s, addss = %s\n",
sizeu1(num), sizeu2(numsubsectors), sizeu3(addsubsector));
sizeu1(num), sizeu2(numsubsectors), sizeu3(num_poly_subsector));
#endif
if (num < numsubsectors)
@@ -2986,7 +2997,7 @@ static void HWR_Subsector(size_t num)
if (sub->validcount != validcount)
{
HWR_GetFlat(levelflats[gl_frontsector->floorpic].lumpnum, R_NoEncore(gl_frontsector, false));
HWR_RenderPlane(sub, &extrasubsectors[num], false,
HWR_RenderPlane(sub, &poly_subsectors[num], false,
// Hack to make things continue to work around slopes.
locFloorHeight == cullFloorHeight ? locFloorHeight : gl_frontsector->floorheight,
// We now return you to your regularly scheduled rendering.
@@ -3002,7 +3013,7 @@ static void HWR_Subsector(size_t num)
if (sub->validcount != validcount)
{
HWR_GetFlat(levelflats[gl_frontsector->ceilingpic].lumpnum, R_NoEncore(gl_frontsector, true));
HWR_RenderPlane(sub, &extrasubsectors[num], true,
HWR_RenderPlane(sub, &poly_subsectors[num], true,
// Hack to make things continue to work around slopes.
locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gl_frontsector->ceilingheight,
// We now return you to your regularly scheduled rendering.
@@ -3050,7 +3061,7 @@ static void HWR_Subsector(size_t num)
alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
HWR_AddTransparentFloor(0,
&extrasubsectors[num],
&poly_subsectors[num],
false,
*rover->bottomheight,
*gl_frontsector->lightlist[light].lightlevel,
@@ -3062,7 +3073,7 @@ static void HWR_Subsector(size_t num)
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < bottomCullHeight));
HWR_AddTransparentFloor(levelflats[*rover->bottompic].lumpnum,
&extrasubsectors[num],
&poly_subsectors[num],
false,
*rover->bottomheight,
*gl_frontsector->lightlist[light].lightlevel,
@@ -3074,7 +3085,7 @@ static void HWR_Subsector(size_t num)
HWR_GetFlat(levelflats[*rover->bottompic].lumpnum, R_NoEncore(gl_frontsector, false));
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < bottomCullHeight));
HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum,
HWR_RenderPlane(sub, &poly_subsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum,
rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap);
}
}
@@ -3096,7 +3107,7 @@ static void HWR_Subsector(size_t num)
alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap);
HWR_AddTransparentFloor(0,
&extrasubsectors[num],
&poly_subsectors[num],
true,
*rover->topheight,
*gl_frontsector->lightlist[light].lightlevel,
@@ -3108,7 +3119,7 @@ static void HWR_Subsector(size_t num)
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < topCullHeight));
HWR_AddTransparentFloor(levelflats[*rover->toppic].lumpnum,
&extrasubsectors[num],
&poly_subsectors[num],
true,
*rover->topheight,
*gl_frontsector->lightlist[light].lightlevel,
@@ -3120,7 +3131,7 @@ static void HWR_Subsector(size_t num)
HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gl_frontsector, true));
light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < topCullHeight));
HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
HWR_RenderPlane(sub, &poly_subsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum,
rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap);
}
}
@@ -4200,7 +4211,7 @@ typedef struct
typedef struct
{
extrasubsector_t *xsub;
poly_subsector_t *xsub;
boolean isceiling;
fixed_t fixedheight;
INT32 lightlevel;
@@ -4293,7 +4304,7 @@ static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, I
wallinfo->wallcolormap = wallcolormap;
}
static void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap)
static void HWR_AddTransparentFloor(lumpnum_t lumpnum, poly_subsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap)
{
planeinfo_t *planeinfo = static_cast<planeinfo_t*>(HWR_CreateDrawNode(DRAWNODE_PLANE));
@@ -5850,6 +5861,8 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_glanisotropicmode);
CV_RegisterVar(&cv_glsolvetjoin);
CV_RegisterVar(&cv_glpolytile);
CV_RegisterVar(&cv_glpolyshape);
CV_RegisterVar(&cv_glbatching);
@@ -5878,6 +5891,8 @@ void HWR_Startup(void)
CONS_Printf("HWR_Startup()...\n");
textureformat = patchformat = GL_TEXFMT_RGBA;
HWR_Init_PolyPool();
HWR_InitMapTextures();
HWR_InitMD2();
@@ -5969,7 +5984,7 @@ static void COM_HWR_glinfo(void)
void HWR_Shutdown(void)
{
CONS_Printf("HWR_Shutdown()\n");
HWR_FreeExtraSubsectors();
HWR_Free_PolyPool();
HWR_FreeMapTextures();
GL_FlushScreenTextures();
#ifdef USE_FBO_OGL
+1 -1
View File
@@ -203,7 +203,7 @@ extern consvar_t cv_glsecbright;
extern consvar_t cv_glfiltermode;
extern consvar_t cv_glanisotropicmode;
extern consvar_t cv_glsolvetjoin;
extern consvar_t cv_glsolvetjoin, cv_glpolytile, cv_glpolyshape;
extern consvar_t cv_glbatching;
-1
View File
@@ -3008,7 +3008,6 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
#ifdef HWRENDER // not win32 only 19990829 by Kin
if (rendermode == render_opengl)
{
HWR_FreeExtraSubsectors();
// Create plane polygons.
HWR_LoadLevel(reloadinggamestate);
}