Skip to content

Commit eb8dd11

Browse files
committed
ref: make R_GatherPlayerLight shared between renderers
1 parent a431609 commit eb8dd11

8 files changed

Lines changed: 12 additions & 34 deletions

File tree

ref/common/ref_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ void R_PushDlightsForBmodel( model_t *model, int framecount, const matrix4x4 obj
8181
int R_PushDlights( model_t *model, int framecount );
8282
colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot, vec3_t lvec );
8383
colorVec R_LightPoint( const vec3_t p0 );
84+
void R_GatherPlayerLight( cl_entity_t *view );
8485
void R_UpdateSurfaceCachedLight( msurface_t *surf );
8586

8687
//

ref/common/ref_light.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,13 @@ colorVec R_LightPoint( const vec3_t p0 )
475475
return R_LightVec( p0, p1, NULL, NULL );
476476
}
477477

478+
void R_GatherPlayerLight( cl_entity_t *view )
479+
{
480+
colorVec c = R_LightPoint( view->origin );
481+
482+
gEngfuncs.SetLocalLightLevel(( c.r + c.g + c.b ) / 3 );
483+
}
484+
478485
/*
479486
================
480487
R_SetCacheState

ref/gl/gl_local.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ struct mstudiotex_s *R_StudioGetTexture( cl_entity_t *e );
409409
int R_GetEntityRenderMode( cl_entity_t *ent );
410410
void R_DrawStudioModel( cl_entity_t *e );
411411
player_info_t *pfnPlayerInfo( int index );
412-
void R_GatherPlayerLight( void );
413412
float R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc, double time );
414413
void R_StudioLerpMovement( cl_entity_t *e, double time, vec3_t origin, vec3_t angles );
415414
void R_StudioResetPlayerModels( void );

ref/gl/gl_rmain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ void R_RenderFrame( const ref_viewpass_t *rvp )
11051105

11061106
if( gEngfuncs.drawFuncs->GL_RenderFrame( rvp ))
11071107
{
1108-
R_GatherPlayerLight();
1108+
R_GatherPlayerLight( tr.viewent );
11091109
tr.realframecount++;
11101110
tr.fResetVis = true;
11111111
return;

ref/gl/gl_studio.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,20 +3594,6 @@ void R_RunViewmodelEvents( void )
35943594
R_StudioDrawModelInternal( RI.currententity, STUDIO_EVENTS );
35953595
}
35963596

3597-
/*
3598-
=================
3599-
R_GatherPlayerLight
3600-
=================
3601-
*/
3602-
void R_GatherPlayerLight( void )
3603-
{
3604-
cl_entity_t *view = tr.viewent;
3605-
colorVec c;
3606-
3607-
c = R_LightPoint( view->origin );
3608-
gEngfuncs.SetLocalLightLevel( ( c.r + c.g + c.b ) / 3 );
3609-
}
3610-
36113597
/*
36123598
=================
36133599
R_DrawViewModel
@@ -3617,7 +3603,7 @@ void R_DrawViewModel( void )
36173603
{
36183604
cl_entity_t *view = tr.viewent;
36193605

3620-
R_GatherPlayerLight();
3606+
R_GatherPlayerLight( view );
36213607

36223608
if( r_drawviewmodel->value == 0 )
36233609
return;

ref/soft/r_local.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ struct mstudiotex_s *R_StudioGetTexture( cl_entity_t *e );
399399
int R_GetEntityRenderMode( cl_entity_t *ent );
400400
void R_DrawStudioModel( cl_entity_t *e );
401401
player_info_t *pfnPlayerInfo( int index );
402-
void R_GatherPlayerLight( void );
403402
float R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc, double time );
404403
void R_StudioLerpMovement( cl_entity_t *e, double time, vec3_t origin, vec3_t angles );
405404
void R_StudioResetPlayerModels( void );

ref/soft/r_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ void GAME_EXPORT R_RenderFrame( const ref_viewpass_t *rvp )
11721172

11731173
if( gEngfuncs.drawFuncs->GL_RenderFrame( rvp ))
11741174
{
1175-
// R_GatherPlayerLight();
1175+
// R_GatherPlayerLight( tr.viewent );
11761176
tr.realframecount++;
11771177
tr.fResetVis = true;
11781178
return;

ref/soft/r_studio.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3125,20 +3125,6 @@ void R_RunViewmodelEvents( void )
31253125
R_StudioDrawModelInternal( RI.currententity, STUDIO_EVENTS );
31263126
}
31273127

3128-
/*
3129-
=================
3130-
R_GatherPlayerLight
3131-
=================
3132-
*/
3133-
void R_GatherPlayerLight( void )
3134-
{
3135-
cl_entity_t *view = tr.viewent;
3136-
colorVec c;
3137-
3138-
c = R_LightPoint( view->origin );
3139-
gEngfuncs.SetLocalLightLevel(( c.r + c.g + c.b ) / 3 );
3140-
}
3141-
31423128
/*
31433129
=================
31443130
R_DrawViewModel
@@ -3148,7 +3134,7 @@ void R_DrawViewModel( void )
31483134
{
31493135
cl_entity_t *view = tr.viewent;
31503136

3151-
R_GatherPlayerLight();
3137+
R_GatherPlayerLight( view );
31523138

31533139
if( r_drawviewmodel->value == 0 )
31543140
return;

0 commit comments

Comments
 (0)