- Fixed regression in R_RenderMaskedSegRange
- OpenGL: Only render edges on two-sided lines if they are textured
This commit is contained in:
Lactozilla 2024-01-31 16:27:01 -03:00
parent 58a71e24b9
commit 888aa8bf72
2 changed files with 23 additions and 15 deletions

View file

@ -1968,6 +1968,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (gl_backsector) if (gl_backsector)
{ {
INT32 gl_toptexture = 0, gl_bottomtexture = 0; INT32 gl_toptexture = 0, gl_bottomtexture = 0;
boolean has_top = false, has_bottom = false;
fixed_t texturevpeg; fixed_t texturevpeg;
SLOPEPARAMS(gl_backsector->c_slope, worldhigh, worldhighslope, gl_backsector->ceilingheight) SLOPEPARAMS(gl_backsector->c_slope, worldhigh, worldhighslope, gl_backsector->ceilingheight)
@ -2079,6 +2082,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
HWR_AddTransparentWall(wallVerts, &Surf, gl_toptexture, PF_Environment, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, &Surf, gl_toptexture, PF_Environment, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
has_top = true;
} }
// check BOTTOM TEXTURE // check BOTTOM TEXTURE
@ -2164,6 +2169,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
HWR_AddTransparentWall(wallVerts, &Surf, gl_bottomtexture, PF_Environment, false, lightnum, colormap); HWR_AddTransparentWall(wallVerts, &Surf, gl_bottomtexture, PF_Environment, false, lightnum, colormap);
else else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
has_bottom = true;
} }
// Render midtexture if there's one // Render midtexture if there's one
@ -2174,7 +2181,14 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{ {
// Render extra textures // Render extra textures
for (unsigned i = 0; i < NUM_WALL_OVERLAYS; i++) for (unsigned i = 0; i < NUM_WALL_OVERLAYS; i++)
{
if (IS_TOP_EDGE_TEXTURE(i) && !has_top)
continue;
if (IS_BOTTOM_EDGE_TEXTURE(i) && !has_bottom)
continue;
HWR_RenderExtraTexture(i, gl_sidedef, gl_frontsector, gl_backsector, NULL, NULL, vs, ve, cliplow, cliphigh, Surf, PF_Masked); HWR_RenderExtraTexture(i, gl_sidedef, gl_frontsector, gl_backsector, NULL, NULL, vs, ve, cliplow, cliphigh, Surf, PF_Masked);
}
// Sky culling // Sky culling
// No longer so much a mess as before! // No longer so much a mess as before!

View file

@ -285,8 +285,6 @@ INT32 R_GetOverlayTextureRepeats(unsigned which, side_t *side, INT32 texnum, sec
// Setup lighting based on the presence/lack-of 3D floors. // Setup lighting based on the presence/lack-of 3D floors.
static void R_PrepareMaskedSegLightlist(drawseg_t *ds, INT32 range) static void R_PrepareMaskedSegLightlist(drawseg_t *ds, INT32 range)
{ {
lightlist_t *light;
r_lightlist_t *rlight;
INT32 lightnum; INT32 lightnum;
dc_numlights = 0; dc_numlights = 0;
@ -294,7 +292,7 @@ static void R_PrepareMaskedSegLightlist(drawseg_t *ds, INT32 range)
if (frontsector->numlights) if (frontsector->numlights)
{ {
dc_numlights = frontsector->numlights; dc_numlights = frontsector->numlights;
if (dc_numlights >= dc_maxlights) if (dc_numlights > dc_maxlights)
{ {
dc_maxlights = dc_numlights; dc_maxlights = dc_numlights;
dc_lightlist = Z_Realloc(dc_lightlist, sizeof (*dc_lightlist) * dc_maxlights, PU_STATIC, NULL); dc_lightlist = Z_Realloc(dc_lightlist, sizeof (*dc_lightlist) * dc_maxlights, PU_STATIC, NULL);
@ -302,20 +300,14 @@ static void R_PrepareMaskedSegLightlist(drawseg_t *ds, INT32 range)
for (INT32 i = 0; i < dc_numlights; i++) for (INT32 i = 0; i < dc_numlights; i++)
{ {
fixed_t leftheight, rightheight; lightlist_t *light = &frontsector->lightlist[i];
light = &frontsector->lightlist[i]; r_lightlist_t *rlight = &dc_lightlist[i];
rlight = &dc_lightlist[i]; fixed_t leftheight = P_GetLightZAt(light, ds-> leftpos.x, ds-> leftpos.y) - viewz;
leftheight = P_GetLightZAt(light, ds-> leftpos.x, ds-> leftpos.y); fixed_t rightheight = P_GetLightZAt(light, ds->rightpos.x, ds->rightpos.y) - viewz;
rightheight = P_GetLightZAt(light, ds->rightpos.x, ds->rightpos.y);
leftheight -= viewz;
rightheight -= viewz;
rlight->height = (centeryfrac) - FixedMul(leftheight , ds->scale1); rlight->height = (centeryfrac) - FixedMul(leftheight , ds->scale1);
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
rlight->heightstep = (rlight->heightstep-rlight->height)/(range); rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
//if (x1 > ds->x1)
//rlight->height -= (x1 - ds->x1)*rlight->heightstep;
rlight->startheight = rlight->height; // keep starting value here to reset for each repeat rlight->startheight = rlight->height; // keep starting value here to reset for each repeat
rlight->lightlevel = *light->lightlevel; rlight->lightlevel = *light->lightlevel;
rlight->extra_colormap = *light->extra_colormap; rlight->extra_colormap = *light->extra_colormap;
@ -469,6 +461,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
return; return;
} }
dc_transmap = NULL;
if (blendmode == AST_FOG) if (blendmode == AST_FOG)
{ {
colfunc = colfuncs[COLDRAWFUNC_FOG]; colfunc = colfuncs[COLDRAWFUNC_FOG];
@ -479,7 +473,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
{ {
if (blendmode) if (blendmode)
dc_transmap = R_GetBlendTable(blendmode, blendlevel); dc_transmap = R_GetBlendTable(blendmode, blendlevel);
else else if (blendlevel > 0 && blendlevel < 10)
dc_transmap = R_GetTranslucencyTable(blendlevel); dc_transmap = R_GetTranslucencyTable(blendlevel);
if (dc_transmap) if (dc_transmap)
@ -3265,7 +3259,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (frontsector->numlights) if (frontsector->numlights)
{ {
dc_numlights = frontsector->numlights; dc_numlights = frontsector->numlights;
if (dc_numlights >= dc_maxlights) if (dc_numlights > dc_maxlights)
{ {
dc_maxlights = dc_numlights; dc_maxlights = dc_numlights;
dc_lightlist = Z_Realloc(dc_lightlist, sizeof (*dc_lightlist) * dc_maxlights, PU_STATIC, NULL); dc_lightlist = Z_Realloc(dc_lightlist, sizeof (*dc_lightlist) * dc_maxlights, PU_STATIC, NULL);