1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Textures: Single Textures[] array allows backend to not have to care about atlases.

# Conflicts:
#	imgui.h
This commit is contained in:
ocornut 2025-01-31 19:12:58 +01:00
parent ee357aaddf
commit a21a2e855b
2 changed files with 25 additions and 5 deletions

15
imgui.h
View file

@ -3496,7 +3496,7 @@ enum ImFontAtlasFlags_
// - Mouse cursor shapes for software cursor rendering (unless setting 'Flags |= ImFontAtlasFlags_NoMouseCursors' in the font atlas).
// - If you don't call any AddFont*** functions, the default font embedded in the code will be loaded for you.
// It is the rendering backend responsibility to upload texture into your graphics API:
// - ImGui_ImplXXXX_RenderDrawData() functions generally iterate atlas->TexList[] to create/update/destroy each ImTextureData instance.
// - ImGui_ImplXXXX_RenderDrawData() functions generally iterate platform_io->Textures[] to create/update/destroy each ImTextureData instance.
// - Backend then set ImTextureData's TexID and BackendUserData.
// - Texture id are passed back to you during rendering to identify the texture. Read FAQ entry about ImTextureID for more details.
// Legacy path:
@ -3597,11 +3597,9 @@ struct ImFontAtlas
int TexGlyphPadding; // FIXME: Should be called "TexPackPadding". Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = false).
void* UserData; // Store your own atlas related user-data (if e.g. you have multiple font atlas).
// Output
ImTextureData* TexData; // Current texture
ImVector<ImTextureData*> TexList; // Texture list (most often TexList.Size == 1). TexData is always == TexList.back().
// [Internal]
ImTextureData* TexData; // Current texture
ImVector<ImTextureData*> TexList; // Texture list (most often TexList.Size == 1). TexData is always == TexList.back(). DO NOT USE DIRECTLY, USE GetPlatformIO().Textures[] instead!
bool Locked; // Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.
bool TexIsBuilt; // Set when texture was built matching current font input
bool TexPixelsUseColors; // Tell whether our texture data is known to use colors (rather than just alpha channel), in order to help backend select a format or conversion process.
@ -3788,6 +3786,13 @@ struct ImGuiPlatformIO
// Written by some backends during ImGui_ImplXXXX_RenderDrawData() call to point backend_specific ImGui_ImplXXXX_RenderState* structure.
void* Renderer_RenderState;
//------------------------------------------------------------------
// Output
//------------------------------------------------------------------
// Textures list (the list is updated by calling ImGui::EndFrame or ImGui::Render)
ImVector<ImTextureData*> Textures; // Texture list (most often Textures.Size == 1).
};
// (Optional) Support for IME (Input Method Editor) via the platform_io.Platform_SetImeDataFn() function. Handler is called during EndFrame().