MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / LoadLTX

Method LoadLTX

ogsr_engine/Layers/xrRender/TextureDescrManager.cpp:16–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16void 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{};

Callers

nothing calls this directly

Calls 8

MsgFunction · 0.85
xr_deleteFunction · 0.85
file_listMethod · 0.80
section_existMethod · 0.80
sizeMethod · 0.45
update_pathMethod · 0.45
c_strMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected