dedupe GL_DrawWaterPolygon

This commit is contained in:
alufolie91 committed 2026-07-16 17:57:52 +02:00
1 parent 3e459d4a21
commit 6cf2561dd3
3 files changed
+9 -21

No files matched your search

+1 -1
View File
@@ -39,7 +39,7 @@ void GL_EnableStencilTest(void);
void GL_DisableStencilTest(void);
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
void GL_DrawWaterPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader);
void GL_DrawWaterPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
void GL_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
+5 -5
View File
@@ -723,7 +723,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
if (alpha < 255)
{
shader = SHADER_WATERREFRACT;
GL_DrawWaterPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags|PF_ColorMapped, shader);
GL_DrawWaterPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags|PF_ColorMapped);
}
}
else
@@ -815,7 +815,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
// Draw
if (shader == SHADER_WATERREFRACT)
GL_DrawWaterPolygon(&Surf, horizonpts, 6, PolyFlags, shader);
GL_DrawWaterPolygon(&Surf, horizonpts, 6, PolyFlags);
else
HWR_ProcessPolygon(&Surf, horizonpts, 6, PolyFlags, shader, true);
}
@@ -4352,15 +4352,15 @@ static void HWR_RenderRefractionWater(void)
// all this bullshit
// just so either ceiling or floor planes can be captured in the opposite plane........
// sincerely im not sure if the performance tradeoff is worth it
// considering most water floors in a water fof with a ceiling (or vice versa) are mapping oversights
// but ig this is technically more "correct" (this all sucks massive ass regardless sned help)
// caveat with all of this is
// some translucent things behind water planes may not get the refraction...
// i have no clue how to ever fix that (maybe another pass with more depth compares? kinda wonder if we even need the whole drawnode thing in gl anyways)
// but it seems like software also suffers from this in some cases
// other idea: copy only screen parts that water covers similar to software but per plane
// maybe that will be fast enough?
static std::vector<gl_drawnode_t> waterdrawnodes;
const size_t numdrawnodes = drawnodes.size();
+3 -15
View File
@@ -2498,10 +2498,9 @@ void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, F
Clamp2D(GL_TEXTURE_WRAP_T);
}
void GL_DrawWaterPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader)
void GL_DrawWaterPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
{
GL_SetShader(HWR_GetShaderFromTarget(shader));
GL_PreparePolygon(pSurf, PolyFlags);
GL_SetShader(HWR_GetShaderFromTarget(SHADER_WATERREFRACT));
pglActiveTexture(GL_TEXTURE4);
pglBindTexture(GL_TEXTURE_2D, sceneTextures[SCENE_TEX]);
@@ -2511,18 +2510,7 @@ void GL_DrawWaterPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumP
pglBindTexture(GL_TEXTURE_2D, sceneTextures[SCENE_DEPTHTEX]);
pglActiveTexture(GL_TEXTURE0);
pglVertexPointer(3, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].x);
pglTexCoordPointer(2, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].s);
pglDrawArrays(GL_TRIANGLE_FAN, 0, iNumPts);
if (PolyFlags & PF_RemoveYWrap)
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
if (PolyFlags & PF_ForceWrapX)
Clamp2D(GL_TEXTURE_WRAP_S);
if (PolyFlags & PF_ForceWrapY)
Clamp2D(GL_TEXTURE_WRAP_T);
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
}
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)