| 10 | IGame_ObjectPool::~IGame_ObjectPool(void) { R_ASSERT(m_PrefetchObjects.empty()); } |
| 11 | |
| 12 | void IGame_ObjectPool::prefetch() |
| 13 | { |
| 14 | // в огср замороченный префетч объектов (не моделей), требует много переделок в xrGame, потому пусть работает только в тч-режиме. |
| 15 | if (CApplication::CheckCsCopMode()) |
| 16 | return; |
| 17 | |
| 18 | R_ASSERT(m_PrefetchObjects.empty()); |
| 19 | |
| 20 | int p_count = 0; |
| 21 | ::Render->model_Logging(FALSE); |
| 22 | |
| 23 | string256 section; |
| 24 | // prefetch objects |
| 25 | strconcat(sizeof(section), section, "prefetch_objects_", g_pGamePersistent->m_game_params.m_game_type); |
| 26 | if (pSettings->section_exist(section)) |
| 27 | { |
| 28 | const auto& sect = pSettings->r_section(section); |
| 29 | CTimer T; |
| 30 | T.Start(); |
| 31 | Render->models_begin_prefetch1(true); |
| 32 | for (const auto& item : sect.Ordered_Data) |
| 33 | { |
| 34 | if (pSettings->section_exist(item.first.c_str())) |
| 35 | { |
| 36 | CLASS_ID CLS = pSettings->r_clsid(item.first.c_str(), "class"); |
| 37 | p_count++; |
| 38 | CObject* pObject = (CObject*)NEW_INSTANCE(CLS); |
| 39 | pObject->Load(item.first.c_str()); |
| 40 | pObject->reload(item.first.c_str()); |
| 41 | VERIFY2(pObject->cNameSect().c_str(), item.first.c_str()); |
| 42 | m_PrefetchObjects.push_back(pObject); |
| 43 | } |
| 44 | else |
| 45 | Msg("! [%s] unknown section %s in %s", __FUNCTION__, item.first.c_str(), section); |
| 46 | } |
| 47 | Render->models_begin_prefetch1(false); |
| 48 | Msg("[%s] objects prefetching time (%zi): [%.2f s.]", __FUNCTION__, p_count, T.GetElapsed_sec()); |
| 49 | } |
| 50 | |
| 51 | // out statistic |
| 52 | ::Render->model_Logging(TRUE); |
| 53 | } |
| 54 | |
| 55 | void IGame_ObjectPool::clear() |
| 56 | { |
no test coverage detected