Don't apply color cube in md2_loadTexture when in palette rendering mode

Fixes brightness getting applied twice on models in palette rendering mode
This commit is contained in:
Hannu Hanhi 2021-09-19 00:17:56 +03:00
parent bbf23a5143
commit 6c4cb3a025

View file

@ -387,8 +387,6 @@ static void md2_loadTexture(md2_t *model)
if (!grPatch->mipmap->downloaded && !grPatch->mipmap->data) if (!grPatch->mipmap->downloaded && !grPatch->mipmap->data)
{ {
int w = 0, h = 0; int w = 0, h = 0;
UINT32 size;
RGBA_t *image;
#ifdef HAVE_PNG #ifdef HAVE_PNG
grPatch->mipmap->format = PNG_Load(filename, &w, &h, grPatch); grPatch->mipmap->format = PNG_Load(filename, &w, &h, grPatch);
@ -409,13 +407,19 @@ static void md2_loadTexture(md2_t *model)
grPatch->mipmap->width = (UINT16)w; grPatch->mipmap->width = (UINT16)w;
grPatch->mipmap->height = (UINT16)h; grPatch->mipmap->height = (UINT16)h;
// Lactozilla: Apply colour cube // for palette rendering, color cube is applied in post-processing instead of here
image = grPatch->mipmap->data; if (!HWR_ShouldUsePaletteRendering())
size = w*h;
while (size--)
{ {
V_CubeApply(&image->s.red, &image->s.green, &image->s.blue); UINT32 size;
image++; RGBA_t *image;
// Lactozilla: Apply colour cube
image = grPatch->mipmap->data;
size = w*h;
while (size--)
{
V_CubeApply(&image->s.red, &image->s.green, &image->s.blue);
image++;
}
} }
} }
HWD.pfnSetTexture(grPatch->mipmap); HWD.pfnSetTexture(grPatch->mipmap);