| 164 | } |
| 165 | |
| 166 | void CModelPool::Destroy() |
| 167 | { |
| 168 | R_ASSERT(Pool.empty()); // pool should be clear at this point |
| 169 | |
| 170 | // Registry |
| 171 | while (!Registry.empty()) |
| 172 | { |
| 173 | const REGISTRY_IT it = Registry.begin(); |
| 174 | dxRender_Visual* V = (dxRender_Visual*)it->first; |
| 175 | #ifdef DEBUG |
| 176 | Msg("ModelPool: Destroy object: '%s'", *V->dbg_name); |
| 177 | #endif |
| 178 | DeleteInternal(V, TRUE); |
| 179 | } |
| 180 | |
| 181 | // Base/Reference |
| 182 | xr_vector<ModelDef>::iterator I = Models.begin(); |
| 183 | const xr_vector<ModelDef>::iterator E = Models.end(); |
| 184 | for (; I != E; ++I) |
| 185 | { |
| 186 | I->model->Release(); |
| 187 | xr_delete(I->model); |
| 188 | } |
| 189 | |
| 190 | Models.clear(); |
| 191 | |
| 192 | // cleanup motions container |
| 193 | g_pMotionsContainer->clean(false); |
| 194 | |
| 195 | if (vis_prefetch_ini) |
| 196 | vis_prefetch_ini->save_as(); |
| 197 | |
| 198 | m_prefetched.clear(); |
| 199 | } |
| 200 | |
| 201 | CModelPool::CModelPool() |
| 202 | { |