MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / addImage

Method addImage

Source/Falcor/Utils/UI/Gui.cpp:864–879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862}
863
864void 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
881bool GuiImpl::addImageButton(const char label[], const Texture* pTex, float2 size, bool maintainRatio, bool sameLine)
882{

Callers 1

imageMethod · 0.80

Calls 4

ImageClass · 0.85
getHeightMethod · 0.80
getWidthMethod · 0.80
allFunction · 0.50

Tested by

no test coverage detected