ref: gl: make GL_BuildPolygonFromSurface static, remove one global variable usage (which is unused anyway)

This commit is contained in:
Alibek Omarov 2025-02-07 21:21:14 +03:00
parent 2b2c967e85
commit a955d1e957
2 changed files with 6 additions and 8 deletions

View file

@ -436,7 +436,6 @@ void R_DrawWorld( void );
void R_DrawWaterSurfaces( void ); void R_DrawWaterSurfaces( void );
void R_DrawBrushModel( cl_entity_t *e ); void R_DrawBrushModel( cl_entity_t *e );
void GL_SubdivideSurface( model_t *mod, msurface_t *fa ); void GL_SubdivideSurface( model_t *mod, msurface_t *fa );
void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa );
void GL_SetupFogColorForSurfaces( void ); void GL_SetupFogColorForSurfaces( void );
void R_DrawAlphaTextureChains( void ); void R_DrawAlphaTextureChains( void );
void GL_RebuildLightmaps( void ); void GL_RebuildLightmaps( void );

View file

@ -26,7 +26,6 @@ typedef struct
byte lightmap_buffer[BLOCK_SIZE_MAX*BLOCK_SIZE_MAX*4]; byte lightmap_buffer[BLOCK_SIZE_MAX*BLOCK_SIZE_MAX*4];
} gllightmapstate_t; } gllightmapstate_t;
static int nColinElim; // stats
static vec2_t world_orthocenter; static vec2_t world_orthocenter;
static vec2_t world_orthohalf; static vec2_t world_orthohalf;
static uint r_blocklights[BLOCK_SIZE_MAX*BLOCK_SIZE_MAX*3]; static uint r_blocklights[BLOCK_SIZE_MAX*BLOCK_SIZE_MAX*3];
@ -335,16 +334,16 @@ void GL_SubdivideSurface( model_t *loadmodel, msurface_t *fa )
GL_BuildPolygonFromSurface GL_BuildPolygonFromSurface
================ ================
*/ */
void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa ) static int GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa )
{ {
int i, lnumverts; int i, lnumverts, nColinElim = 0;
float sample_size; float sample_size;
texture_t *tex; texture_t *tex;
gl_texture_t *glt; gl_texture_t *glt;
glpoly2_t *poly; glpoly2_t *poly;
if( !mod || !fa->texinfo || !fa->texinfo->texture ) if( !mod || !fa->texinfo || !fa->texinfo->texture )
return; // bad polygon ? return nColinElim; // bad polygon ?
if( FBitSet( fa->flags, SURF_CONVEYOR ) && fa->texinfo->texture->gl_texturenum != 0 ) if( FBitSet( fa->flags, SURF_CONVEYOR ) && fa->texinfo->texture->gl_texturenum != 0 )
{ {
@ -417,6 +416,7 @@ void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa )
} }
poly->numverts = lnumverts; poly->numverts = lnumverts;
return nColinElim;
} }
@ -3844,7 +3844,7 @@ with all the surfaces from all brush models
*/ */
void GL_BuildLightmaps( void ) void GL_BuildLightmaps( void )
{ {
int i, j; int i, j, nColinElim = 0;
model_t *m; model_t *m;
// release old lightmaps // release old lightmaps
@ -3868,7 +3868,6 @@ void GL_BuildLightmaps( void )
gl_lms.current_lightmap_texture = 0; gl_lms.current_lightmap_texture = 0;
tr.modelviewIdentity = false; tr.modelviewIdentity = false;
tr.realframecount = 1; tr.realframecount = 1;
nColinElim = 0;
// setup the texture for dlights // setup the texture for dlights
R_InitDlightTexture(); R_InitDlightTexture();
@ -3897,7 +3896,7 @@ void GL_BuildLightmaps( void )
if( m->surfaces[j].flags & SURF_DRAWTURB ) if( m->surfaces[j].flags & SURF_DRAWTURB )
continue; continue;
GL_BuildPolygonFromSurface( m, m->surfaces + j ); nColinElim += GL_BuildPolygonFromSurface( m, m->surfaces + j );
} }
// clearing visframe // clearing visframe