GL3: flashing screen (formerly R_Flash())

which just called R_PolyBlend().. no idea what that all was about..
and no idea why it happend in 3D mode, it's much  easier after
SetGL2D(), then it can share code with GL3_Draw_FadeScreen() and doesn't
need any additional messing with transformation matrices
This commit is contained in:
Daniel Gibson 2017-02-26 02:23:20 +01:00
parent 247a81c69b
commit cf11473130
4 changed files with 24 additions and 65 deletions

View file

@ -290,11 +290,15 @@ GL3_Draw_Fill(int x, int y, int w, int h, int c)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
// in GL1 this is called R_Flash() (which just calls R_PolyBlend())
// now implemented in 2D mode and called after SetGL2D() because
// it's pretty similar to GL3_Draw_FadeScreen()
void
GL3_Draw_FadeScreen(void)
GL3_Draw_Flash(const float color[4])
{
float w = vid.width;
float h = vid.height;
int i=0;
GLfloat vBuf[8] = {
// X, Y
@ -306,7 +310,8 @@ GL3_Draw_FadeScreen(void)
glEnable(GL_BLEND);
gl3state.uniCommonData.color = HMM_Vec4(0, 0, 0, 0.6f);
for(i=0; i<4; ++i) gl3state.uniCommonData.color.Elements[i] = color[i];
GL3_UpdateUBOCommon();
GL3_UseProgram(gl3state.si2Dcolor.shaderProgram);
@ -321,6 +326,13 @@ GL3_Draw_FadeScreen(void)
glDisable(GL_BLEND);
}
void
GL3_Draw_FadeScreen(void)
{
float color[4] = {0, 0, 0, 0.6f};
GL3_Draw_Flash(color);
}
void
GL3_Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data)
{

View file

@ -801,54 +801,6 @@ GL3_DrawNullModel(void)
#endif // 0
}
#if 0
static void
GL3_PolyBlend(void)
{
if (!gl_polyblend->value)
{
return;
}
if (!v_blend[3])
{
return;
}
glDisable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glLoadIdentity();
glRotatef(-90, 1, 0, 0); /* put Z going up */
glRotatef(90, 0, 0, 1); /* put Z going up */
glColor4f( v_blend[0], v_blend[1], v_blend[2], v_blend[3] );
GLfloat vtx[] = {
10, 100, 100,
10, -100, 100,
10, -100, -100,
10, 100, -100
};
glEnableClientState( GL_VERTEX_ARRAY );
glVertexPointer( 3, GL_FLOAT, 0, vtx );
glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
glDisableClientState( GL_VERTEX_ARRAY );
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glColor4f(1, 1, 1, 1);
}
#endif // 0
static void
GL3_DrawParticles(void)
{
@ -871,6 +823,7 @@ GL3_DrawParticles(void)
GLfloat dist;
GLfloat color[4];
} part_vtx;
assert(sizeof(part_vtx)==9*sizeof(float)); // remember to update GL3_SurfInit() if this changes!
part_vtx buf[numParticles];
@ -886,8 +839,7 @@ GL3_DrawParticles(void)
for ( i = 0, p = gl3_newrefdef.particles; i < numParticles; i++, p++ )
{
//*(int *) color = d_8to24table [ p->color & 0xFF ];
memcpy(color, &d_8to24table[ p->color & 0xFF ], 4);
*(int *) color = d_8to24table [ p->color & 0xFF ];
part_vtx* cur = &buf[i];
vec3_t offset; // between viewOrg and particle position
VectorSubtract(viewOrg, p->origin, offset);
@ -901,8 +853,6 @@ GL3_DrawParticles(void)
cur->color[3] = p->alpha;
}
assert(sizeof(part_vtx)==9*sizeof(float));
GL3_BindVAO(gl3state.vaoParticle);
GL3_BindVBO(gl3state.vboParticle);
glBufferData(GL_ARRAY_BUFFER, sizeof(part_vtx)*numParticles, buf, GL_STREAM_DRAW);
@ -918,8 +868,6 @@ GL3_DrawParticles(void)
static void
GL3_DrawEntitiesOnList(void)
{
STUB_ONCE("TODO: Implement!");
int i;
if (!gl_drawentities->value)
@ -1325,6 +1273,8 @@ SetupGL(void)
glEnable(GL_DEPTH_TEST);
}
extern int c_visible_lightmaps, c_visible_textures;
/*
* gl3_newrefdef must be set before the first call
*/
@ -1481,15 +1431,14 @@ GL3_RenderView(refdef_t *fd)
GL3_DrawWorld();
GL3_DrawEntitiesOnList();
#if 0 // TODO !!
GL3_RenderDlights();
#endif // 0
GL3_DrawParticles();
GL3_DrawAlphaSurfaces();
#if 0
R_Flash();
// Note: R_Flash() is now GL3_Draw_Flash() and called from GL3_RenderFrame()
if (gl_speeds->value)
{
@ -1498,8 +1447,6 @@ GL3_RenderView(refdef_t *fd)
c_visible_lightmaps);
}
#endif // 0
#if 0 // TODO: stereo stuff
switch (gl_state.stereo_mode) {
case STEREO_MODE_NONE:
@ -1577,13 +1524,14 @@ GL3_SetLightLevel(void)
}
}
static void
GL3_RenderFrame(refdef_t *fd)
{
GL3_RenderView(fd);
GL3_SetLightLevel();
GL3_SetGL2D();
GL3_Draw_Flash(v_blend);
}

View file

@ -655,8 +655,6 @@ RenderBrushPoly(msurface_t *fa)
void
GL3_DrawAlphaSurfaces(void)
{
STUB_ONCE("TODO: implement!");
msurface_t *s;
float intens;

View file

@ -340,6 +340,7 @@ extern void GL3_Draw_CharScaled(int x, int y, int num, float scale);
extern void GL3_Draw_TileClear(int x, int y, int w, int h, char *pic);
extern void GL3_Draw_Fill(int x, int y, int w, int h, int c);
extern void GL3_Draw_FadeScreen(void);
extern void GL3_Draw_Flash(const float color[4]);
extern void GL3_Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data);
// gl3_image.c