| 14 | } |
| 15 | |
| 16 | void CTextureDescrMngr::LoadLTX() |
| 17 | { |
| 18 | FS_FileSet flist; |
| 19 | FS.file_list(flist, fsgame::game_textures, FS_ListFiles | FS_RootOnly, "*textures*.ltx"); |
| 20 | Msg("[%s] count of *textures*.ltx files: [%u]", __FUNCTION__, flist.size()); |
| 21 | |
| 22 | for (const auto& file : flist) |
| 23 | { |
| 24 | string_path fn; |
| 25 | FS.update_path(fn, fsgame::game_textures, file.name.c_str()); |
| 26 | CInifile ini(fn); |
| 27 | |
| 28 | if (ini.section_exist("association")) |
| 29 | { |
| 30 | auto& Sect = ini.r_section("association"); |
| 31 | |
| 32 | m_texture_details.reserve(m_texture_details.size() + Sect.Data.size()); |
| 33 | m_detail_scalers.reserve(m_detail_scalers.size() + Sect.Data.size()); |
| 34 | |
| 35 | for (const auto& [key, value] : Sect.Data) |
| 36 | { |
| 37 | texture_desc& desc = m_texture_details[key]; |
| 38 | if (desc.m_assoc) |
| 39 | xr_delete(desc.m_assoc); |
| 40 | desc.m_assoc = xr_new<texture_assoc>(); |
| 41 | |
| 42 | string_path T; |
| 43 | float s; |
| 44 | const int res = sscanf(value.c_str(), "%[^,],%f", T, &s); |
| 45 | R_ASSERT(res == 2); |
| 46 | desc.m_assoc->detail_name = T; |
| 47 | |
| 48 | m_detail_scalers[key] = s; |
| 49 | |
| 50 | desc.m_assoc->usage = 0; |
| 51 | if (strstr(value.c_str(), "usage[diffuse_or_bump]")) |
| 52 | desc.m_assoc->usage = (1 << 0) | (1 << 1); |
| 53 | else if (strstr(value.c_str(), "usage[bump]")) |
| 54 | desc.m_assoc->usage = (1 << 1); |
| 55 | else if (strstr(value.c_str(), "usage[diffuse]")) |
| 56 | desc.m_assoc->usage = (1 << 0); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | if (ini.section_exist("specification")) |
| 61 | { |
| 62 | auto& Sect = ini.r_section("specification"); |
| 63 | |
| 64 | m_texture_details.reserve(m_texture_details.size() + Sect.Data.size()); |
| 65 | |
| 66 | for (const auto& [key, value] : Sect.Data) |
| 67 | { |
| 68 | texture_desc& desc = m_texture_details[key]; |
| 69 | if (desc.m_spec) |
| 70 | xr_delete(desc.m_spec); |
| 71 | desc.m_spec = xr_new<texture_spec>(); |
| 72 | |
| 73 | string_path bmode{}, bparallax{}; |
nothing calls this directly
no test coverage detected