/* ==================== idImageManager::Preload ==================== */ void idImageManager::Preload( const idPreloadManifest& manifest, const bool& mapPreload ) { if( preLoad_Images.GetBool() && manifest.NumResources() > 0 ) { // preload this levels images common->Printf( "Preloading images...\n" ); preloadingMapImages = mapPreload; int start = Sys_Milliseconds(); int numLoaded = 0; //fileSystem->StartPreload( preloadImageFiles ); for( int i = 0; i < manifest.NumResources(); i++ ) { const preloadEntry_s& p = manifest.GetPreloadByIndex( i ); if( p.resType == PRELOAD_IMAGE && !ExcludePreloadImage( p.resourceName ) ) { globalImages->ImageFromFile( p.resourceName, ( textureFilter_t )p.imgData.filter, ( textureRepeat_t )p.imgData.repeat, ( textureUsage_t )p.imgData.usage, ( cubeFiles_t )p.imgData.cubeMap ); numLoaded++; } } //fileSystem->StopPreload(); int end = Sys_Milliseconds(); common->Printf( "%05d images preloaded ( or were already loaded ) in %5.1f seconds\n", numLoaded, ( end - start ) * 0.001 ); common->Printf( "----------------------------------------\n" ); preloadingMapImages = false; } }
/* ================ idAnimManager::Preload ================ */ void idAnimManager::Preload( const idPreloadManifest& manifest ) { if( manifest.NumResources() >= 0 ) { common->Printf( "Preloading anims...\n" ); int start = Sys_Milliseconds(); int numLoaded = 0; for( int i = 0; i < manifest.NumResources(); i++ ) { const preloadEntry_s& p = manifest.GetPreloadByIndex( i ); if( p.resType == PRELOAD_ANIM ) { GetAnim( p.resourceName ); numLoaded++; } } int end = Sys_Milliseconds(); common->Printf( "%05d anims preloaded ( or were already loaded ) in %5.1f seconds\n", numLoaded, ( end - start ) * 0.001 ); common->Printf( "----------------------------------------\n" ); } }
/* ================= idRenderModelManagerLocal::Preload ================= */ void idRenderModelManagerLocal::Preload( const idPreloadManifest& manifest ) { if( preload_MapModels.GetBool() ) { // preload this levels images int start = Sys_Milliseconds(); int numLoaded = 0; idList< preloadSort_t > preloadSort; preloadSort.Resize( manifest.NumResources() ); for( int i = 0; i < manifest.NumResources(); i++ ) { const preloadEntry_s& p = manifest.GetPreloadByIndex( i ); idResourceCacheEntry rc; idStrStatic< MAX_OSPATH > filename; if( p.resType == PRELOAD_MODEL ) { filename = "generated/rendermodels/"; filename += p.resourceName; idStrStatic< 16 > ext; filename.ExtractFileExtension( ext ); filename.SetFileExtension( va( "b%s", ext.c_str() ) ); } if( p.resType == PRELOAD_PARTICLE ) { filename = "generated/particles/"; filename += p.resourceName; filename += ".bprt"; } if( !filename.IsEmpty() ) { if( fileSystem->GetResourceCacheEntry( filename, rc ) ) { preloadSort_t ps = {}; ps.idx = i; ps.ofs = rc.offset; preloadSort.Append( ps ); } } } preloadSort.SortWithTemplate( idSort_Preload() ); for( int i = 0; i < preloadSort.Num(); i++ ) { const preloadSort_t& ps = preloadSort[ i ]; const preloadEntry_s& p = manifest.GetPreloadByIndex( ps.idx ); if( p.resType == PRELOAD_MODEL ) { idRenderModel* model = FindModel( p.resourceName ); if( model != NULL ) { model->SetLevelLoadReferenced( true ); } } else if( p.resType == PRELOAD_PARTICLE ) { declManager->FindType( DECL_PARTICLE, p.resourceName ); } numLoaded++; } int end = Sys_Milliseconds(); common->Printf( "%05d models preloaded ( or were already loaded ) in %5.1f seconds\n", numLoaded, ( end - start ) * 0.001 ); common->Printf( "----------------------------------------\n" ); } }