| 850 | } |
| 851 | |
| 852 | const Texture* GuiImpl::loadImage(const std::filesystem::path& path) |
| 853 | { |
| 854 | auto it = mLoadedImages.find(path); |
| 855 | if (it != mLoadedImages.end()) |
| 856 | return it->second.get(); |
| 857 | |
| 858 | ref<Texture> pTex = Texture::createFromFile(mpDevice, path, false, true); |
| 859 | if (!pTex) |
| 860 | FALCOR_THROW("Failed to load GUI image from '{}'.", path); |
| 861 | return mLoadedImages.emplace(path, pTex).first->second.get(); |
| 862 | } |
| 863 | |
| 864 | void GuiImpl::addImage(const char label[], const Texture* pTex, float2 size, bool maintainRatio, bool sameLine) |
| 865 | { |