| 544 | texture->loadOptions = options; |
| 545 | texture->path = path.generic_string(); |
| 546 | |
| 547 | auto fileData = ReadTextureFile(path); |
| 548 | if (fileData) |
| 549 | { |
| 550 | if (FillTextureData(fileData, texture, path.extension().generic_string(), "")) |
| 551 | { |
| 552 | TextureLoaded(texture); |
| 553 | |
| 554 | std::lock_guard<std::mutex> guard(m_TexturesToFinalizeMutex); |
| 555 | |
| 556 | m_TexturesToFinalize.push(texture); |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | ++m_TexturesLoaded; |
| 561 | |
| 562 | return texture; |
| 563 | } |
| 564 | |
| 565 | std::shared_ptr<LoadedTexture> TextureCache::LoadTextureFromFileAsync( |
| 566 | const std::filesystem::path& path, |
| 567 | const TextureLoadOptions& options, |
| 568 | ThreadPool& threadPool) |
| 569 | { |
| 570 | std::shared_ptr<TextureData> texture; |
| 571 | |
| 572 | if (FindTextureInCache(path, options, texture)) |
| 573 | return texture; |
| 574 | |
| 575 | texture->loadOptions = options; |
| 576 | texture->path = path.generic_string(); |
| 577 | |
| 578 | threadPool.AddTask([this, texture, path]() |
| 579 | { |
| 580 | auto fileData = ReadTextureFile(path); |
| 581 | if (fileData) |