| 578 | threadPool.AddTask([this, texture, path]() |
| 579 | { |
| 580 | auto fileData = ReadTextureFile(path); |
| 581 | if (fileData) |
| 582 | { |
| 583 | if (FillTextureData(fileData, texture, path.extension().generic_string(), "")) |
| 584 | { |
| 585 | TextureLoaded(texture); |
| 586 | |
| 587 | std::lock_guard<std::mutex> guard(m_TexturesToFinalizeMutex); |
| 588 | |
| 589 | m_TexturesToFinalize.push(texture); |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | ++m_TexturesLoaded; |
| 594 | }); |
| 595 | |
| 596 | return texture; |
| 597 | } |
| 598 | |
| 599 | std::shared_ptr<LoadedTexture> TextureCache::LoadTextureFromMemoryAsync( |
| 600 | const std::shared_ptr<vfs::IBlob>& data, |
| 601 | const std::string& name, |
| 602 | const std::string& mimeType, |
| 603 | const TextureLoadOptions& options, |
| 604 | ThreadPool& threadPool) |
| 605 | { |
| 606 | std::shared_ptr<TextureData> texture = CreateTextureData(); |
| 607 | |
| 608 | texture->loadOptions = options; |
| 609 | texture->path = name; |
| 610 | texture->mimeType = mimeType; |
| 611 | |