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,6 +407,11 @@ 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;
// for palette rendering, color cube is applied in post-processing instead of here
if (!HWR_ShouldUsePaletteRendering())
{
UINT32 size;
RGBA_t *image;
// Lactozilla: Apply colour cube // Lactozilla: Apply colour cube
image = grPatch->mipmap->data; image = grPatch->mipmap->data;
size = w*h; size = w*h;
@ -418,6 +421,7 @@ static void md2_loadTexture(md2_t *model)
image++; image++;
} }
} }
}
HWD.pfnSetTexture(grPatch->mipmap); HWD.pfnSetTexture(grPatch->mipmap);
} }