================= idRenderModelManagerLocal::ReloadModels ================= */
| 439 | ================= |
| 440 | */ |
| 441 | void 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, ¤t ); |
| 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 | ================= |
no test coverage detected