omar/imgui: Release v1.43
The anti-aliasing release!
This is a rather important release and we unfortunately had to break the rendering API. ImGui now requires you to render indexed vertices instead of non-indexed ones. The fix should be very easy. Sorry for that! This change is saving a fair amount of CPU/GPU and enables us to get anti-aliasing for a marginal cost.
Each ImDrawList now contains both a vertex buffer and an index buffer. For each command, render ElemCount/3 triangles using indices from the index buffer.
If you are using a vanilla copy of one of the imgui_impl_XXXX.cpp provided in the example, you just need to update your copy and you can ignore the rest.
The signature of the io.RenderDrawListsFn handler has changed:
ImGui_XXXX_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count)
became:
ImGui_XXXX_RenderDrawLists(ImDrawData* draw_data)
Where
argument 'cmd_lists' -> 'draw_data->CmdLists'
argument 'cmd_lists_count' -> 'draw_data->CmdListsCount'
ImDrawList 'commands' -> 'CmdBuffer'
ImDrawList 'vtx_buffer' -> 'VtxBuffer'
ImDrawList n/a -> 'IdxBuffer' (new)
ImDrawCmd 'vtx_count' -> 'ElemCount'
ImDrawCmd 'clip_rect' -> 'ClipRect'
ImDrawCmd 'user_callback' -> 'UserCallback'
ImDrawCmd 'texture_id' -> 'TextureId'
If you REALLY cannot render indexed primitives, you can call the draw_data->DeIndexAllBuffers() method to de-index the buffers. This is slow and a waste of CPU/GPU. Prefer using indexed rendering! Refer to code in the examples/ folder or ask on the GitHub if you are unsure of how to upgrade. Please upgrade!
- Added anti-aliasing on lines and shapes based on primitives by @MikkoMononen (#133). Between the use of indexed-rendering and the fact that the entire rendering codebase has been optimised and massaged enough, with anti-aliasing enabled ImGui 1.43 is now running FASTER than 1.41. Put some extra effort in making the code run faster in your typical Debug build.
- Anti-aliasing can be disabled in the ImGuiStyle structure via the AntiAliasedLines/AntiAliasedShapes fields for further gains.
- ImDrawList: Added AddPolyline(), AddConvexPolyFilled() with optional anti-aliasing.
- ImDrawList: Added stateful path building and stroking API. PathLineTo(), PathArcTo(), PathRect(), PathFill(), PathStroke() with optional anti-aliasing.
- ImDrawList: Added AddRectFilledMultiColor() helper.
- ImDrawList: Added multi-channel rendering so out of order elements can be rendered in separate channels and then merged back together (used by columns).
- ImDrawList: Fixed merging draw commands when equal clip rectangles are in the two first commands.
- ImDrawList: Fixed window draw lists not destructed properly on Shutdown().
- ImDrawData: Added DeIndexAllBuffers() helper.
- Added lots of new font options ImFontAtlas::AddFont() and the new ImFontConfig structure.
- Added support for oversampling (ImFontConfig: OversampleH, OversampleV) and sub-pixel positioning (ImFontConfig: PixelSnapH). Oversampling allows sub-pixel positioing but can also be used as a way to get some leeway with scaling fonts without re-rasterizing.
- Added GlyphExtraSpacing option to add extra horizontal spacing between characters (#242).
- Added MergeMode option to merge glyphs from different font inputs into a same font (#182, #232).
- Added FontDataOwnedByAtlas option to keep ownership from the TTF data buffer and request the atlas to make a copy (#220).
- Updated to stb_truetype 1.06 (+ minor mods) with better font rasterization.
- InputText: Added ImGuiInputTextFlags_NoHorizontalScroll flag.
- InputText: Added ImGuiInputTextFlags_AlwaysInsertMode flag.
- InputText: Added HasSelection() helper in ImGuiTextEditCallbackData as a clarification.
- InputText: Fix for using END key on a multi-line text editor (#275)
- Columns: Dispatch render of each column in a sub-draw list and merge on closure, saving a lot of draw calls! (#125)
- Popups: Fixed Combo boxes inside menus. (#272)
- Style: Added GrabRounding setting to make the sliders etc. grabs rounded.
- Changed SameLine() parameters from int to float.
- Fixed incorrect assert triggering when code stole ActiveID from user moving a window by calling e.g. SetKeyboardFocusHere().
- Fixed CollapsingHeader() label rendering outside its frame in columns context where cliprect max isn't aligned with the right-side of the header.
- Metrics window: calculate bounding box of actual vertices when hovering a draw list.
- Examples: Showing more information in the Fonts section.
- Examples: Added a gratuitous About window.
- Examples: Updated all examples code (OpenGL/DX9/DX11/SDL/Allegro/iOS) to use indexed rendering.
- Examples: Fixed the SDL2 example to support Unicode text input (#274).