ref: soft: read ref_viewpass_t flags instead of cached RI.drawWorld

This commit is contained in:
Alibek Omarov
2026-04-13 13:47:17 +05:00
committed by a1batross
parent 3440ddf443
commit afca422e35
5 changed files with 17 additions and 23 deletions

View File

@@ -643,7 +643,7 @@ R_RenderWorld
*/
void R_RenderWorld( void )
{
if( !RI.drawWorld )
if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return;
// auto cycle the world frame for texture animation

View File

@@ -124,7 +124,6 @@ typedef struct
{
const ref_viewpass_t rvp;
qboolean drawWorld; // ignore world for drawing PlayerModel
qboolean onlyClientDraw; // disabled by client request
qboolean drawOrtho; // draw world as orthogonal projection

View File

@@ -379,7 +379,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;
}
@@ -501,7 +501,7 @@ static void R_SetupFrame( void )
}
// current viewleaf
if( RI.drawWorld )
if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
R_FindViewLeaf();
// setup twice until globals fully refactored
@@ -573,7 +573,7 @@ static void R_DrawEntitiesOnList( void )
gEngfuncs.CL_DrawEFX( tr.frametime, false );
}
if( RI.drawWorld )
if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
gEngfuncs.pfnDrawNormalTriangles();
d_pdrawspans = R_PolysetDrawSpans8_33;
@@ -616,10 +616,8 @@ static void R_DrawEntitiesOnList( void )
}
}
if( RI.drawWorld )
{
if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
gEngfuncs.pfnDrawTransparentTriangles();
}
if( !RI.onlyClientDraw )
{
@@ -887,7 +885,7 @@ void R_DrawBrushModel( cl_entity_t *pent )
surf_t lsurfs[NUMSTACKSURFACES
+ (( CACHE_SIZE - 1 ) / sizeof( surf_t )) + 1];
if( !RI.drawWorld )
if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return;
if( auxedges )
@@ -995,7 +993,7 @@ static void R_EdgeDrawing( void )
surf_t lsurfs[NUMSTACKSURFACES
+ (( CACHE_SIZE - 1 ) / sizeof( surf_t )) + 1];
if( !RI.drawWorld )
if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
return;
if( auxedges )
@@ -1079,7 +1077,7 @@ R_SetupRefParams must be called right before
*/
void GAME_EXPORT 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
@@ -1156,7 +1154,6 @@ void R_SetupRefParams( const ref_viewpass_t *rvp )
{
RI.rvp = *rvp;
RI.drawWorld = FBitSet( rvp->flags, RF_DRAW_WORLD );
RI.onlyClientDraw = FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW );
if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP ))

View File

@@ -87,10 +87,8 @@ void D_ViewChanged( void )
/*
** clear Z-buffer and color-buffers if we're doing the gallery
*/
if( !RI.drawWorld )
{
if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
memset( d_pzbuffer, 0xff, vid.width * vid.height * sizeof( d_pzbuffer[0] ));
}
D_Patch();
}
@@ -293,7 +291,7 @@ void R_SetupFrameQ( void )
// AngleVectors (RI.rvp.viewangles, RI.vforward, RI.vright, RI.vup);
// current viewleaf
if( RI.drawWorld )
if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))
{
RI.viewleaf = gEngfuncs.Mod_PointInLeaf( RI.rvp.vieworigin, WORLDMODEL->nodes );
r_viewcluster = RI.viewleaf->cluster;

View File

@@ -147,7 +147,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;
@@ -353,7 +353,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 );
@@ -378,7 +378,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 );
@@ -1352,7 +1352,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;
@@ -2333,7 +2333,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 ))
{
@@ -2926,7 +2926,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;
@@ -3087,7 +3087,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 );