From 3440ddf443216a00e55491dd0393f36a99d84891 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 13 Apr 2026 13:47:08 +0500 Subject: [PATCH] ref: gl: read ref_viewpass_t flags instead of cached RI.drawWorld --- ref/gl/gl_alias.c | 4 ++-- ref/gl/gl_backend.c | 4 ++-- ref/gl/gl_local.h | 1 - ref/gl/gl_rmain.c | 17 ++++++++--------- ref/gl/gl_rsurf.c | 10 ++++++---- ref/gl/gl_studio.c | 14 +++++++------- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ref/gl/gl_alias.c b/ref/gl/gl_alias.c index 3dc1a695..cfcdc810 100644 --- a/ref/gl/gl_alias.c +++ b/ref/gl/gl_alias.c @@ -578,7 +578,7 @@ static void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight ) if( !plight || !ent ) return; - if( !RI.drawWorld || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT )) { plight->shadelight = 0; plight->ambientlight = 192; @@ -1126,7 +1126,7 @@ init current time for a given model */ static void R_AliasSetupTimings( void ) { - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) { // synchronize with server time g_alias.time = gp_cl->time; diff --git a/ref/gl/gl_backend.c b/ref/gl/gl_backend.c index 33e34672..4e1d5b8e 100644 --- a/ref/gl/gl_backend.c +++ b/ref/gl/gl_backend.c @@ -61,7 +61,7 @@ void GL_BackendEndFrame( void ) { mleaf_t *curleaf; - if( r_speeds->value <= 0 || !RI.drawWorld ) + if( r_speeds->value <= 0 || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) return; if( !RI.viewleaf ) @@ -616,7 +616,7 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo string basename; int i = 1, flags, result; - if( !RI.drawWorld || !WORLDMODEL ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || !WORLDMODEL ) return false; // make sure the specified size is valid diff --git a/ref/gl/gl_local.h b/ref/gl/gl_local.h index 4c638a72..8de205ba 100644 --- a/ref/gl/gl_local.h +++ b/ref/gl/gl_local.h @@ -128,7 +128,6 @@ typedef struct int params; // rendering parameters - qboolean drawWorld; // ignore world for drawing PlayerModel qboolean onlyClientDraw; // disabled by client request qboolean drawOrtho; // draw world as orthogonal projection diff --git a/ref/gl/gl_rmain.c b/ref/gl/gl_rmain.c index 2c290717..cfadc26f 100644 --- a/ref/gl/gl_rmain.c +++ b/ref/gl/gl_rmain.c @@ -340,7 +340,7 @@ R_GetFarClip */ static float R_GetFarClip( void ) { - if( WORLDMODEL && RI.drawWorld ) + if( WORLDMODEL && FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) return tr.movevars->zmax * 1.73f; return 2048.0f; } @@ -534,7 +534,7 @@ static void R_SetupFrame( void ) } // current viewleaf - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) R_FindViewLeaf(); } @@ -701,7 +701,7 @@ static void R_CheckFog( void ) RI.fogEnabled = false; - if( RI.onlyClientDraw || ENGINE_GET_PARM( PARM_WATER_LEVEL ) < 3 || !RI.drawWorld || !RI.viewleaf ) + if( RI.onlyClientDraw || ENGINE_GET_PARM( PARM_WATER_LEVEL ) < 3 || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || !RI.viewleaf ) { if( RI.cached_waterlevel == 3 ) { @@ -880,7 +880,7 @@ static void R_DrawEntitiesOnList( void ) GL_CheckForErrors(); - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) gEngfuncs.pfnDrawNormalTriangles(); GL_CheckForErrors(); @@ -922,7 +922,7 @@ static void R_DrawEntitiesOnList( void ) GL_CheckForErrors(); - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) { pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); gEngfuncs.pfnDrawTransparentTriangles (); @@ -957,7 +957,7 @@ R_SetupRefParams must be called right before */ void R_RenderScene( void ) { - if( !WORLDMODEL && RI.drawWorld ) + if( !WORLDMODEL && FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) gEngfuncs.Host_Error( "%s: NULL worldmodel\n", __func__ ); // frametime is valid only for normal pass @@ -977,7 +977,7 @@ void R_RenderScene( void ) R_MarkLeaves(); R_DrawFog (); - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) R_AnimateRipples(); R_CheckGLFog(); @@ -1080,7 +1080,6 @@ void R_SetupRefParams( const ref_viewpass_t *rvp ) RI.rvp = *rvp; RI.params = RP_NONE; - RI.drawWorld = FBitSet( rvp->flags, RF_DRAW_WORLD ); RI.onlyClientDraw = FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW ); RI.farClip = 0; @@ -1108,7 +1107,7 @@ void R_RenderFrame( const ref_viewpass_t *rvp ) // setup the initial render params R_SetupRefParams( rvp ); - if( gl_finish.value && RI.drawWorld ) + if( gl_finish.value && FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) pglFinish(); // completely override rendering diff --git a/ref/gl/gl_rsurf.c b/ref/gl/gl_rsurf.c index b1580fa5..e1ee672d 100644 --- a/ref/gl/gl_rsurf.c +++ b/ref/gl/gl_rsurf.c @@ -1610,7 +1610,7 @@ void R_DrawWaterSurfaces( void ) msurface_t *s; texture_t *t; - if( !RI.drawWorld || RI.onlyClientDraw ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || RI.onlyClientDraw ) return; // non-transparent water is already drawed @@ -1792,7 +1792,8 @@ void R_DrawBrushModel( cl_entity_t *e ) qboolean rotated; qboolean allow_vbo = R_HasEnabledVBO(); - if( !RI.drawWorld ) return; + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) + return; model_t *clmodel = e->model; @@ -3683,7 +3684,7 @@ void R_DrawWorld( void ) return; RI.currentmodel = RI.currententity->model; - if( !RI.drawWorld || RI.onlyClientDraw ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || RI.onlyClientDraw ) return; VectorCopy( RI.cullorigin, tr.modelorg ); @@ -3748,7 +3749,8 @@ void R_MarkLeaves( void ) vec3_t test; int i; - if( !RI.drawWorld ) return; + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) + return; if( FBitSet( r_novis.flags, FCVAR_CHANGED ) || tr.fResetVis ) { diff --git a/ref/gl/gl_studio.c b/ref/gl/gl_studio.c index 7909026b..92915173 100644 --- a/ref/gl/gl_studio.c +++ b/ref/gl/gl_studio.c @@ -167,7 +167,7 @@ init current time for a given model */ static void R_StudioSetupTimings( void ) { - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) { // synchronize with server time g_studio.time = gp_cl->time; @@ -369,7 +369,7 @@ pfnPlayerInfo */ player_info_t *pfnPlayerInfo( int index ) { - if( !RI.drawWorld ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) index = -1; return gEngfuncs.pfnPlayerInfo( index ); @@ -394,7 +394,7 @@ pfnGetPlayerState */ static entity_state_t *R_StudioGetPlayerState( int index ) { - if( !RI.drawWorld ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) return &RI.currententity->curstate; return gEngfuncs.pfnGetPlayerState( index ); @@ -1328,7 +1328,7 @@ static void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight ) if( !plight || !ent || !ent->model ) return; - if( !RI.drawWorld || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT )) { plight->shadelight = 0; plight->ambientlight = 192; @@ -2662,7 +2662,7 @@ static model_t *R_StudioSetupPlayerModel( int index ) state = &g_studio.player_models[index]; // g-cont: force for "dev-mode", non-local games and menu preview - if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !RI.drawWorld ) && info->model[0] ) + if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) ) && info->model[0] ) { if( Q_strcmp( state->name, info->model )) { @@ -3398,7 +3398,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer ) if( flags & STUDIO_RENDER ) { // change body if it's a menu entity - if( cl_himodels->value && ( RI.currentmodel != RI.currententity->model || !RI.drawWorld )) + if( cl_himodels->value && ( RI.currentmodel != RI.currententity->model || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))) { // show highest resolution multiplayer model RI.currententity->curstate.body = 255; @@ -3554,7 +3554,7 @@ R_StudioDrawModelInternal */ static void R_StudioDrawModelInternal( cl_entity_t *e, int flags ) { - if( !RI.drawWorld ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) { if( e->player ) R_StudioDrawPlayer( flags, &e->curstate );