diff --git a/src/hardware/hw_gl.h b/src/hardware/hw_gl.h index dd5a7db29..fda744909 100644 --- a/src/hardware/hw_gl.h +++ b/src/hardware/hw_gl.h @@ -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); diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 634242baa..269566f99 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -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 waterdrawnodes; const size_t numdrawnodes = drawnodes.size(); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 16bffd582..b80b2097d 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -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)