- abstracted uploadpalswap out of the game code.

This needs special setup on the renderer side that needs to be done in a more controlled fashion.
This commit is contained in:
Christoph Oelckers 2019-10-06 19:47:31 +02:00
parent ef2de97077
commit b1aaafb973
3 changed files with 14 additions and 7 deletions

View file

@ -35,7 +35,7 @@ void polymost_outputGLDebugMessage(uint8_t severity, const char* format, ...);
//void phex(char v, char *s);
void uploadtexture(FHardwareTexture *tex, int32_t doalloc, vec2_t siz, int32_t texfmt, coltype *pic, vec2_t tsiz, int32_t dameth);
void uploadbasepalette(int32_t basepalnum, bool transient = false);
void uploadpalswap(int32_t palookupnum);
void uploadpalswaps(int count, int32_t *palookupnum);
void polymost_drawsprite(int32_t snum);
void polymost_drawmaskwall(int32_t damaskwallcnt);
void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,

View file

@ -366,6 +366,7 @@ static void polymost_bindPth(pthtyp const* const pPth, int sampler)
FileReader GetBaseResource(const char* fn);
void uploadpalswap(int32_t palookupnum);
// one-time initialization of OpenGL for polymost
void polymost_glinit()
@ -714,6 +715,15 @@ void uploadbasepalette(int32_t basepalnum, bool transient) // transient palettes
paletteTextureIDs[basepalnum]->LoadTexture(basepalWFullBrightInfo); // RGBA
}
// Used by RRRA fog hackery - the only place changing the palswaps at run time.
void uploadpalswaps(int count, int32_t* swaps)
{
for (int i = 0; i < count; i++)
{
uploadpalswap(i);
}
}
void uploadpalswap(int32_t palookupnum)
{
if (!palookup[palookupnum])

View file

@ -2688,12 +2688,9 @@ void G_SetFog(int fogtype)
fogtable[i].b = palookupfog[i].b * (1.f/255.f);
fogtable[i].a = 0;
}
gltexinvalidatetype(INVALIDATE_ALL_NON_INDEXED);
uploadpalswap(0);
uploadpalswap(30);
uploadpalswap(33);
uploadpalswap(23);
uploadpalswap(8);
//gltexinvalidatetype(INVALIDATE_ALL_NON_INDEXED);
static int swaps[] = { 0, 30, 33, 23, 8 };
uploadpalswaps(5, swaps);
}
#endif
}