engine: client: only allocate debug hulls polygons when they're requested

* Make the appropriate changes in ref_gl
This commit is contained in:
Alibek Omarov 2024-05-28 23:39:55 +03:00
parent 3ca15250e8
commit 1545a49b4c
5 changed files with 10 additions and 12 deletions

View file

@ -685,6 +685,9 @@ void Mod_CreatePolygonsForHull( int hullnum )
if( hullnum < 1 || hullnum > 3 )
return;
if( !world.num_hull_models )
Mod_InitDebugHulls( mod ); // FIXME: build hulls for separate bmodels (shells, medkits etc)
Con_Printf( "generating polygons for hull %u...\n", hullnum );
start = Sys_DoubleTime();

View file

@ -3019,7 +3019,6 @@ static qboolean Mod_LoadBmodelLumps( model_t *mod, const byte *mod_base, qboolea
{
world.version = bmod->version;
#if !XASH_DEDICATED
Mod_InitDebugHulls( mod ); // FIXME: build hulls for separate bmodels (shells, medkits etc)
world.deluxedata = bmod->deluxedata_out; // deluxemap data pointer
world.shadowdata = bmod->shadowdata_out; // occlusion data pointer
#endif // XASH_DEDICATED

View file

@ -114,6 +114,9 @@ void Mod_FreeModel( model_t *mod )
world.version = 0;
world.shadowdata = NULL;
world.deluxedata = NULL;
// data already freed by Mem_FreePool above
world.hull_models = NULL;
}
memset( mod, 0, sizeof( *mod ));

View file

@ -28,7 +28,7 @@ GNU General Public License for more details.
// REFTODO: rewrite in triapi
void R_DrawWorldHull( void )
{
hull_model_t *hull = &tr.world->hull_models[0];
hull_model_t *hull;
winding_t *poly;
int i;
@ -42,6 +42,8 @@ void R_DrawWorldHull( void )
if( !r_showhull->value )
return;
hull = &tr.world->hull_models[0];
pglDisable( GL_TEXTURE_2D );
list_for_each_entry( poly, &hull->polys, chain )

View file

@ -410,19 +410,10 @@ void R_EntityRemoveDecals( model_t *mod );
void R_ClearDecals( void );
void R_DecalComputeBasis( msurface_t *surf, int flags, vec3_t textureSpaceBasis[3] );
#if 0
//
// gl_drawhulls.c
//
void R_DrawWorldHull( void );
void R_DrawModelHull( void );
#endif
void GL_Bind( int tmu, unsigned int texnum );
//
// gl_draw.cM_PI
// gl_draw.c
//
void R_Set2DMode( qboolean enable );
void R_DrawTileClear( int texnum, int x, int y, int w, int h );