mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Encore colormap textures-as-flats in GL
This commit is contained in:
parent
016cc1e95f
commit
5e8da61e5e
1 changed files with 14 additions and 9 deletions
|
|
@ -861,11 +861,18 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||||
flat[steppy] = grMipmap->colormap->source[flat[steppy]];
|
flat[steppy] = grMipmap->colormap->source[flat[steppy]];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
|
static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum, boolean noencoremap)
|
||||||
{
|
{
|
||||||
UINT8 *flat;
|
UINT8 *flat;
|
||||||
UINT8 *converted;
|
UINT8 *converted;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
size_t i;
|
||||||
|
UINT8 *colormap = colormaps;
|
||||||
|
|
||||||
|
if (!noencoremap && encoremap)
|
||||||
|
{
|
||||||
|
colormap += COLORMAP_REMAPOFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
// setup the texture info
|
// setup the texture info
|
||||||
grMipmap->format = GL_TEXFMT_P_8;
|
grMipmap->format = GL_TEXFMT_P_8;
|
||||||
|
|
@ -878,6 +885,11 @@ static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
|
||||||
flat = Z_Malloc(size, PU_HWRCACHE, &grMipmap->data);
|
flat = Z_Malloc(size, PU_HWRCACHE, &grMipmap->data);
|
||||||
converted = (UINT8 *)Picture_TextureToFlat(texturenum);
|
converted = (UINT8 *)Picture_TextureToFlat(texturenum);
|
||||||
M_Memcpy(flat, converted, size);
|
M_Memcpy(flat, converted, size);
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
flat[i] = colormap[flat[i]];
|
||||||
|
}
|
||||||
Z_Free(converted);
|
Z_Free(converted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -946,14 +958,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat, boolean noencoremap)
|
||||||
// Generate flat if missing from the cache
|
// Generate flat if missing from the cache
|
||||||
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
|
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
|
||||||
{
|
{
|
||||||
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum);
|
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum, noencoremap);
|
||||||
|
|
||||||
if (!noencoremap && encoremap)
|
|
||||||
{
|
|
||||||
grtex->mipmap.colormap = Z_Calloc(sizeof(*grtex->mipmap.colormap), PU_HWRPATCHCOLMIPMAP, NULL);
|
|
||||||
grtex->mipmap.colormap->source = colormaps + COLORMAP_REMAPOFFSET;
|
|
||||||
M_Memcpy(grtex->mipmap.colormap->data, colormaps + COLORMAP_REMAPOFFSET, 256);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue