simplify texture load

This commit is contained in:
Jonathan 2022-06-28 10:35:17 -04:00
parent 44c50717c3
commit aac5027ec6
1 changed files with 1 additions and 15 deletions

View File

@ -441,21 +441,7 @@ std::tuple<std::optional<img::texture>, fs::resolve_result, fs::data> load_textu
if (auto pos = fs::where(p, options.filepriority.value() == settings::search_priority_t::LOOSE)) { if (auto pos = fs::where(p, options.filepriority.value() == settings::search_priority_t::LOOSE)) {
if (auto data = fs::load(pos)) { if (auto data = fs::load(pos)) {
std::optional<img::texture> texture; if (auto texture = ext.loader(name.data(), data, meta_only, game)) {
switch (ext.id) {
case img::ext::TGA:
texture = img::load_tga(name.data(), data, meta_only, game);
break;
case img::ext::WAL:
texture = img::load_wal(name.data(), data, meta_only, game);
break;
case img::ext::MIP:
texture = img::load_mip(name.data(), data, meta_only, game);
break;
}
if (texture) {
return {texture, pos, data}; return {texture, pos, data};
} }
} }