change this

This commit is contained in:
Alug committed 2024-01-09 12:23:43 +01:00
1 parent 57cee31279
commit 25bc55730e
2 files changed
+10 -3

No files matched your search

+2
View File
@@ -517,6 +517,8 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col
Surface->LightTableId = colormap->gl_lighttable_id;
}
else
Surface->LightTableId = 0;
}
void HWR_ClearLightTableCache(void)
+8 -3
View File
@@ -76,6 +76,7 @@ static float NEAR_CLIPPING_PLANE = NZCLIP_PLANE;
static GLuint tex_downloaded = 0;
static GLuint lt_downloaded = 0; // currently bound lighttable texture
static GLfloat fov = 90.0f;
static FBITFIELD CurrentPolyFlags;
@@ -1688,6 +1689,7 @@ EXPORT void HWRAPI(ClearLightTableCache) (void)
ltcachehead = next;
}
ltcachetail = NULL;
lt_downloaded = 0;
}
// -----------------+
@@ -2567,11 +2569,12 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
if (gl_allowshaders)
{
Shader_Load(&currentSurfaceInfo, &firstPoly, &firstTint, &firstFade);
if (gl_palshader)
if ((gl_palshader) && (currentSurfaceInfo.LightTableId && currentSurfaceInfo.LightTableId != lt_downloaded))
{
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
pglBindTexture(GL_TEXTURE_2D, currentSurfaceInfo.LightTableId);
pglActiveTexture(GL_TEXTURE0);
lt_downloaded = currentSurfaceInfo.LightTableId;
}
}
@@ -2829,11 +2832,12 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
Shader_Load(&nextSurfaceInfo, &poly, &tint, &fade);
if (gl_palshader)
if ((gl_palshader) && (nextSurfaceInfo.LightTableId && nextSurfaceInfo.LightTableId != lt_downloaded))
{
pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now
pglBindTexture(GL_TEXTURE_2D, nextSurfaceInfo.LightTableId);
pglActiveTexture(GL_TEXTURE0);
lt_downloaded = nextSurfaceInfo.LightTableId;
}
}
@@ -2940,11 +2944,12 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
}
if (gl_palshader && gl_allowshaders)
if ((gl_palshader && gl_allowshaders) && (pSurf->LightTableId && pSurf->LightTableId != lt_downloaded))
{
pglActiveTexture(GL_TEXTURE2);
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
pglActiveTexture(GL_TEXTURE0);
lt_downloaded = pSurf->LightTableId;
}
}