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

Method ReloadModels

neo/renderer/ModelManager.cpp:441–477  ·  view source on GitHub ↗

================= idRenderModelManagerLocal::ReloadModels ================= */

Source from the content-addressed store, hash-verified

439=================
440*/
441void idRenderModelManagerLocal::ReloadModels( bool forceAll ) {
442 if ( forceAll ) {
443 common->Printf( "Reloading all model files...\n" );
444 } else {
445 common->Printf( "Checking for changed model files...\n" );
446 }
447
448 R_FreeDerivedData();
449
450 // skip the default model at index 0
451 for ( int i = 1 ; i < models.Num() ; i++ ) {
452 idRenderModel *model = models[i];
453
454 // we may want to allow world model reloading in the future, but we don't now
455 if ( !model->IsReloadable() ) {
456 continue;
457 }
458
459 if ( !forceAll ) {
460 // check timestamp
461 ID_TIME_T current;
462
463 fileSystem->ReadFile( model->Name(), NULL, &current );
464 if ( current <= model->Timestamp() ) {
465 continue;
466 }
467 }
468
469 common->DPrintf( "reloading %s.\n", model->Name() );
470
471 model->LoadModel();
472 }
473
474 // we must force the world to regenerate, because models may
475 // have changed size, making their references invalid
476 R_ReCreateWorldReferences();
477}
478
479/*
480=================

Callers 1

ReloadModels_fMethod · 0.80

Calls 10

R_FreeDerivedDataFunction · 0.85
IsReloadableMethod · 0.80
ReadFileMethod · 0.80
PrintfMethod · 0.45
NumMethod · 0.45
NameMethod · 0.45
TimestampMethod · 0.45
DPrintfMethod · 0.45
LoadModelMethod · 0.45

Tested by

no test coverage detected