| 555 | } // namespace |
| 556 | |
| 557 | Bitmap::UniqueConstPtr ImageIO::loadBitmapFromDDS(const std::filesystem::path& path) |
| 558 | { |
| 559 | ImportData data; |
| 560 | try |
| 561 | { |
| 562 | loadDDS(path, false, data); |
| 563 | } |
| 564 | catch (const RuntimeError& e) |
| 565 | { |
| 566 | logWarning("Failed to load DDS image from '{}': {}", path, e.what()); |
| 567 | return nullptr; |
| 568 | } |
| 569 | |
| 570 | if (data.type == Resource::Type::Texture3D || data.type == Resource::Type::TextureCube) |
| 571 | { |
| 572 | logWarning("Failed to load DDS image from '{}': Invalid resource type {}.", path, to_string(data.type)); |
| 573 | return nullptr; |
| 574 | } |
| 575 | |
| 576 | // Create from first image |
| 577 | return Bitmap::create(data.width, data.height, data.format, data.imageData.data()); |
| 578 | } |
| 579 | |
| 580 | ref<Texture> ImageIO::loadTextureFromDDS(ref<Device> pDevice, const std::filesystem::path& path, bool loadAsSrgb) |
| 581 | { |