For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
| 1869 | |
| 1870 | // For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! |
| 1871 | void ImDrawData::DeIndexAllBuffers() |
| 1872 | { |
| 1873 | ImVector<ImDrawVert> new_vtx_buffer; |
| 1874 | TotalVtxCount = TotalIdxCount = 0; |
| 1875 | for (int i = 0; i < CmdListsCount; i++) |
| 1876 | { |
| 1877 | ImDrawList* cmd_list = CmdLists[i]; |
| 1878 | if (cmd_list->IdxBuffer.empty()) |
| 1879 | continue; |
| 1880 | new_vtx_buffer.resize(cmd_list->IdxBuffer.Size); |
| 1881 | for (int j = 0; j < cmd_list->IdxBuffer.Size; j++) |
| 1882 | new_vtx_buffer[j] = cmd_list->VtxBuffer[cmd_list->IdxBuffer[j]]; |
| 1883 | cmd_list->VtxBuffer.swap(new_vtx_buffer); |
| 1884 | cmd_list->IdxBuffer.resize(0); |
| 1885 | TotalVtxCount += cmd_list->VtxBuffer.Size; |
| 1886 | } |
| 1887 | } |
| 1888 | |
| 1889 | // Helper to scale the ClipRect field of each ImDrawCmd. |
| 1890 | // Use if your final output buffer is at a different scale than draw_data->DisplaySize, |