Revert "make brightmaps "work" in palrender"

This reverts commit 041fb80a7f.
This commit is contained in:
NepDisk 2025-12-14 23:36:06 -05:00
parent 670a69b648
commit 24ffd5d8a2
4 changed files with 14 additions and 64 deletions

View file

@ -150,9 +150,7 @@ enum
SHADER_NONE = -1,
SHADER_FLOOR = 0,
SHADER_BRIGHTMAP_FLOOR,
SHADER_WALL,
SHADER_BRIGHTMAP_WALL,
SHADER_SPRITE,
SHADER_MODEL,
SHADER_MODEL_LIGHTING,

View file

@ -545,8 +545,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
shader = SHADER_FOG;
else if (PolyFlags & PF_Ripple)
shader = SHADER_WATER;
else if (levelflat != NULL && levelflat->type == LEVELFLAT_TEXTURE && R_GetTextureBrightmap(levelflat->texture_id) && HWR_ShouldUsePaletteRendering())
shader = SHADER_BRIGHTMAP_FLOOR;
else
shader = SHADER_FLOOR;
@ -738,7 +736,7 @@ static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, I
//
// HWR_ProjectWall
//
static void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap, INT32 texnum)
static void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap)
{
INT32 shader = SHADER_NONE;
@ -746,11 +744,7 @@ static void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIEL
if (HWR_UseShader())
{
if (R_GetTextureBrightmap(texnum) && HWR_ShouldUsePaletteRendering())
shader = SHADER_BRIGHTMAP_WALL;
else
shader = SHADER_WALL;
shader = SHADER_WALL;
blendmode |= PF_ColorMapped;
}
@ -913,7 +907,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
else if (polyflags & PF_EnvironmentTrans)
HWR_AddTransparentWall(wallVerts, Surf, texnum, noencore, polyflags, false, HWR_CalcWallLight(lightnum, gl_curline), colormap);
else
HWR_ProjectWall(wallVerts, Surf, polyflags, HWR_CalcWallLight(lightnum, gl_curline), colormap, texnum);
HWR_ProjectWall(wallVerts, Surf, polyflags, HWR_CalcWallLight(lightnum, gl_curline), colormap);
top = bot;
endtop = endbot;
@ -942,7 +936,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
else if (polyflags & PF_EnvironmentTrans)
HWR_AddTransparentWall(wallVerts, Surf, texnum, noencore, polyflags, false, HWR_CalcWallLight(lightnum, gl_curline), colormap);
else
HWR_ProjectWall(wallVerts, Surf, polyflags, HWR_CalcWallLight(lightnum, gl_curline), colormap, texnum);
HWR_ProjectWall(wallVerts, Surf, polyflags, HWR_CalcWallLight(lightnum, gl_curline), colormap);
}
// HWR_DrawSkyWall
@ -956,7 +950,7 @@ static void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf)
wallVerts[0].s = wallVerts[3].s = 0;
wallVerts[2].s = wallVerts[1].s = 0;
// this no longer sets top/bottom coords, this should be done before caling the function
HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_NoTexture, 255, NULL, 0);
HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_NoTexture, 255, NULL);
// PF_Invisible so it's not drawn into the colour buffer
// PF_NoTexture for no texture
// PF_Occlude is set in HWR_ProjectWall to draw into the depth buffer
@ -1273,7 +1267,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else if (grTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, &Surf, gl_toptexture, noencore, polyflags, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, polyflags, lightnum, colormap, gl_toptexture);
HWR_ProjectWall(wallVerts, &Surf, polyflags, lightnum, colormap);
}
// check BOTTOM TEXTURE
@ -1337,7 +1331,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else if (grTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, &Surf, gl_bottomtexture, noencore, polyflags, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, polyflags, lightnum, colormap, gl_bottomtexture);
HWR_ProjectWall(wallVerts, &Surf, polyflags, lightnum, colormap);
}
// Render midtexture if there's one. Determine if it's visible first, though
@ -1560,7 +1554,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else if (!(blendmode & PF_Masked))
HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, noencore, blendmode, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap, gl_midtexture);
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap);
}
// Sky culling
@ -1651,7 +1645,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (grTex->mipmap.flags & TF_TRANSPARENT)
HWR_AddTransparentWall(wallVerts, &Surf, gl_midtexture, noencore, blendmode, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap, gl_midtexture);
HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap);
}
}
}
@ -1859,7 +1853,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (blendmode != PF_Masked)
HWR_AddTransparentWall(wallVerts, &Surf, texnum, noencore, blendmode, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap, texnum);
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
}
}
}
@ -1985,7 +1979,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (blendmode != PF_Masked)
HWR_AddTransparentWall(wallVerts, &Surf, texnum, noencore, blendmode, false, lightnum, colormap);
else
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap, texnum);
HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap);
}
}
}
@ -4248,7 +4242,7 @@ typedef struct
static wallinfo_t *wallinfo = NULL;
static size_t numwalls = 0; // a list of transparent walls to be drawn
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap, INT32 texnum);
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
#define MAX_TRANSPARENTWALL 256
@ -4512,7 +4506,7 @@ static void HWR_CreateDrawNodes(void)
if (!(sortnode[sortindex[i]].wall->blend & PF_NoTexture))
HWR_GetTexture(sortnode[sortindex[i]].wall->texnum, sortnode[sortindex[i]].wall->noencore);
HWR_RenderWall(sortnode[sortindex[i]].wall->wallVerts, &sortnode[sortindex[i]].wall->Surf, sortnode[sortindex[i]].wall->blend, sortnode[sortindex[i]].wall->fogwall,
sortnode[sortindex[i]].wall->lightlevel, sortnode[sortindex[i]].wall->wallcolormap, sortnode[sortindex[i]].wall->texnum);
sortnode[sortindex[i]].wall->lightlevel, sortnode[sortindex[i]].wall->wallcolormap);
}
}
@ -6509,7 +6503,7 @@ static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, I
numwalls++;
}
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap, INT32 texnum)
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap)
{
FBITFIELD blendmode = blend;
UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha
@ -6528,8 +6522,6 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend,
{
if (fogwall)
shader = SHADER_FOG;
else if (R_GetTextureBrightmap(texnum) && HWR_ShouldUsePaletteRendering())
shader = SHADER_BRIGHTMAP_WALL;
else
shader = SHADER_WALL;

View file

@ -27,12 +27,6 @@ static struct {
// Floor shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_FLOOR_FRAGMENT_SHADER},
// Brightmap Floor shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_BRIGHTMAP_FLOOR_FRAGMENT_SHADER},
// Brightmap Wall shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_BRIGHTMAP_WALL_FRAGMENT_SHADER},
// Wall shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
@ -437,9 +431,7 @@ static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
customshaderxlat_t shaderxlat[] =
{
{"Flat", SHADER_FLOOR},
{"BrightmapFloor", SHADER_BRIGHTMAP_FLOOR},
{"WallTexture", SHADER_WALL},
{"BrightmapWall", SHADER_BRIGHTMAP_WALL},
{"Sprite", SHADER_SPRITE},
{"Model", SHADER_MODEL},
{"WaterRipple", SHADER_WATER},

View file

@ -197,30 +197,6 @@
"gl_FragColor = final_color;\n" \
"}\n" \
"#endif\0"
#define GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL \
"uniform sampler2D tex;\n" \
"uniform sampler2D brightmap;\n" \
"uniform vec4 poly_color;\n" \
"uniform vec4 tint_color;\n" \
"uniform vec4 fade_color;\n" \
"uniform float lighting;\n" \
"uniform float fade_start;\n" \
"uniform float fade_end;\n" \
GLSL_DOOM_COLORMAP \
GLSL_DOOM_LIGHT_EQUATION \
"void main(void) {\n" \
"vec4 texel = texture2D(tex, gl_TexCoord[0].st);\n" \
"vec4 base_color = texel * poly_color;\n" \
"vec4 final_color = base_color;\n" \
"float brightmap_mix = floor(texture2D(brightmap, gl_TexCoord[0].st).r);\n" \
"float light_gain = (255.0 - lighting) * brightmap_mix;\n" \
"float final_lighting = lighting + light_gain;\n" \
GLSL_SOFTWARE_TINT_EQUATION \
GLSL_SOFTWARE_FADE_EQUATION \
"final_color.a = texel.a * poly_color.a;\n" \
"gl_FragColor = final_color;\n" \
"}\n" \
// hand tuned adjustments for light level calculation
#define GLSL_FLOOR_FUDGES \
@ -241,14 +217,6 @@
GLSL_WALL_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER
#define GLSL_BRIGHTMAP_FLOOR_FRAGMENT_SHADER \
GLSL_FLOOR_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
#define GLSL_BRIGHTMAP_WALL_FRAGMENT_SHADER \
GLSL_WALL_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
// same as above but multiplies results with the lighting value from the
// accompanying vertex shader (stored in gl_Color)
#define GLSL_SOFTWARE_MODEL_LIGHTING_FRAGMENT_SHADER \