MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / EndLevelLoad

Method EndLevelLoad

neo/renderer/ModelManager.cpp:519–576  ·  view source on GitHub ↗

================= idRenderModelManagerLocal::EndLevelLoad ================= */

Source from the content-addressed store, hash-verified

517=================
518*/
519void idRenderModelManagerLocal::EndLevelLoad() {
520 common->Printf( "----- idRenderModelManagerLocal::EndLevelLoad -----\n" );
521
522 int start = Sys_Milliseconds();
523
524 insideLevelLoad = false;
525 int purgeCount = 0;
526 int keepCount = 0;
527 int loadCount = 0;
528
529 // purge any models not touched
530 for ( int i = 0 ; i < models.Num() ; i++ ) {
531 idRenderModel *model = models[i];
532
533 if ( !model->IsLevelLoadReferenced() && model->IsLoaded() && model->IsReloadable() ) {
534
535// common->Printf( "purging %s\n", model->Name() );
536
537 purgeCount++;
538
539 R_CheckForEntityDefsUsingModel( model );
540
541 model->PurgeModel();
542
543 } else {
544
545// common->Printf( "keeping %s\n", model->Name() );
546
547 keepCount++;
548 }
549 }
550
551 // purge unused triangle surface memory
552 R_PurgeTriSurfData( frameData );
553
554 // load any new ones
555 for ( int i = 0 ; i < models.Num() ; i++ ) {
556 idRenderModel *model = models[i];
557
558 if ( model->IsLevelLoadReferenced() && !model->IsLoaded() && model->IsReloadable() ) {
559
560 loadCount++;
561 model->LoadModel();
562
563 if ( ( loadCount & 15 ) == 0 ) {
564 session->PacifierUpdate();
565 }
566 }
567 }
568
569 // _D3XP added this
570 int end = Sys_Milliseconds();
571 common->Printf( "%5i models purged from previous level, ", purgeCount );
572 common->Printf( "%5i models kept.\n", keepCount );
573 if ( loadCount ) {
574 common->Printf( "%5i new models loaded in %5.1f seconds\n", loadCount, (end-start) * 0.001 );
575 }
576}

Callers

nothing calls this directly

Calls 11

Sys_MillisecondsFunction · 0.85
R_PurgeTriSurfDataFunction · 0.85
IsLevelLoadReferencedMethod · 0.80
IsReloadableMethod · 0.80
PrintfMethod · 0.45
NumMethod · 0.45
IsLoadedMethod · 0.45
PurgeModelMethod · 0.45
LoadModelMethod · 0.45
PacifierUpdateMethod · 0.45

Tested by

no test coverage detected