AA branch: io.RenderDrawListsFn signature changed to take ImDrawData, neater and future proof breaking of the render API (#133 #254)

This commit is contained in:
ocornut
2015-07-05 22:03:46 -06:00
parent 2633325b9f
commit f3303fa84f
6 changed files with 42 additions and 43 deletions

View File

@ -40,7 +40,7 @@ struct VERTEX_CONSTANT_BUFFER
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
// If text or lines are blurry when integrating ImGui in your engine:
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
static void ImGui_ImplDX11_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count)
static void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)
{
// Copy and convert all vertices into a single contiguous buffer
D3D11_MAPPED_SUBRESOURCE vtx_resource, idx_resource;
@ -50,9 +50,9 @@ static void ImGui_ImplDX11_RenderDrawLists(ImDrawList** const cmd_lists, int cmd
return;
ImDrawVert* vtx_dst = (ImDrawVert*)vtx_resource.pData;
ImDrawIdx* idx_dst = (ImDrawIdx*)idx_resource.pData;
for (int n = 0; n < cmd_lists_count; n++)
for (int n = 0; n < draw_data->cmd_lists_count; n++)
{
const ImDrawList* cmd_list = cmd_lists[n];
const ImDrawList* cmd_list = draw_data->cmd_lists[n];
memcpy(vtx_dst, &cmd_list->vtx_buffer[0], cmd_list->vtx_buffer.size() * sizeof(ImDrawVert));
memcpy(idx_dst, &cmd_list->idx_buffer[0], cmd_list->idx_buffer.size() * sizeof(ImDrawIdx));
vtx_dst += cmd_list->vtx_buffer.size();
@ -116,9 +116,9 @@ static void ImGui_ImplDX11_RenderDrawLists(ImDrawList** const cmd_lists, int cmd
// Render command lists
int vtx_offset = 0;
int idx_offset = 0;
for (int n = 0; n < cmd_lists_count; n++)
for (int n = 0; n < draw_data->cmd_lists_count; n++)
{
const ImDrawList* cmd_list = cmd_lists[n];
const ImDrawList* cmd_list = draw_data->cmd_lists[n];
for (size_t cmd_i = 0; cmd_i < cmd_list->commands.size(); cmd_i++)
{
const ImDrawCmd* pcmd = &cmd_list->commands[cmd_i];