Merge pull request #27 from lvonasek/master

Vignette rendering optimalisation
This commit is contained in:
Simon 2022-03-20 09:46:46 +00:00 committed by GitHub
commit 0bd08098d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 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");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB