| 375 | } |
| 376 | |
| 377 | std::unique_ptr<Image> Image::load(const std::string &name, const std::string &uri, |
| 378 | ContentType content_type) |
| 379 | { |
| 380 | std::unique_ptr<Image> image{nullptr}; |
| 381 | |
| 382 | auto data = fs::read_asset(uri); |
| 383 | |
| 384 | // Get extension |
| 385 | auto extension = get_extension(uri); |
| 386 | |
| 387 | if (extension == "png" || extension == "jpg") |
| 388 | { |
| 389 | image = std::make_unique<Stb>(name, data, content_type); |
| 390 | } |
| 391 | else if (extension == "astc") |
| 392 | { |
| 393 | image = std::make_unique<Astc>(name, data); |
| 394 | } |
| 395 | else if (extension == "ktx") |
| 396 | { |
| 397 | image = std::make_unique<Ktx>(name, data, content_type); |
| 398 | } |
| 399 | else if (extension == "ktx2") |
| 400 | { |
| 401 | image = std::make_unique<Ktx>(name, data, content_type); |
| 402 | } |
| 403 | |
| 404 | return image; |
| 405 | } |
| 406 | |
| 407 | } // namespace sg |
| 408 | } // namespace vkb |
nothing calls this directly
no test coverage detected