| 862 | } |
| 863 | |
| 864 | void GuiImpl::addImage(const char label[], const Texture* pTex, float2 size, bool maintainRatio, bool sameLine) |
| 865 | { |
| 866 | FALCOR_ASSERT(pTex); |
| 867 | if (all(size == float2(0))) |
| 868 | { |
| 869 | ImVec2 windowSize = ImGui::GetWindowSize(); |
| 870 | size = {windowSize.x, windowSize.y}; |
| 871 | } |
| 872 | |
| 873 | ImGui::PushID(label); |
| 874 | if (sameLine) |
| 875 | ImGui::SameLine(); |
| 876 | float aspectRatio = maintainRatio ? (static_cast<float>(pTex->getHeight()) / static_cast<float>(pTex->getWidth())) : 1.0f; |
| 877 | ImGui::Image((ImTextureID)(pTex), {size.x, maintainRatio ? size.x * aspectRatio : size.y}); |
| 878 | ImGui::PopID(); |
| 879 | } |
| 880 | |
| 881 | bool GuiImpl::addImageButton(const char label[], const Texture* pTex, float2 size, bool maintainRatio, bool sameLine) |
| 882 | { |