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