| 58 | } |
| 59 | |
| 60 | bool ImageReference::BindIcon(FixedString const& iconName) |
| 61 | { |
| 62 | auto atlas = (*GetStaticSymbols().ls__gTextureAtlasMap)->IconMap.get_or_default(iconName); |
| 63 | if (!atlas) { |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | auto uvs = atlas->Icons.get_or_default(iconName); |
| 68 | if (!uvs) { |
| 69 | WARN("Failed to find UVs for icon '%s'", iconName.GetString()); |
| 70 | return false; |
| 71 | } |
| 72 | |
| 73 | auto texture = gExtender->IMGUI().RegisterTexture(atlas->TextureUuid); |
| 74 | if (!texture) { |
| 75 | WARN("Failed to load texture '%s' for icon '%s'", atlas->TextureUuid.GetString(), iconName.GetString()); |
| 76 | return false; |
| 77 | } |
| 78 | |
| 79 | Size = glm::vec2( |
| 80 | static_cast<float>(atlas->IconWidth), |
| 81 | static_cast<float>(atlas->IconHeight) |
| 82 | ); |
| 83 | |
| 84 | UV0 = uvs->UV0; |
| 85 | UV1 = uvs->UV1; |
| 86 | |
| 87 | TextureResource = atlas->TextureUuid; |
| 88 | Icon = iconName; |
| 89 | TextureHandle = texture->OpaqueHandle; |
| 90 | return true; |
| 91 | } |
| 92 | |
| 93 | ImTextureID ImageReference::PrepareRender() |
| 94 | { |
nothing calls this directly
no test coverage detected