we need this stuff but do it like new palshader

This commit is contained in:
Alug committed 2024-01-10 10:57:29 +01:00
1 parent 0ef4edc257
commit bb24b767a6
1 file changed
+15 -7
+15 -7
View File
@@ -82,6 +82,9 @@ static float NEAR_CLIPPING_PLANE = NZCLIP_PLANE;
static GLuint tex_downloaded = 0;
static GLuint lt_downloaded = 0; // currently bound lighttable texture - currentSurfaceInfo
static GLuint lt_downloaded2 = 0; // currently bound lighttable texture - nextSurfaceInfo
static GLuint lt_downloaded3 = 0; // currently bound lighttable texture - pSurf
static GLfloat fov = 90.0f;
static FBITFIELD CurrentPolyFlags;
@@ -1632,9 +1635,6 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
pglClear(ClearMask);
pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one
pglEnableClientState(GL_TEXTURE_COORD_ARRAY); // And mostly this one, too
//if ((!gl_palette_initialized) && (gl_palshader))
//InitPalette(0, false); // just gonna put this here for now
}
@@ -2402,11 +2402,12 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
{
Shader_Load(&currentSurfaceInfo, &firstPoly, &firstTint, &firstFade);
if (HWR_ShouldUsePaletteRendering())
if (currentSurfaceInfo.LightTableId && currentSurfaceInfo.LightTableId != lt_downloaded)
{
pglActiveTexture(GL_TEXTURE2);
pglBindTexture(GL_TEXTURE_2D, currentSurfaceInfo.LightTableId);
pglActiveTexture(GL_TEXTURE0);
lt_downloaded = currentSurfaceInfo.LightTableId;
}
}
@@ -2664,12 +2665,13 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i
fade.alpha = byte2float[nextSurfaceInfo.FadeColor.s.alpha];
Shader_Load(&nextSurfaceInfo, &poly, &tint, &fade);
if (HWR_ShouldUsePaletteRendering())
if (nextSurfaceInfo.LightTableId && nextSurfaceInfo.LightTableId != lt_downloaded2)
{
pglActiveTexture(GL_TEXTURE2);
pglBindTexture(GL_TEXTURE_2D, nextSurfaceInfo.LightTableId);
pglActiveTexture(GL_TEXTURE0);
lt_downloaded2 = nextSurfaceInfo.LightTableId;
}
}
@@ -2775,11 +2777,12 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
fade.blue = byte2float[pSurf->FadeColor.s.blue];
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
if (HWR_ShouldUsePaletteRendering())
if (pSurf->LightTableId && pSurf->LightTableId != lt_downloaded3)
{
pglActiveTexture(GL_TEXTURE2);
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
pglActiveTexture(GL_TEXTURE0);
lt_downloaded3 = pSurf->LightTableId;
}
}
}
@@ -4401,6 +4404,11 @@ EXPORT void HWRAPI(ClearLightTables)(void)
}
LightTablesTail = NULL;
// we no longer have a bound light table (if we had one), we just deleted it!
lt_downloaded = 0;
lt_downloaded2 = 0;
lt_downloaded3 = 0;
}
// This palette is used for the palette rendering postprocessing step.