|
@@ -12,6 +12,7 @@
|
|
// Implemented features:
|
|
// Implemented features:
|
|
// [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
|
|
// [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
|
|
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
|
|
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
|
|
|
|
+// [X] Renderer: Expose selected render state for draw callbacks to use. Access in '(ImGui_ImplXXXX_RenderState*)GetPlatformIO().Renderer_RenderState'.
|
|
|
|
|
|
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
|
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
|
@@ -22,6 +23,7 @@
|
|
// - Introduction, links and more at the top of imgui.cpp
|
|
// - Introduction, links and more at the top of imgui.cpp
|
|
|
|
|
|
// CHANGELOG
|
|
// CHANGELOG
|
|
|
|
+// 2024-10-09: Expose selected render state in ImGui_ImplSDLRenderer3_RenderState, which you can access in 'void* platform_io.Renderer_RenderState' during draw callbacks.
|
|
// 2024-07-01: Update for SDL3 api changes: SDL_RenderGeometryRaw() uint32 version was removed (SDL#9009).
|
|
// 2024-07-01: Update for SDL3 api changes: SDL_RenderGeometryRaw() uint32 version was removed (SDL#9009).
|
|
// 2024-05-14: *BREAKING CHANGE* ImGui_ImplSDLRenderer3_RenderDrawData() requires SDL_Renderer* passed as parameter.
|
|
// 2024-05-14: *BREAKING CHANGE* ImGui_ImplSDLRenderer3_RenderDrawData() requires SDL_Renderer* passed as parameter.
|
|
// 2024-02-12: Amend to query SDL_RenderViewportSet() and restore viewport accordingly.
|
|
// 2024-02-12: Amend to query SDL_RenderViewportSet() and restore viewport accordingly.
|
|
@@ -163,12 +165,20 @@ void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data, SDL_Renderer*
|
|
SDL_GetRenderViewport(renderer, &old.Viewport);
|
|
SDL_GetRenderViewport(renderer, &old.Viewport);
|
|
SDL_GetRenderClipRect(renderer, &old.ClipRect);
|
|
SDL_GetRenderClipRect(renderer, &old.ClipRect);
|
|
|
|
|
|
|
|
+ // Setup desired state
|
|
|
|
+ ImGui_ImplSDLRenderer3_SetupRenderState(renderer);
|
|
|
|
+
|
|
|
|
+ // Setup render state structure (for callbacks and custom texture bindings)
|
|
|
|
+ ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
|
|
|
+ ImGui_ImplSDLRenderer3_RenderState render_state;
|
|
|
|
+ render_state.Renderer = renderer;
|
|
|
|
+ platform_io.Renderer_RenderState = &render_state;
|
|
|
|
+
|
|
// Will project scissor/clipping rectangles into framebuffer space
|
|
// Will project scissor/clipping rectangles into framebuffer space
|
|
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
|
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
|
ImVec2 clip_scale = render_scale;
|
|
ImVec2 clip_scale = render_scale;
|
|
|
|
|
|
// Render command lists
|
|
// Render command lists
|
|
- ImGui_ImplSDLRenderer3_SetupRenderState(renderer);
|
|
|
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
|
{
|
|
{
|
|
const ImDrawList* draw_list = draw_data->CmdLists[n];
|
|
const ImDrawList* draw_list = draw_data->CmdLists[n];
|
|
@@ -217,6 +227,7 @@ void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data, SDL_Renderer*
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ platform_io.Renderer_RenderState = NULL;
|
|
|
|
|
|
// Restore modified SDL_Renderer state
|
|
// Restore modified SDL_Renderer state
|
|
SDL_SetRenderViewport(renderer, old.ViewportEnabled ? &old.Viewport : nullptr);
|
|
SDL_SetRenderViewport(renderer, old.ViewportEnabled ? &old.Viewport : nullptr);
|