Optimize vignette rendering

This commit is contained in:
Lubos 2022-03-19 21:58:23 +01:00
parent 950f36de85
commit 2d0f0a3330
3 changed files with 9 additions and 6 deletions

View file

@ -2623,14 +2623,19 @@ static void CG_DrawVignette( void )
int y = (int)(0 + currentComfortVignetteValue * cg.refdef.height / 3.5f);
int h = (int)(cg.refdef.height - 2 * y);
vec4_t black = {0.0, 0.0, 0.0, 1};
trap_R_SetColor( black );
// sides
trap_R_DrawStretchPic( 0, 0, x, cg.refdef.height, 0, 0, 1, 1, cgs.media.maskShader );
trap_R_DrawStretchPic( cg.refdef.width - x, 0, x, cg.refdef.height, 0, 0, 1, 1, cgs.media.maskShader );
trap_R_DrawStretchPic( 0, 0, x, cg.refdef.height, 0, 0, 1, 1, cgs.media.whiteShader );
trap_R_DrawStretchPic( cg.refdef.width - x, 0, x, cg.refdef.height, 0, 0, 1, 1, cgs.media.whiteShader );
// top/bottom
trap_R_DrawStretchPic( x, 0, cg.refdef.width - x, y, 0, 0, 1, 1, cgs.media.maskShader );
trap_R_DrawStretchPic( x, cg.refdef.height - y, cg.refdef.width - x, y, 0, 0, 1, 1, cgs.media.maskShader );
trap_R_DrawStretchPic( x, 0, cg.refdef.width - x, y, 0, 0, 1, 1, cgs.media.whiteShader );
trap_R_DrawStretchPic( x, cg.refdef.height - y, cg.refdef.width - x, y, 0, 0, 1, 1, cgs.media.whiteShader );
// vignette
trap_R_DrawStretchPic( x, y, w, h, 0, 0, 1, 1, cgs.media.vignetteShader );
trap_R_SetColor( NULL );
}
}

View file

@ -1012,7 +1012,6 @@ typedef struct {
// comfort vignette
qhandle_t vignetteShader;
qhandle_t maskShader;
} cgMedia_t;

View file

@ -1052,7 +1052,6 @@ static void CG_RegisterGraphics( void ) {
//Load from pakQ3Q
cgs.media.reticleShader = trap_R_RegisterShader( "gfx/weapon/scope" );
cgs.media.vignetteShader = trap_R_RegisterShader( "gfx/vignette" );
cgs.media.maskShader = trap_R_RegisterShader( "gfx/mask" );
//Used for the weapon selector
cgs.media.smallSphereModel = trap_R_RegisterModel("models/powerups/health/small_sphere.md3");