mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add encoremap to textures-as-flats
This commit is contained in:
parent
b2b03ecbb5
commit
9147aeaac7
1 changed files with 13 additions and 1 deletions
|
|
@ -895,7 +895,7 @@ void HWR_GetRawFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||||
patch = HWR_GetCachedGLPatch(flatlumpnum);
|
patch = HWR_GetCachedGLPatch(flatlumpnum);
|
||||||
grmip = ((GLPatch_t *)Patch_AllocateHardwarePatch(patch))->mipmap;
|
grmip = ((GLPatch_t *)Patch_AllocateHardwarePatch(patch))->mipmap;
|
||||||
|
|
||||||
if (!grmip->downloaded && !grmip->data)
|
if (!grmip->colormap)
|
||||||
{
|
{
|
||||||
if (!noencoremap && encoremap)
|
if (!noencoremap && encoremap)
|
||||||
colormap += COLORMAP_REMAPOFFSET;
|
colormap += COLORMAP_REMAPOFFSET;
|
||||||
|
|
@ -903,7 +903,10 @@ void HWR_GetRawFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||||
grmip->colormap = Z_Calloc(sizeof(*grmip->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
|
grmip->colormap = Z_Calloc(sizeof(*grmip->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
|
||||||
grmip->colormap->source = colormap;
|
grmip->colormap->source = colormap;
|
||||||
M_Memcpy(grmip->colormap->data, colormap, 256 * sizeof(UINT8));
|
M_Memcpy(grmip->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!grmip->downloaded && !grmip->data)
|
||||||
|
{
|
||||||
HWR_CacheFlat(grmip, flatlumpnum);
|
HWR_CacheFlat(grmip, flatlumpnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -942,8 +945,17 @@ 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);
|
||||||
|
|
||||||
|
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
|
||||||
if (!grtex->mipmap.downloaded)
|
if (!grtex->mipmap.downloaded)
|
||||||
HWD.pfnSetTexture(&grtex->mipmap);
|
HWD.pfnSetTexture(&grtex->mipmap);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue