Invert the screen for encore circle transition in OpenGL

This commit is contained in:
Sryder 2021-02-16 18:26:45 +00:00
parent 3ac803be76
commit 0d43c3e3ad
5 changed files with 29 additions and 2 deletions

View file

@ -219,7 +219,8 @@ enum EPolyFlags
PF_Substractive = 0x00000010, // for splat
PF_NoAlphaTest = 0x00000020, // hiden param
PF_Fog = 0x00000040, // Fog blocks
PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive|PF_Fog)&~PF_NoAlphaTest,
PF_Invert = 0x00000080, // Polygon inverts the colours of what it's in front of
PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive|PF_Fog|PF_Invert)&~PF_NoAlphaTest,
// other flag bits

View file

@ -697,6 +697,27 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
}
void HWR_EncoreInvertScreen(void)
{
FOutVector v[4];
FSurfaceInfo Surf;
v[0].x = v[3].x = -1.0f;
v[2].x = v[1].x = 1.0f;
v[0].y = v[1].y = -1.0f;
v[2].y = v[3].y = 1.0f;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
v[0].s = v[3].s = 0.0f;
v[2].s = v[1].s = 1.0f;
v[0].t = v[1].t = 1.0f;
v[2].t = v[3].t = 0.0f;
Surf.PolyColor.rgba = 0xFFFFFFFF;
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Invert|PF_NoDepthTest);
}
// Very similar to HWR_DrawConsoleBack, except we draw from the middle(-ish) of the screen to the bottom.
void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight)
{

View file

@ -28,6 +28,7 @@ void HWR_Shutdown(void);
void HWR_drawAMline(const fline_t *fl, INT32 color);
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength);
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
void HWR_EncoreInvertScreen(void);
void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight);
void HWR_RenderSkyboxView(player_t *player);
void HWR_RenderPlayerView(void);

View file

@ -1599,6 +1599,10 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
pglBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR);
pglAlphaFunc(GL_ALWAYS, 0.0f); // Don't discard zero alpha fragments
break;
case PF_Invert & PF_Invert:
pglBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
pglAlphaFunc(GL_GREATER, 0.5f);
break;
default : // must be 0, otherwise it's an error
// No blending
pglBlendFunc(GL_ONE, GL_ZERO); // the same as no blending

View file

@ -1505,7 +1505,7 @@ void V_EncoreInvertScreen(void)
#ifdef HWRENDER
if (rendermode != render_soft && rendermode != render_none)
{
//HWR_EncoreInvertScreen();
HWR_EncoreInvertScreen();
return;
}
#endif