diff --git a/ref/gl/gl_cull.c b/ref/gl/gl_cull.c index 9316207e..2848593b 100644 --- a/ref/gl/gl_cull.c +++ b/ref/gl/gl_cull.c @@ -47,7 +47,7 @@ qboolean R_CullModel( const cl_entity_t *e, const vec3_t absmin, const vec3_t ab if( ENGINE_GET_PARM( PARM_DEV_OVERVIEW )) return true; - if( RP_NORMALPASS() && !ENGINE_GET_PARM( PARM_THIRDPERSON ) && CL_IsViewEntityLocalPlayer()) + if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ) && !ENGINE_GET_PARM( PARM_THIRDPERSON ) && CL_IsViewEntityLocalPlayer()) return false; return true; @@ -85,7 +85,7 @@ int R_CullSurface( const msurface_t *surf, const gl_frustum_t *frustum, uint cli float dist; // can use normal.z for world (optimisation) - if( RI.drawOrtho ) + if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW )) { vec3_t orthonormal; diff --git a/ref/gl/gl_local.h b/ref/gl/gl_local.h index 8de205ba..76918f85 100644 --- a/ref/gl/gl_local.h +++ b/ref/gl/gl_local.h @@ -70,14 +70,9 @@ void VGL_ShimEndFrame( void ); #define SHADE_LAMBERT 1.4953241 #define DEFAULT_ALPHATEST 0.0f -// refparams -#define RP_NONE 0 -#define RP_ENVVIEW BIT( 0 ) // used for cubemapshot - #define R_ModelOpaque( rm ) ( rm == kRenderNormal ) #define R_StaticEntity( ent ) ( VectorIsNull( ent->origin ) && VectorIsNull( ent->angles )) #define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == ( gp_cl->playernum + 1 ) && e->player ) -#define RP_NORMALPASS() ( FBitSet( RI.params, RP_ENVVIEW ) == 0 ) #define CL_IsViewEntityLocalPlayer() ( gp_cl->viewentity == ( gp_cl->playernum + 1 )) @@ -126,11 +121,6 @@ typedef struct { ref_viewpass_t rvp; - int params; // rendering parameters - - qboolean onlyClientDraw; // disabled by client request - qboolean drawOrtho; // draw world as orthogonal projection - cl_entity_t *currententity; model_t *currentmodel; cl_entity_t *currentbeam; // same as above but for beams diff --git a/ref/gl/gl_rmain.c b/ref/gl/gl_rmain.c index cfadc26f..cac9f83f 100644 --- a/ref/gl/gl_rmain.c +++ b/ref/gl/gl_rmain.c @@ -317,7 +317,7 @@ static void R_Clear( int bitMask ) pglClear( bits ); // change ordering for overview - if( RI.drawOrtho ) + if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW )) { gldepthmin = 1.0f; gldepthmax = 0.0f; @@ -363,7 +363,7 @@ void R_SetupFrustum( void ) VectorCopy( RI.vup, RI.cull_vup ); } - if( RI.drawOrtho ) + if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW )) { const ref_overview_t *ov = gEngfuncs.GetOverviewParms(); GL_FrustumInitOrtho( &RI.frustum, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar ); @@ -383,7 +383,7 @@ static void R_SetupProjectionMatrix( matrix4x4 m ) { GLfloat xMin, xMax, yMin, yMax, zNear, zFar; - if( RI.drawOrtho ) + if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW )) { const ref_overview_t *ov = gEngfuncs.GetOverviewParms(); Matrix4x4_CreateOrtho( m, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar ); @@ -552,7 +552,7 @@ void R_SetupGL( qboolean set_gl_state ) if( !set_gl_state ) return; - if( RP_NORMALPASS( )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP )) { int x, x2, y, y2; @@ -701,7 +701,7 @@ static void R_CheckFog( void ) RI.fogEnabled = false; - if( RI.onlyClientDraw || ENGINE_GET_PARM( PARM_WATER_LEVEL ) < 3 || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || !RI.viewleaf ) + if( FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ) || ENGINE_GET_PARM( PARM_WATER_LEVEL ) < 3 || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || !RI.viewleaf ) { if( RI.cached_waterlevel == 3 ) { @@ -823,7 +823,7 @@ static void R_DrawEntitiesOnList( void ) GL_CheckForErrors(); // first draw solid entities - for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ ) + for( i = 0; i < tr.draw_list->num_solid_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ ) { RI.currententity = tr.draw_list->solid_entities[i]; RI.currentmodel = RI.currententity->model; @@ -855,7 +855,7 @@ static void R_DrawEntitiesOnList( void ) GL_CheckForErrors(); // draw sprites seperately, because of alpha blending - for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ ) + for( i = 0; i < tr.draw_list->num_solid_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ ) { RI.currententity = tr.draw_list->solid_entities[i]; RI.currentmodel = RI.currententity->model; @@ -873,7 +873,7 @@ static void R_DrawEntitiesOnList( void ) GL_CheckForErrors(); - if( !RI.onlyClientDraw ) + if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW )) { gEngfuncs.CL_DrawEFX( tr.frametime, false ); } @@ -886,7 +886,7 @@ static void R_DrawEntitiesOnList( void ) GL_CheckForErrors(); // then draw translucent entities - for( i = 0; i < tr.draw_list->num_trans_entities && !RI.onlyClientDraw; i++ ) + for( i = 0; i < tr.draw_list->num_trans_entities && !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW ); i++ ) { RI.currententity = tr.draw_list->trans_entities[i]; RI.currentmodel = RI.currententity->model; @@ -930,7 +930,7 @@ static void R_DrawEntitiesOnList( void ) GL_CheckForErrors(); - if( !RI.onlyClientDraw ) + if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW )) { R_AllowFog( false ); gEngfuncs.CL_DrawEFX( tr.frametime, true ); @@ -941,7 +941,7 @@ static void R_DrawEntitiesOnList( void ) pglDisable( GL_BLEND ); // Trinity Render issues - if( !RI.onlyClientDraw ) + if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW )) R_DrawViewModel(); gEngfuncs.CL_ExtraUpdate(); @@ -961,7 +961,7 @@ void R_RenderScene( void ) gEngfuncs.Host_Error( "%s: NULL worldmodel\n", __func__ ); // frametime is valid only for normal pass - if( RP_NORMALPASS( )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP )) tr.frametime = gp_cl->time - gp_cl->oldtime; else tr.frametime = 0.0; @@ -1079,19 +1079,7 @@ void R_SetupRefParams( const ref_viewpass_t *rvp ) { RI.rvp = *rvp; - RI.params = RP_NONE; - RI.onlyClientDraw = FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW ); RI.farClip = 0; - - if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP )) - { - RI.drawOrtho = FBitSet( rvp->flags, RF_DRAW_OVERVIEW ); - } - else - { - SetBits( RI.params, RP_ENVVIEW ); - RI.drawOrtho = false; - } } /* @@ -1125,7 +1113,7 @@ void R_RenderFrame( const ref_viewpass_t *rvp ) } tr.fCustomRendering = false; - if( !RI.onlyClientDraw ) + if( !FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW )) R_RunViewmodelEvents(); tr.realframecount++; // right called after viewmodel events @@ -1207,7 +1195,7 @@ int CL_FxBlend( cl_entity_t *e ) blend = e->curstate.renderamt + 0x10 * sin( gp_cl->time * 8 + offset ); break; case kRenderFxFadeSlow: - if( RP_NORMALPASS( )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP )) { if( e->curstate.renderamt > 0 ) e->curstate.renderamt -= 1; @@ -1216,7 +1204,7 @@ int CL_FxBlend( cl_entity_t *e ) blend = e->curstate.renderamt; break; case kRenderFxFadeFast: - if( RP_NORMALPASS( )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP )) { if( e->curstate.renderamt > 3 ) e->curstate.renderamt -= 4; @@ -1225,7 +1213,7 @@ int CL_FxBlend( cl_entity_t *e ) blend = e->curstate.renderamt; break; case kRenderFxSolidSlow: - if( RP_NORMALPASS( )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP )) { if( e->curstate.renderamt < 255 ) e->curstate.renderamt += 1; @@ -1234,7 +1222,7 @@ int CL_FxBlend( cl_entity_t *e ) blend = e->curstate.renderamt; break; case kRenderFxSolidFast: - if( RP_NORMALPASS( )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP )) { if( e->curstate.renderamt < 252 ) e->curstate.renderamt += 4; diff --git a/ref/gl/gl_rsurf.c b/ref/gl/gl_rsurf.c index e1ee672d..cbe4d82d 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( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || RI.onlyClientDraw ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW )) return; // non-transparent water is already drawed @@ -3684,7 +3684,7 @@ void R_DrawWorld( void ) return; RI.currentmodel = RI.currententity->model; - if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || RI.onlyClientDraw ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || FBitSet( RI.rvp.flags, RF_ONLY_CLIENTDRAW )) return; VectorCopy( RI.cullorigin, tr.modelorg ); @@ -3700,7 +3700,7 @@ void R_DrawWorld( void ) R_ClearSkyBox (); start = gEngfuncs.pfnTime(); - if( RI.drawOrtho ) + if( FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW )) R_DrawWorldTopView( WORLDMODEL->nodes, RI.frustum.clipFlags ); else R_RecursiveWorldNode( WORLDMODEL->nodes, RI.frustum.clipFlags ); end = gEngfuncs.pfnTime(); @@ -3786,7 +3786,7 @@ void R_MarkLeaves( void ) RI.oldviewleaf = RI.viewleaf; tr.visframecount++; - if( r_novis.value || RI.drawOrtho || !RI.viewleaf || !WORLDMODEL->visdata ) + if( r_novis.value || FBitSet( RI.rvp.flags, RF_DRAW_OVERVIEW ) || !RI.viewleaf || !WORLDMODEL->visdata ) novis = true; gEngfuncs.R_FatPVS( RI.rvp.vieworigin, r_pvs_radius->value, RI.visbytes, false, novis ); diff --git a/ref/gl/gl_sprite.c b/ref/gl/gl_sprite.c index a0a5b7ad..850c0319 100644 --- a/ref/gl/gl_sprite.c +++ b/ref/gl/gl_sprite.c @@ -236,7 +236,7 @@ static float R_SpriteGlowBlend( vec3_t origin, int rendermode, int renderfx, flo VectorSubtract( origin, RI.rvp.vieworigin, glowDist ); dist = VectorLength( glowDist ); - if( RP_NORMALPASS( )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP )) { tr = gEngfuncs.EV_VisTraceLine( RI.rvp.vieworigin, origin, r_traceglow.value ? PM_GLASS_IGNORE : (PM_GLASS_IGNORE|PM_STUDIO_IGNORE)); @@ -386,7 +386,7 @@ void R_DrawSpriteModel( cl_entity_t *e ) vec3_t v_forward, v_right, v_up; vec3_t origin, color, color2 = { 0.0f }; - if( FBitSet( RI.params, RP_ENVVIEW )) + if( FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP )) return; model = e->model; diff --git a/ref/gl/gl_studio.c b/ref/gl/gl_studio.c index 92915173..c667dedb 100644 --- a/ref/gl/gl_studio.c +++ b/ref/gl/gl_studio.c @@ -3589,7 +3589,7 @@ R_DrawStudioModel */ void R_DrawStudioModel( cl_entity_t *e ) { - if( FBitSet( RI.params, RP_ENVVIEW )) + if( FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP )) return; R_StudioSetupTimings(); @@ -3644,7 +3644,7 @@ void R_RunViewmodelEvents( void ) return; // ignore in thirdperson, camera view or client is died - if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer()) + if( FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ) || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer()) return; RI.currententity = tr.viewent; @@ -3694,7 +3694,7 @@ void R_DrawViewModel( void ) return; // ignore in thirdperson, camera view or client is died - if( !RP_NORMALPASS() || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer()) + if( FBitSet( RI.rvp.flags, RF_DRAW_CUBEMAP ) || ENGINE_GET_PARM( PARM_LOCAL_HEALTH ) <= 0 || !CL_IsViewEntityLocalPlayer()) return; tr.blend = CL_FxBlend( view ) / 255.0f;