mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Merge branch 'master' into docking
# Conflicts: # examples/imgui_impl_dx10.cpp # examples/imgui_impl_dx10.h # examples/imgui_impl_dx11.cpp # examples/imgui_impl_dx11.h # examples/imgui_impl_dx9.cpp # examples/imgui_impl_dx9.h # examples/imgui_impl_opengl3.cpp # examples/imgui_impl_opengl3.h # examples/imgui_impl_osx.h # examples/imgui_impl_osx.mm # imgui.cpp # imgui.h # imgui_demo.cpp # imgui_internal.h
This commit is contained in:
commit
c72040a715
@ -49,16 +49,30 @@ Other Changes:
|
|||||||
- Fixed uses of IsItemDeactivated(), IsItemDeactivatedAfterEdit() on multi-components widgets and
|
- Fixed uses of IsItemDeactivated(), IsItemDeactivatedAfterEdit() on multi-components widgets and
|
||||||
after EndGroup(). (#2550, #1875)
|
after EndGroup(). (#2550, #1875)
|
||||||
- Fixed crash when appending with BeginMainMenuBar() more than once and no other window are showing. (#2567)
|
- Fixed crash when appending with BeginMainMenuBar() more than once and no other window are showing. (#2567)
|
||||||
|
- ColorEdit: Fixed the color picker popup only displaying inputs as HSV instead of showing multiple
|
||||||
|
options. (#2587, broken in 1.69 by #2384).
|
||||||
|
- CollapsingHeader: Better clipping when a close button is enabled and it overlaps the label. (#600)
|
||||||
- Scrollbar: Very minor bounding box adjustment to cope with various border size.
|
- Scrollbar: Very minor bounding box adjustment to cope with various border size.
|
||||||
- Style: Added style.WindowMenuButtonPosition (left/right, defaults to ImGuiDir_Left) to move the
|
- Style: Added style.WindowMenuButtonPosition (left/right, defaults to ImGuiDir_Left) to move the
|
||||||
collapsing/docking button to the other side of the title bar.
|
collapsing/docking button to the other side of the title bar.
|
||||||
- Style: Made window close button cross is slightly smaller.
|
- Style: Made window close button cross slightly smaller.
|
||||||
|
- ImDrawList: Added ImDrawCmd::VtxOffset value to support large meshes (64k+ vertices) using 16-bits indices.
|
||||||
|
To enable the feature, the renderer back-end needs to set 'io.BackendFlags |= ImGuiBackendFlags_HasVtxOffset'
|
||||||
|
and honor the ImDrawCmd::VtxOffset field. Otherwise the value will always be zero.
|
||||||
|
This has the advantage of preserving smaller index buffers and allowing to execute on hardware that do not
|
||||||
|
support 32-bits indices. Most examples back-ends have been modified to support the VtxOffset field.
|
||||||
|
- ImDrawList: Added ImDrawCmd::IdxOffset value, equivalent to summing element count for each draw command.
|
||||||
|
This is provided for convenience and consistency with VtxOffset.
|
||||||
- ImFontAtlas: FreeType: Added RasterizerFlags::Monochrome flag to disable font anti-aliasing. (#2545)
|
- ImFontAtlas: FreeType: Added RasterizerFlags::Monochrome flag to disable font anti-aliasing. (#2545)
|
||||||
Combine with RasterizerFlags::MonoHinting for best results.
|
Combine with RasterizerFlags::MonoHinting for best results.
|
||||||
- ImFontGlyphRangesBuilder: Fixed unnecessarily over-sized buffer, which incidentally was also not
|
- ImFontGlyphRangesBuilder: Fixed unnecessarily over-sized buffer, which incidentally was also not
|
||||||
fully cleared. Fixed edge case overflow when adding character 0xFFFF. (#2568). [@NIKE3500]
|
fully cleared. Fixed edge-case overflow when adding character 0xFFFF. (#2568). [@NIKE3500]
|
||||||
- Add native Mac clipboard copy/paste default implementation in core library to match what we are
|
- Demo: Added full "Dear ImGui" prefix to the title of "Dear ImGui Demo" and "Dear ImGui Metrics" windows.
|
||||||
|
- Backends: Add native Mac clipboard copy/paste default implementation in core library to match what we are
|
||||||
dealing with Win32, and to facilitate integration in custom engines. (#2546) [@andrewwillmott]
|
dealing with Win32, and to facilitate integration in custom engines. (#2546) [@andrewwillmott]
|
||||||
|
- Backends: OSX: imgui_impl_osx: Added mouse cursor support. (#2585, #1873) [@actboy168]
|
||||||
|
- Examples/Backends: DirectX9/10/11/12, Vulkan, OpenGL3 (Desktop GL only): Added support for large meshes
|
||||||
|
(64k+ vertices) with 16-bits indices, enable 'ImGuiBackendFlags_HasVtxOffset' config flag in back-end.
|
||||||
- Examples/Backends: Don't filter characters under 0x10000 before calling io.AddInputCharacter(),
|
- Examples/Backends: Don't filter characters under 0x10000 before calling io.AddInputCharacter(),
|
||||||
the filtering is done in io.AddInputCharacter() itself. This is in prevision for fuller Unicode
|
the filtering is done in io.AddInputCharacter() itself. This is in prevision for fuller Unicode
|
||||||
support. (#2538, #2541)
|
support. (#2538, #2541)
|
||||||
|
@ -26,6 +26,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- window: using SetWindowPos() inside Begin() and moving the window with the mouse reacts a very ugly glitch. We should just defer the SetWindowPos() call.
|
- window: using SetWindowPos() inside Begin() and moving the window with the mouse reacts a very ugly glitch. We should just defer the SetWindowPos() call.
|
||||||
- window: GetWindowSize() returns (0,0) when not calculated? (#1045)
|
- window: GetWindowSize() returns (0,0) when not calculated? (#1045)
|
||||||
- window: investigate better auto-positioning for new windows.
|
- window: investigate better auto-positioning for new windows.
|
||||||
|
- window: top most window flag? (#2574)
|
||||||
- window/opt: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate. -> this may require enforcing that it is illegal to submit contents if Begin returns false.
|
- window/opt: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate. -> this may require enforcing that it is illegal to submit contents if Begin returns false.
|
||||||
- window/child: the first draw command of a child window could be moved into the current draw command of the parent window (unless child+tooltip?).
|
- window/child: the first draw command of a child window could be moved into the current draw command of the parent window (unless child+tooltip?).
|
||||||
- window/child: border could be emitted in parent as well.
|
- window/child: border could be emitted in parent as well.
|
||||||
@ -67,7 +68,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- widgets: a way to represent "mixed" values, so e.g. all values replaced with **, including check-boxes, colors, etc. with support for multi-components widgets (e.g. SliderFloat3, make only "Y" mixed)
|
- widgets: a way to represent "mixed" values, so e.g. all values replaced with **, including check-boxes, colors, etc. with support for multi-components widgets (e.g. SliderFloat3, make only "Y" mixed)
|
||||||
- widgets: selectable: generic BeginSelectable()/EndSelectable() mechanism.
|
- widgets: selectable: generic BeginSelectable()/EndSelectable() mechanism.
|
||||||
- widgets: selectable: a way to visualize partial/mixed selection (e.g. parent tree node has children with mixed selection)
|
- widgets: selectable: a way to visualize partial/mixed selection (e.g. parent tree node has children with mixed selection)
|
||||||
- widgets: checkbox with custom glyph inside frame.
|
- widgets: checkbox: checkbox with custom glyph inside frame.
|
||||||
|
- widgets: coloredit: keep reporting as active when picker is on?
|
||||||
|
|
||||||
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
|
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
|
||||||
- input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
|
- input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
|
||||||
@ -82,7 +84,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- input text: display bug when clicking a drag/slider after an input text in a different window has all-selected text (order dependent). actually a very old bug but no one appears to have noticed it.
|
- input text: display bug when clicking a drag/slider after an input text in a different window has all-selected text (order dependent). actually a very old bug but no one appears to have noticed it.
|
||||||
- input text: allow centering/positioning text so that ctrl+clicking Drag or Slider keeps the textual value at the same pixel position.
|
- input text: allow centering/positioning text so that ctrl+clicking Drag or Slider keeps the textual value at the same pixel position.
|
||||||
- input text: decorrelate layout from inputs - e.g. what's the easiest way to implement a nice IP/Mac address input editor?
|
- input text: decorrelate layout from inputs - e.g. what's the easiest way to implement a nice IP/Mac address input editor?
|
||||||
- input text: global callback system so user can plug in an expression evaluator easily.
|
- input text: global callback system so user can plug in an expression evaluator easily. (#1691)
|
||||||
- input text: force scroll to end or scroll to a given line/contents (so user can implement a log or a search feature)
|
- input text: force scroll to end or scroll to a given line/contents (so user can implement a log or a search feature)
|
||||||
- input text: a side bar that could e.g. preview where errors are. probably left to the user to draw but we'd need to give them the info there.
|
- input text: a side bar that could e.g. preview where errors are. probably left to the user to draw but we'd need to give them the info there.
|
||||||
- input text: a way for the user to provide syntax coloring.
|
- input text: a way for the user to provide syntax coloring.
|
||||||
@ -104,9 +106,12 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- layout: horizontal flow until no space left (#404)
|
- layout: horizontal flow until no space left (#404)
|
||||||
- layout: more generic alignment state (left/right/centered) for single items?
|
- layout: more generic alignment state (left/right/centered) for single items?
|
||||||
- layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding.
|
- layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding.
|
||||||
- layout: BeginGroup() needs a border option. (~#1496)
|
|
||||||
- layout: vertical alignment of mixed height items (e.g. buttons) within a same line (#1284)
|
- layout: vertical alignment of mixed height items (e.g. buttons) within a same line (#1284)
|
||||||
|
|
||||||
|
- group: BeginGroup() needs a border option. (~#1496)
|
||||||
|
- group: IsHovered() after EndGroup() covers whole aabb rather than the intersection of individual items. Is that desirable?
|
||||||
|
- group: merge deactivation/activation within same group (fwd WasEdited flag). (#2550)
|
||||||
|
|
||||||
- columns: sizing policy (e.g. for each column: fixed size, %, fill, distribute default size among fills) (#513, #125)
|
- columns: sizing policy (e.g. for each column: fixed size, %, fill, distribute default size among fills) (#513, #125)
|
||||||
- columns: add a conditional parameter to SetColumnOffset() (#513, #125)
|
- columns: add a conditional parameter to SetColumnOffset() (#513, #125)
|
||||||
- columns: headers. re-orderable. (#513, #125)
|
- columns: headers. re-orderable. (#513, #125)
|
||||||
@ -133,6 +138,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- clipper: ability to force display 1 item in the list would be convenient (for patterns where we need to set active id etc.)
|
- clipper: ability to force display 1 item in the list would be convenient (for patterns where we need to set active id etc.)
|
||||||
- clipper: ability to disable the clipping through a simple flag/bool.
|
- clipper: ability to disable the clipping through a simple flag/bool.
|
||||||
- clipper: ability to run without knowing full count in advance.
|
- clipper: ability to run without knowing full count in advance.
|
||||||
|
- clipper: horizontal clipping support. (#2580)
|
||||||
|
|
||||||
- separator: expose flags (#759)
|
- separator: expose flags (#759)
|
||||||
- separator: width, thickness, centering (#1643)
|
- separator: width, thickness, centering (#1643)
|
||||||
@ -291,6 +297,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- font: a CalcTextHeight() helper could run faster than CalcTextSize().y
|
- font: a CalcTextHeight() helper could run faster than CalcTextSize().y
|
||||||
- font: enforce monospace through ImFontConfig (for icons?) + create dual ImFont output from same input, reusing rasterized data but with different glyphs/AdvanceX
|
- font: enforce monospace through ImFontConfig (for icons?) + create dual ImFont output from same input, reusing rasterized data but with different glyphs/AdvanceX
|
||||||
- font: finish CustomRectRegister() to allow mapping Unicode codepoint to custom texture data
|
- font: finish CustomRectRegister() to allow mapping Unicode codepoint to custom texture data
|
||||||
|
- font: make it easier to submit own bitmap font (same texture, another texture?). (#2127, #2575)
|
||||||
- font: PushFontSize API (#1018)
|
- font: PushFontSize API (#1018)
|
||||||
- font: MemoryTTF taking ownership confusing/not obvious, maybe default should be opposite?
|
- font: MemoryTTF taking ownership confusing/not obvious, maybe default should be opposite?
|
||||||
- font: storing MinAdvanceX per font would allow us to skip calculating line width (under a threshold of character count) in loops looking for block width
|
- font: storing MinAdvanceX per font would allow us to skip calculating line width (under a threshold of character count) in loops looking for block width
|
||||||
@ -299,7 +306,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- font/atlas: add a missing Glyphs.reserve()
|
- font/atlas: add a missing Glyphs.reserve()
|
||||||
- font/atlas: incremental updates
|
- font/atlas: incremental updates
|
||||||
- font/atlas: dynamic font atlas to avoid baking huge ranges into bitmap and make scaling easier.
|
- font/atlas: dynamic font atlas to avoid baking huge ranges into bitmap and make scaling easier.
|
||||||
- font/atlas: allow user to submit its own primitive to be rectpacked, and allow to map them on a Unicode point.
|
|
||||||
- font/draw: vertical and/or rotated text renderer (#705) - vertical is easier clipping wise
|
- font/draw: vertical and/or rotated text renderer (#705) - vertical is easier clipping wise
|
||||||
- font/draw: need to be able to specify wrap start position.
|
- font/draw: need to be able to specify wrap start position.
|
||||||
- font/draw: better reserve policy for large horizontal block of text (shouldn't reserve for all clipped lines)
|
- font/draw: better reserve policy for large horizontal block of text (shouldn't reserve for all clipped lines)
|
||||||
@ -307,8 +313,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- font: optimization: for monospace font (like the default one) we can trim IndexXAdvance as long as trailing value is == FallbackXAdvance (need to make sure TAB is still correct), would save on cache line.
|
- font: optimization: for monospace font (like the default one) we can trim IndexXAdvance as long as trailing value is == FallbackXAdvance (need to make sure TAB is still correct), would save on cache line.
|
||||||
- font: add support for kerning, probably optional. A) perhaps default to (32..128)^2 matrix ~ 9K entries = 36KB, then hash for non-ascii?. B) or sparse lookup into per-char list?
|
- font: add support for kerning, probably optional. A) perhaps default to (32..128)^2 matrix ~ 9K entries = 36KB, then hash for non-ascii?. B) or sparse lookup into per-char list?
|
||||||
- font: add a simpler CalcTextSizeA() api? current one ok but not welcome if user needs to call it directly (without going through ImGui::CalcTextSize)
|
- font: add a simpler CalcTextSizeA() api? current one ok but not welcome if user needs to call it directly (without going through ImGui::CalcTextSize)
|
||||||
- font: fix AddRemapChar() to work before font has been built.
|
- font: fix AddRemapChar() to work before atlas has been built.
|
||||||
- font: what would it take to support codepoint higher than 0xFFFF? (smileys, etc.)
|
- font: what would it take to support codepoint higher than 0xFFFF? (smileys, etc.) (#2538, #2541)
|
||||||
- font: (api breaking) remove "TTF" from symbol names. also because it now supports OTF.
|
- font: (api breaking) remove "TTF" from symbol names. also because it now supports OTF.
|
||||||
- font/opt: Considering storing standalone AdvanceX table as 16-bit fixed point integer?
|
- font/opt: Considering storing standalone AdvanceX table as 16-bit fixed point integer?
|
||||||
- font/opt: Glyph currently 40 bytes (2+9*4). Consider storing UV as 16 bits integer? (->32 bytes). X0/Y0/X1/Y1 as 16 fixed-point integers? Or X0/Y0 as float and X1/Y1 as fixed8_8?
|
- font/opt: Glyph currently 40 bytes (2+9*4). Consider storing UV as 16 bits integer? (->32 bytes). X0/Y0/X1/Y1 as 16 fixed-point integers? Or X0/Y0 as float and X1/Y1 as fixed8_8?
|
||||||
@ -362,6 +368,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- inputs/io: backspace and arrows in the context of a text input could use system repeat rate.
|
- inputs/io: backspace and arrows in the context of a text input could use system repeat rate.
|
||||||
- inputs/io: clarify/standardize/expose repeat rate and repeat delays (#1808)
|
- inputs/io: clarify/standardize/expose repeat rate and repeat delays (#1808)
|
||||||
- inputs: add mouse cursor for unavailable/no? IDC_NO/SDL_SYSTEM_CURSOR_NO.
|
- inputs: add mouse cursor for unavailable/no? IDC_NO/SDL_SYSTEM_CURSOR_NO.
|
||||||
|
- inputs/scrolling: support for smooth scrolling (#2462, #2569)
|
||||||
|
|
||||||
- misc: idle: expose "woken up" boolean (set by inputs) and/or animation time (for cursor blink) for back-end to be able stop refreshing easily.
|
- misc: idle: expose "woken up" boolean (set by inputs) and/or animation time (for cursor blink) for back-end to be able stop refreshing easily.
|
||||||
- misc: idle: if cursor blink if the _only_ visible animation, core imgui could rewrite vertex alpha to avoid CPU pass on ImGui:: calls.
|
- misc: idle: if cursor blink if the _only_ visible animation, core imgui could rewrite vertex alpha to avoid CPU pass on ImGui:: calls.
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
@ -11,7 +12,8 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2019-05-29: DirectX10: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_HasVtxOffset flag.
|
||||||
// 2019-04-30: DirectX10: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
// 2019-04-30: DirectX10: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
|
// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
|
||||||
// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
|
// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
|
||||||
@ -214,8 +216,9 @@ void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data)
|
|||||||
ImGui_ImplDX10_SetupRenderState(draw_data, ctx);
|
ImGui_ImplDX10_SetupRenderState(draw_data, ctx);
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
int vtx_offset = 0;
|
// (Because we merged all buffers into a single one, we maintain our own offset into them)
|
||||||
int idx_offset = 0;
|
int global_vtx_offset = 0;
|
||||||
|
int global_idx_offset = 0;
|
||||||
ImVec2 clip_off = draw_data->DisplayPos;
|
ImVec2 clip_off = draw_data->DisplayPos;
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
@ -241,11 +244,11 @@ void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data)
|
|||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
ID3D10ShaderResourceView* texture_srv = (ID3D10ShaderResourceView*)pcmd->TextureId;
|
ID3D10ShaderResourceView* texture_srv = (ID3D10ShaderResourceView*)pcmd->TextureId;
|
||||||
ctx->PSSetShaderResources(0, 1, &texture_srv);
|
ctx->PSSetShaderResources(0, 1, &texture_srv);
|
||||||
ctx->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);
|
ctx->DrawIndexed(pcmd->ElemCount, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset);
|
||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
|
||||||
}
|
}
|
||||||
vtx_offset += cmd_list->VtxBuffer.Size;
|
global_idx_offset += cmd_list->IdxBuffer.Size;
|
||||||
|
global_vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore modified DX state
|
// Restore modified DX state
|
||||||
@ -493,6 +496,7 @@ bool ImGui_ImplDX10_Init(ID3D10Device* device)
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||||
io.BackendRendererName = "imgui_impl_dx10";
|
io.BackendRendererName = "imgui_impl_dx10";
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_HasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
|
||||||
// Get factory from device
|
// Get factory from device
|
||||||
IDXGIDevice* pDXGIDevice = NULL;
|
IDXGIDevice* pDXGIDevice = NULL;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp
|
||||||
@ -11,7 +12,8 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2019-05-29: DirectX11: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_HasVtxOffset flag.
|
||||||
// 2019-04-30: DirectX11: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
// 2019-04-30: DirectX11: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
|
// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
|
||||||
// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
|
// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
|
||||||
@ -219,8 +221,9 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
|||||||
ImGui_ImplDX11_SetupRenderState(draw_data, ctx);
|
ImGui_ImplDX11_SetupRenderState(draw_data, ctx);
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
int vtx_offset = 0;
|
// (Because we merged all buffers into a single one, we maintain our own offset into them)
|
||||||
int idx_offset = 0;
|
int global_idx_offset = 0;
|
||||||
|
int global_vtx_offset = 0;
|
||||||
ImVec2 clip_off = draw_data->DisplayPos;
|
ImVec2 clip_off = draw_data->DisplayPos;
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
@ -246,11 +249,11 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
|||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
ID3D11ShaderResourceView* texture_srv = (ID3D11ShaderResourceView*)pcmd->TextureId;
|
ID3D11ShaderResourceView* texture_srv = (ID3D11ShaderResourceView*)pcmd->TextureId;
|
||||||
ctx->PSSetShaderResources(0, 1, &texture_srv);
|
ctx->PSSetShaderResources(0, 1, &texture_srv);
|
||||||
ctx->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);
|
ctx->DrawIndexed(pcmd->ElemCount, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset);
|
||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
|
||||||
}
|
}
|
||||||
vtx_offset += cmd_list->VtxBuffer.Size;
|
global_idx_offset += cmd_list->IdxBuffer.Size;
|
||||||
|
global_vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore modified DX state
|
// Restore modified DX state
|
||||||
@ -500,6 +503,7 @@ bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_co
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||||
io.BackendRendererName = "imgui_impl_dx11";
|
io.BackendRendererName = "imgui_impl_dx11";
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_HasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
|
||||||
// Get factory from device
|
// Get factory from device
|
||||||
IDXGIDevice* pDXGIDevice = NULL;
|
IDXGIDevice* pDXGIDevice = NULL;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
// Issues:
|
// Issues:
|
||||||
// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
|
// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
|
||||||
|
|
||||||
@ -12,6 +13,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2019-05-29: DirectX12: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_HasVtxOffset flag.
|
||||||
// 2019-04-30: DirectX12: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
// 2019-04-30: DirectX12: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
// 2019-03-29: Misc: Various minor tidying up.
|
// 2019-03-29: Misc: Various minor tidying up.
|
||||||
// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
|
// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
|
||||||
@ -204,8 +206,9 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
|
|||||||
ImGui_ImplDX12_SetupRenderState(draw_data, ctx, fr);
|
ImGui_ImplDX12_SetupRenderState(draw_data, ctx, fr);
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
int vtx_offset = 0;
|
// (Because we merged all buffers into a single one, we maintain our own offset into them)
|
||||||
int idx_offset = 0;
|
int global_vtx_offset = 0;
|
||||||
|
int global_idx_offset = 0;
|
||||||
ImVec2 clip_off = draw_data->DisplayPos;
|
ImVec2 clip_off = draw_data->DisplayPos;
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
@ -228,11 +231,11 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
|
|||||||
const D3D12_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
|
const D3D12_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
|
||||||
ctx->SetGraphicsRootDescriptorTable(1, *(D3D12_GPU_DESCRIPTOR_HANDLE*)&pcmd->TextureId);
|
ctx->SetGraphicsRootDescriptorTable(1, *(D3D12_GPU_DESCRIPTOR_HANDLE*)&pcmd->TextureId);
|
||||||
ctx->RSSetScissorRects(1, &r);
|
ctx->RSSetScissorRects(1, &r);
|
||||||
ctx->DrawIndexedInstanced(pcmd->ElemCount, 1, idx_offset, vtx_offset, 0);
|
ctx->DrawIndexedInstanced(pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
|
||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
|
||||||
}
|
}
|
||||||
vtx_offset += cmd_list->VtxBuffer.Size;
|
global_idx_offset += cmd_list->IdxBuffer.Size;
|
||||||
|
global_vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,6 +613,7 @@ bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FO
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional) // FIXME-VIEWPORT: Actually unfinished..
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional) // FIXME-VIEWPORT: Actually unfinished..
|
||||||
io.BackendRendererName = "imgui_impl_dx12";
|
io.BackendRendererName = "imgui_impl_dx12";
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_HasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
|
||||||
g_pd3dDevice = device;
|
g_pd3dDevice = device;
|
||||||
g_RTVFormat = rtv_format;
|
g_RTVFormat = rtv_format;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
// Issues:
|
// Issues:
|
||||||
// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
|
// [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
@ -12,6 +13,7 @@
|
|||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2019-05-29: DirectX9: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_HasVtxOffset flag.
|
||||||
// 2019-04-30: DirectX9: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
// 2019-04-30: DirectX9: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
// 2019-03-29: Misc: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects().
|
// 2019-03-29: Misc: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects().
|
||||||
// 2019-01-16: Misc: Disabled fog before drawing UI's. Fixes issue #2288.
|
// 2019-01-16: Misc: Disabled fog before drawing UI's. Fixes issue #2288.
|
||||||
@ -180,8 +182,9 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
|
|||||||
ImGui_ImplDX9_SetupRenderState(draw_data);
|
ImGui_ImplDX9_SetupRenderState(draw_data);
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
int vtx_offset = 0;
|
// (Because we merged all buffers into a single one, we maintain our own offset into them)
|
||||||
int idx_offset = 0;
|
int global_vtx_offset = 0;
|
||||||
|
int global_idx_offset = 0;
|
||||||
ImVec2 clip_off = draw_data->DisplayPos;
|
ImVec2 clip_off = draw_data->DisplayPos;
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
@ -204,11 +207,11 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
|
|||||||
const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->TextureId;
|
const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->TextureId;
|
||||||
g_pd3dDevice->SetTexture(0, texture);
|
g_pd3dDevice->SetTexture(0, texture);
|
||||||
g_pd3dDevice->SetScissorRect(&r);
|
g_pd3dDevice->SetScissorRect(&r);
|
||||||
g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, idx_offset, pcmd->ElemCount/3);
|
g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, pcmd->VtxOffset + global_vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, pcmd->IdxOffset + global_idx_offset, pcmd->ElemCount/3);
|
||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
|
||||||
}
|
}
|
||||||
vtx_offset += cmd_list->VtxBuffer.Size;
|
global_idx_offset += cmd_list->IdxBuffer.Size;
|
||||||
|
global_vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore the DX9 transform
|
// Restore the DX9 transform
|
||||||
@ -226,6 +229,7 @@ bool ImGui_ImplDX9_Init(IDirect3DDevice9* device)
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||||
io.BackendRendererName = "imgui_impl_dx9";
|
io.BackendRendererName = "imgui_impl_dx9";
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_HasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
|
||||||
g_pd3dDevice = device;
|
g_pd3dDevice = device;
|
||||||
g_pd3dDevice->AddRef();
|
g_pd3dDevice->AddRef();
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||||
|
// [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
@ -13,7 +14,8 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2019-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2019-05-29: OpenGL: Desktop GL only: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_HasVtxOffset flag.
|
||||||
// 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
// 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
// 2019-03-29: OpenGL: Not calling glBindBuffer more than necessary in the render loop.
|
// 2019-03-29: OpenGL: Not calling glBindBuffer more than necessary in the render loop.
|
||||||
// 2019-03-15: OpenGL: Added a dummy GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized GL function loaders early.
|
// 2019-03-15: OpenGL: Added a dummy GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized GL function loaders early.
|
||||||
@ -104,6 +106,13 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Desktop GL has glDrawElementsBaseVertex() which GL ES and WebGL don't have.
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_ES2) || defined(IMGUI_IMPL_OPENGL_ES3)
|
||||||
|
#define IMGUI_IMPL_OPENGL_HAS_DRAW_WITH_BASE_VERTEX 1
|
||||||
|
#else
|
||||||
|
#define IMGUI_IMPL_OPENGL_HAS_DRAW_WITH_BASE_VERTEX 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// OpenGL Data
|
// OpenGL Data
|
||||||
static char g_GlslVersionString[32] = "";
|
static char g_GlslVersionString[32] = "";
|
||||||
static GLuint g_FontTexture = 0;
|
static GLuint g_FontTexture = 0;
|
||||||
@ -275,7 +284,6 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
size_t idx_buffer_offset = 0;
|
|
||||||
|
|
||||||
// Upload vertex/index buffers
|
// Upload vertex/index buffers
|
||||||
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
|
||||||
@ -312,10 +320,13 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
|
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
|
||||||
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)idx_buffer_offset);
|
#if IMGUI_IMPL_OPENGL_HAS_DRAW_WITH_BASE_VERTEX
|
||||||
|
glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)pcmd->IdxOffset, (GLint)pcmd->VtxOffset);
|
||||||
|
#else
|
||||||
|
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)pcmd->IdxOffset);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
idx_buffer_offset += pcmd->ElemCount * sizeof(ImDrawIdx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +407,7 @@ static bool CheckShader(GLuint handle, const char* desc)
|
|||||||
glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
if ((GLboolean)status == GL_FALSE)
|
if ((GLboolean)status == GL_FALSE)
|
||||||
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s!\n", desc);
|
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s!\n", desc);
|
||||||
if (log_length > 0)
|
if (log_length > 1)
|
||||||
{
|
{
|
||||||
ImVector<char> buf;
|
ImVector<char> buf;
|
||||||
buf.resize((int)(log_length + 1));
|
buf.resize((int)(log_length + 1));
|
||||||
@ -414,7 +425,7 @@ static bool CheckProgram(GLuint handle, const char* desc)
|
|||||||
glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
if ((GLboolean)status == GL_FALSE)
|
if ((GLboolean)status == GL_FALSE)
|
||||||
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! (with GLSL '%s')\n", desc, g_GlslVersionString);
|
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! (with GLSL '%s')\n", desc, g_GlslVersionString);
|
||||||
if (log_length > 0)
|
if (log_length > 1)
|
||||||
{
|
{
|
||||||
ImVector<char> buf;
|
ImVector<char> buf;
|
||||||
buf.resize((int)(log_length + 1));
|
buf.resize((int)(log_length + 1));
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||||
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||||
|
// [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
// dear imgui: Platform Binding for OSX / Cocoa
|
// dear imgui: Platform Binding for OSX / Cocoa
|
||||||
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
||||||
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
|
// [ALPHA] Early bindings, not well tested. If you want a portable application, prefer using the GLFW or SDL platform bindings on Mac.
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
|
// [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this back-end).
|
||||||
// Issues:
|
// Issues:
|
||||||
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
|
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
|
||||||
|
<<<<<<< HEAD
|
||||||
// [ ] Platform: Mouse cursor shapes and visibility are not supported (see end of https://github.com/glfw/glfw/issues/427)
|
// [ ] Platform: Mouse cursor shapes and visibility are not supported (see end of https://github.com/glfw/glfw/issues/427)
|
||||||
// [ ] Platform: Multi-viewport / platform windows.
|
// [ ] Platform: Multi-viewport / platform windows.
|
||||||
|
=======
|
||||||
|
>>>>>>> master
|
||||||
|
|
||||||
@class NSEvent;
|
@class NSEvent;
|
||||||
@class NSView;
|
@class NSView;
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
// dear imgui: Platform Binding for OSX / Cocoa
|
// dear imgui: Platform Binding for OSX / Cocoa
|
||||||
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
// This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
|
||||||
// [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac.
|
// [ALPHA] Early bindings, not well tested. If you want a portable application, prefer using the GLFW or SDL platform bindings on Mac.
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
|
// [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this back-end).
|
||||||
// Issues:
|
// Issues:
|
||||||
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
|
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
|
||||||
|
<<<<<<< HEAD
|
||||||
// [ ] Platform: Mouse cursor shapes and visibility are not supported (see end of https://github.com/glfw/glfw/issues/427)
|
// [ ] Platform: Mouse cursor shapes and visibility are not supported (see end of https://github.com/glfw/glfw/issues/427)
|
||||||
// [ ] Platform: Multi-viewport / platform windows.
|
// [ ] Platform: Multi-viewport / platform windows.
|
||||||
|
=======
|
||||||
|
>>>>>>> master
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_osx.h"
|
#include "imgui_impl_osx.h"
|
||||||
@ -13,6 +19,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2019-05-28: Inputs: Added mouse cursor shape and visibility support.
|
||||||
// 2019-05-18: Misc: Removed clipboard handlers as they are now supported by core imgui.cpp.
|
// 2019-05-18: Misc: Removed clipboard handlers as they are now supported by core imgui.cpp.
|
||||||
// 2019-05-11: Inputs: Don't filter character values before calling AddInputCharacter() apart from 0xF700..0xFFFF range.
|
// 2019-05-11: Inputs: Don't filter character values before calling AddInputCharacter() apart from 0xF700..0xFFFF range.
|
||||||
// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
|
// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
|
||||||
@ -20,6 +27,16 @@
|
|||||||
|
|
||||||
// Data
|
// Data
|
||||||
static CFAbsoluteTime g_Time = 0.0;
|
static CFAbsoluteTime g_Time = 0.0;
|
||||||
|
static NSCursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = { 0 };
|
||||||
|
static bool g_MouseCursorHidden = false;
|
||||||
|
|
||||||
|
// Undocumented methods for creating cursors.
|
||||||
|
@interface NSCursor()
|
||||||
|
+ (id)_windowResizeNorthWestSouthEastCursor;
|
||||||
|
+ (id)_windowResizeNorthEastSouthWestCursor;
|
||||||
|
+ (id)_windowResizeNorthSouthCursor;
|
||||||
|
+ (id)_windowResizeEastWestCursor;
|
||||||
|
@end
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
bool ImGui_ImplOSX_Init()
|
bool ImGui_ImplOSX_Init()
|
||||||
@ -27,7 +44,7 @@ bool ImGui_ImplOSX_Init()
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
// Setup back-end capabilities flags
|
// Setup back-end capabilities flags
|
||||||
//io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||||
//io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
//io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
||||||
//io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports; // We can create multi-viewports on the Platform side (optional)
|
//io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports; // We can create multi-viewports on the Platform side (optional)
|
||||||
//io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport; // We can set io.MouseHoveredViewport correctly (optional, not easy)
|
//io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport; // We can set io.MouseHoveredViewport correctly (optional, not easy)
|
||||||
@ -57,6 +74,17 @@ bool ImGui_ImplOSX_Init()
|
|||||||
io.KeyMap[ImGuiKey_Y] = 'Y';
|
io.KeyMap[ImGuiKey_Y] = 'Y';
|
||||||
io.KeyMap[ImGuiKey_Z] = 'Z';
|
io.KeyMap[ImGuiKey_Z] = 'Z';
|
||||||
|
|
||||||
|
// Load cursors. Some of them are undocumented.
|
||||||
|
g_MouseCursorHidden = false;
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_Arrow] = [NSCursor arrowCursor];
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_TextInput] = [NSCursor IBeamCursor];
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeAll] = [NSCursor closedHandCursor];
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_Hand] = [NSCursor pointingHandCursor];
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeNS] = [NSCursor respondsToSelector:@selector(_windowResizeNorthSouthCursor)] ? [NSCursor _windowResizeNorthSouthCursor] : [NSCursor resizeUpDownCursor];
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = [NSCursor respondsToSelector:@selector(_windowResizeEastWestCursor)] ? [NSCursor _windowResizeEastWestCursor] : [NSCursor resizeLeftRightCursor];
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = [NSCursor respondsToSelector:@selector(_windowResizeNorthEastSouthWestCursor)] ? [NSCursor _windowResizeNorthEastSouthWestCursor] : [NSCursor closedHandCursor];
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = [NSCursor respondsToSelector:@selector(_windowResizeNorthWestSouthEastCursor)] ? [NSCursor _windowResizeNorthWestSouthEastCursor] : [NSCursor closedHandCursor];
|
||||||
|
|
||||||
// We don't set the io.SetClipboardTextFn/io.GetClipboardTextFn handlers,
|
// We don't set the io.SetClipboardTextFn/io.GetClipboardTextFn handlers,
|
||||||
// because imgui.cpp has a default for them that works with OSX.
|
// because imgui.cpp has a default for them that works with OSX.
|
||||||
|
|
||||||
@ -67,6 +95,34 @@ void ImGui_ImplOSX_Shutdown()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ImGui_ImplOSX_UpdateMouseCursor()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
|
||||||
|
if (io.MouseDrawCursor || imgui_cursor == ImGuiMouseCursor_None)
|
||||||
|
{
|
||||||
|
// Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
|
||||||
|
if (!g_MouseCursorHidden)
|
||||||
|
{
|
||||||
|
g_MouseCursorHidden = true;
|
||||||
|
[NSCursor hide];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Show OS mouse cursor
|
||||||
|
[g_MouseCursors[g_MouseCursors[imgui_cursor] ? imgui_cursor : ImGuiMouseCursor_Arrow] set];
|
||||||
|
if (g_MouseCursorHidden)
|
||||||
|
{
|
||||||
|
g_MouseCursorHidden = false;
|
||||||
|
[NSCursor unhide];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ImGui_ImplOSX_NewFrame(NSView* view)
|
void ImGui_ImplOSX_NewFrame(NSView* view)
|
||||||
{
|
{
|
||||||
// Setup display size
|
// Setup display size
|
||||||
@ -81,6 +137,8 @@ void ImGui_ImplOSX_NewFrame(NSView* view)
|
|||||||
CFAbsoluteTime current_time = CFAbsoluteTimeGetCurrent();
|
CFAbsoluteTime current_time = CFAbsoluteTimeGetCurrent();
|
||||||
io.DeltaTime = current_time - g_Time;
|
io.DeltaTime = current_time - g_Time;
|
||||||
g_Time = current_time;
|
g_Time = current_time;
|
||||||
|
|
||||||
|
ImGui_ImplOSX_UpdateMouseCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mapCharacterToKey(int c)
|
static int mapCharacterToKey(int c)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// dear imgui: Renderer for Vulkan
|
// dear imgui: Renderer for Vulkan
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
// Missing features:
|
// Missing features:
|
||||||
// [ ] Platform: Multi-viewport / platform windows.
|
// [ ] Platform: Multi-viewport / platform windows.
|
||||||
// [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
// [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
||||||
@ -21,6 +23,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2019-05-29: Vulkan: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_HasVtxOffset flag.
|
||||||
// 2019-04-30: Vulkan: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
// 2019-04-30: Vulkan: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||||
// 2019-04-04: *BREAKING CHANGE*: Vulkan: Added ImageCount/MinImageCount fields in ImGui_ImplVulkan_InitInfo, required for initialization (was previously a hard #define IMGUI_VK_QUEUED_FRAMES 2). Added ImGui_ImplVulkan_SetMinImageCount().
|
// 2019-04-04: *BREAKING CHANGE*: Vulkan: Added ImageCount/MinImageCount fields in ImGui_ImplVulkan_InitInfo, required for initialization (was previously a hard #define IMGUI_VK_QUEUED_FRAMES 2). Added ImGui_ImplVulkan_SetMinImageCount().
|
||||||
// 2019-04-04: Vulkan: Added VkInstance argument to ImGui_ImplVulkanH_CreateWindow() optional helper.
|
// 2019-04-04: Vulkan: Added VkInstance argument to ImGui_ImplVulkanH_CreateWindow() optional helper.
|
||||||
@ -391,8 +394,9 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm
|
|||||||
ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
|
ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
int vtx_offset = 0;
|
// (Because we merged all buffers into a single one, we maintain our own offset into them)
|
||||||
int idx_offset = 0;
|
int global_vtx_offset = 0;
|
||||||
|
int global_idx_offset = 0;
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
@ -434,12 +438,12 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm
|
|||||||
vkCmdSetScissor(command_buffer, 0, 1, &scissor);
|
vkCmdSetScissor(command_buffer, 0, 1, &scissor);
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
vkCmdDrawIndexed(command_buffer, pcmd->ElemCount, 1, idx_offset, vtx_offset, 0);
|
vkCmdDrawIndexed(command_buffer, pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
|
||||||
}
|
}
|
||||||
vtx_offset += cmd_list->VtxBuffer.Size;
|
global_idx_offset += cmd_list->IdxBuffer.Size;
|
||||||
|
global_vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,6 +823,7 @@ bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass rend
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||||
io.BackendRendererName = "imgui_impl_vulkan";
|
io.BackendRendererName = "imgui_impl_vulkan";
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_HasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||||
|
|
||||||
IM_ASSERT(info->Instance != VK_NULL_HANDLE);
|
IM_ASSERT(info->Instance != VK_NULL_HANDLE);
|
||||||
IM_ASSERT(info->PhysicalDevice != VK_NULL_HANDLE);
|
IM_ASSERT(info->PhysicalDevice != VK_NULL_HANDLE);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// dear imgui: Renderer for Vulkan
|
// dear imgui: Renderer for Vulkan
|
||||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits indices.
|
||||||
// Missing features:
|
// Missing features:
|
||||||
// [ ] Platform: Multi-viewport / platform windows.
|
// [ ] Platform: Multi-viewport / platform windows.
|
||||||
// [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
// [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
|
||||||
|
@ -62,7 +62,10 @@
|
|||||||
operator MyVec4() const { return MyVec4(x,y,z,w); }
|
operator MyVec4() const { return MyVec4(x,y,z,w); }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//---- Use 32-bit vertex indices (default is 16-bit) to allow meshes with more than 64K vertices. Render function needs to support it.
|
//---- Using 32-bits vertex indices (default is 16-bits) is one way to allow large meshes with more than 64K vertices.
|
||||||
|
// Your renderer back-end will need to support it (most example renderer back-ends support both 16/32-bits indices).
|
||||||
|
// Another way to allow large meshes while keeping 16-bits indices is to handle ImDrawCmd::VtxOffset in your renderer.
|
||||||
|
// Read about ImGuiBackendFlags_HasVtxOffset for details.
|
||||||
//#define ImDrawIdx unsigned int
|
//#define ImDrawIdx unsigned int
|
||||||
|
|
||||||
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
|
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
|
||||||
|
99
imgui.cpp
99
imgui.cpp
@ -3379,7 +3379,7 @@ static void TranslateWindow(ImGuiWindow* window, const ImVec2& delta)
|
|||||||
window->Pos += delta;
|
window->Pos += delta;
|
||||||
window->ClipRect.Translate(delta);
|
window->ClipRect.Translate(delta);
|
||||||
window->OuterRectClipped.Translate(delta);
|
window->OuterRectClipped.Translate(delta);
|
||||||
window->InnerMainRect.Translate(delta);
|
window->InnerVisibleRect.Translate(delta);
|
||||||
window->DC.CursorPos += delta;
|
window->DC.CursorPos += delta;
|
||||||
window->DC.CursorStartPos += delta;
|
window->DC.CursorStartPos += delta;
|
||||||
window->DC.CursorMaxPos += delta;
|
window->DC.CursorMaxPos += delta;
|
||||||
@ -3686,6 +3686,13 @@ void ImGui::NewFrame()
|
|||||||
virtual_space.Add(g.Viewports[n]->GetRect());
|
virtual_space.Add(g.Viewports[n]->GetRect());
|
||||||
g.DrawListSharedData.ClipRectFullscreen = ImVec4(virtual_space.Min.x, virtual_space.Min.y, virtual_space.Max.x, virtual_space.Max.y);
|
g.DrawListSharedData.ClipRectFullscreen = ImVec4(virtual_space.Min.x, virtual_space.Min.y, virtual_space.Max.x, virtual_space.Max.y);
|
||||||
g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol;
|
g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol;
|
||||||
|
g.DrawListSharedData.InitialFlags = ImDrawListFlags_None;
|
||||||
|
if (g.Style.AntiAliasedLines)
|
||||||
|
g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLines;
|
||||||
|
if (g.Style.AntiAliasedFill)
|
||||||
|
g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedFill;
|
||||||
|
if (g.IO.BackendFlags & ImGuiBackendFlags_HasVtxOffset)
|
||||||
|
g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset;
|
||||||
|
|
||||||
// Mark rendering data as invalid to prevent user who may have a handle on it to use it.
|
// Mark rendering data as invalid to prevent user who may have a handle on it to use it.
|
||||||
for (int n = 0; n < g.Viewports.Size; n++)
|
for (int n = 0; n < g.Viewports.Size; n++)
|
||||||
@ -3989,19 +3996,28 @@ static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* d
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. May trigger for you if you are using PrimXXX functions incorrectly.
|
// Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.
|
||||||
|
// May trigger for you if you are using PrimXXX functions incorrectly.
|
||||||
IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);
|
IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);
|
||||||
IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);
|
IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);
|
||||||
|
if (!(draw_list->Flags & ImDrawListFlags_AllowVtxOffset))
|
||||||
IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);
|
IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);
|
||||||
|
|
||||||
// Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window)
|
// Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window)
|
||||||
// If this assert triggers because you are drawing lots of stuff manually:
|
// If this assert triggers because you are drawing lots of stuff manually:
|
||||||
// A) Make sure you are coarse clipping, because ImDrawList let all your vertices pass. You can use the Metrics window to inspect draw list contents.
|
// - First, make sure you are coarse clipping yourself and not trying to draw many things outside visible bounds.
|
||||||
// B) If you need/want meshes with more than 64K vertices, uncomment the '#define ImDrawIdx unsigned int' line in imconfig.h to set the index size to 4 bytes.
|
// Be mindful that the ImDrawList API doesn't filter vertices. Use the Metrics window to inspect draw list contents.
|
||||||
// You'll need to handle the 4-bytes indices to your renderer. For example, the OpenGL example code detect index size at compile-time by doing:
|
// - If you want large meshes with more than 64K vertices, you can either:
|
||||||
|
// (A) Handle the ImDrawCmd::VtxOffset value in your renderer back-end, and set 'io.BackendFlags |= ImGuiBackendFlags_HasVtxOffset'.
|
||||||
|
// Most example back-ends already support this from 1.71. Pre-1.71 back-ends won't.
|
||||||
|
// Some graphics API such as GL ES 1/2 don't have a way to offset the starting vertex so it is not supported for them.
|
||||||
|
// (B) Or handle 32-bits indices in your renderer back-end, and uncomment '#define ImDrawIdx unsigned int' line in imconfig.h.
|
||||||
|
// Most example back-ends already support this. For example, the OpenGL example code detect index size at compile-time:
|
||||||
// glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
|
// glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
|
||||||
// Your own engine or render API may use different parameters or function calls to specify index sizes. 2 and 4 bytes indices are generally supported by most API.
|
// Your own engine or render API may use different parameters or function calls to specify index sizes.
|
||||||
// C) If for some reason you cannot use 4 bytes indices or don't want to, a workaround is to call BeginChild()/EndChild() before reaching the 64K limit to split your draw commands in multiple draw lists.
|
// 2 and 4 bytes indices are generally supported by most graphics API.
|
||||||
|
// - If for some reason neither of those solutions works for you, a workaround is to call BeginChild()/EndChild() before reaching
|
||||||
|
// the 64K limit to split your draw commands in multiple draw lists.
|
||||||
if (sizeof(ImDrawIdx) == 2)
|
if (sizeof(ImDrawIdx) == 2)
|
||||||
IM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above");
|
IM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above");
|
||||||
|
|
||||||
@ -6021,10 +6037,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
||||||
// Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior.
|
// Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior.
|
||||||
const ImRect title_bar_rect = window->TitleBarRect();
|
const ImRect title_bar_rect = window->TitleBarRect();
|
||||||
window->InnerMainRect.Min.x = title_bar_rect.Min.x + window->WindowBorderSize;
|
window->InnerVisibleRect.Min.x = title_bar_rect.Min.x + window->WindowBorderSize;
|
||||||
window->InnerMainRect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);
|
window->InnerVisibleRect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);
|
||||||
window->InnerMainRect.Max.x = window->Pos.x + window->Size.x - ImMax(window->ScrollbarSizes.x, window->WindowBorderSize);
|
window->InnerVisibleRect.Max.x = window->Pos.x + window->Size.x - ImMax(window->ScrollbarSizes.x, window->WindowBorderSize);
|
||||||
window->InnerMainRect.Max.y = window->Pos.y + window->Size.y - ImMax(window->ScrollbarSizes.y, window->WindowBorderSize);
|
window->InnerVisibleRect.Max.y = window->Pos.y + window->Size.y - ImMax(window->ScrollbarSizes.y, window->WindowBorderSize);
|
||||||
|
|
||||||
// Outer host rectangle for drawing background and borders
|
// Outer host rectangle for drawing background and borders
|
||||||
ImRect host_rect = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip) ? parent_window->ClipRect : viewport_rect;
|
ImRect host_rect = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip) ? parent_window->ClipRect : viewport_rect;
|
||||||
@ -6038,10 +6054,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// Inner work/clipping rectangle will extend a little bit outside the work region.
|
// Inner work/clipping rectangle will extend a little bit outside the work region.
|
||||||
// This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.
|
// This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.
|
||||||
// Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
// Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
|
||||||
window->InnerWorkRect.Min.x = ImFloor(0.5f + window->InnerMainRect.Min.x + ImMax(0.0f, ImFloor(window->WindowPadding.x * 0.5f - window->WindowBorderSize)));
|
window->InnerWorkRect.Min.x = ImFloor(0.5f + window->InnerVisibleRect.Min.x + ImMax(0.0f, ImFloor(window->WindowPadding.x * 0.5f - window->WindowBorderSize)));
|
||||||
window->InnerWorkRect.Min.y = ImFloor(0.5f + window->InnerMainRect.Min.y);
|
window->InnerWorkRect.Min.y = ImFloor(0.5f + window->InnerVisibleRect.Min.y);
|
||||||
window->InnerWorkRect.Max.x = ImFloor(0.5f + window->InnerMainRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x * 0.5f - window->WindowBorderSize)));
|
window->InnerWorkRect.Max.x = ImFloor(0.5f + window->InnerVisibleRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x * 0.5f - window->WindowBorderSize)));
|
||||||
window->InnerWorkRect.Max.y = ImFloor(0.5f + window->InnerMainRect.Max.y);
|
window->InnerWorkRect.Max.y = ImFloor(0.5f + window->InnerVisibleRect.Max.y);
|
||||||
window->InnerWorkRectClipped = window->InnerWorkRect;
|
window->InnerWorkRectClipped = window->InnerWorkRect;
|
||||||
window->InnerWorkRectClipped.ClipWithFull(host_rect);
|
window->InnerWorkRectClipped.ClipWithFull(host_rect);
|
||||||
|
|
||||||
@ -6049,7 +6065,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
|
|
||||||
// Setup draw list and outer clipping rectangle
|
// Setup draw list and outer clipping rectangle
|
||||||
window->DrawList->Clear();
|
window->DrawList->Clear();
|
||||||
window->DrawList->Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0);
|
|
||||||
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
|
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
|
||||||
PushClipRect(host_rect.Min, host_rect.Max, false);
|
PushClipRect(host_rect.Min, host_rect.Max, false);
|
||||||
|
|
||||||
@ -8495,7 +8510,7 @@ ImVec2 ImGui::GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInput
|
|||||||
// NB: We modify rect_rel by the amount we scrolled for, so it is immediately updated.
|
// NB: We modify rect_rel by the amount we scrolled for, so it is immediately updated.
|
||||||
static void NavScrollToBringItemIntoView(ImGuiWindow* window, const ImRect& item_rect)
|
static void NavScrollToBringItemIntoView(ImGuiWindow* window, const ImRect& item_rect)
|
||||||
{
|
{
|
||||||
ImRect window_rect(window->InnerMainRect.Min - ImVec2(1, 1), window->InnerMainRect.Max + ImVec2(1, 1));
|
ImRect window_rect(window->InnerVisibleRect.Min - ImVec2(1, 1), window->InnerVisibleRect.Max + ImVec2(1, 1));
|
||||||
//GetForegroundDrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]
|
//GetForegroundDrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]
|
||||||
if (window_rect.Contains(item_rect))
|
if (window_rect.Contains(item_rect))
|
||||||
return;
|
return;
|
||||||
@ -8769,7 +8784,7 @@ static void ImGui::NavUpdate()
|
|||||||
if (g.NavMoveRequest && g.NavMoveFromClampedRefRect && g.NavLayer == 0)
|
if (g.NavMoveRequest && g.NavMoveFromClampedRefRect && g.NavLayer == 0)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = g.NavWindow;
|
ImGuiWindow* window = g.NavWindow;
|
||||||
ImRect window_rect_rel(window->InnerMainRect.Min - window->Pos - ImVec2(1,1), window->InnerMainRect.Max - window->Pos + ImVec2(1,1));
|
ImRect window_rect_rel(window->InnerVisibleRect.Min - window->Pos - ImVec2(1,1), window->InnerVisibleRect.Max - window->Pos + ImVec2(1,1));
|
||||||
if (!window_rect_rel.Contains(window->NavRectRel[g.NavLayer]))
|
if (!window_rect_rel.Contains(window->NavRectRel[g.NavLayer]))
|
||||||
{
|
{
|
||||||
float pad = window->CalcFontSize() * 0.5f;
|
float pad = window->CalcFontSize() * 0.5f;
|
||||||
@ -8870,14 +8885,14 @@ static float ImGui::NavUpdatePageUpPageDown(int allowed_dir_flags)
|
|||||||
{
|
{
|
||||||
// Fallback manual-scroll when window has no navigable item
|
// Fallback manual-scroll when window has no navigable item
|
||||||
if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageUp], true))
|
if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageUp], true))
|
||||||
SetWindowScrollY(window, window->Scroll.y - window->InnerMainRect.GetHeight());
|
SetWindowScrollY(window, window->Scroll.y - window->InnerVisibleRect.GetHeight());
|
||||||
else if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageDown], true))
|
else if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageDown], true))
|
||||||
SetWindowScrollY(window, window->Scroll.y + window->InnerMainRect.GetHeight());
|
SetWindowScrollY(window, window->Scroll.y + window->InnerVisibleRect.GetHeight());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const ImRect& nav_rect_rel = window->NavRectRel[g.NavLayer];
|
const ImRect& nav_rect_rel = window->NavRectRel[g.NavLayer];
|
||||||
const float page_offset_y = ImMax(0.0f, window->InnerMainRect.GetHeight() - window->CalcFontSize() * 1.0f + nav_rect_rel.GetHeight());
|
const float page_offset_y = ImMax(0.0f, window->InnerVisibleRect.GetHeight() - window->CalcFontSize() * 1.0f + nav_rect_rel.GetHeight());
|
||||||
float nav_scoring_rect_offset_y = 0.0f;
|
float nav_scoring_rect_offset_y = 0.0f;
|
||||||
if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageUp], true))
|
if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageUp], true))
|
||||||
{
|
{
|
||||||
@ -14398,13 +14413,13 @@ void ImGui::ShowViewportThumbnails()
|
|||||||
|
|
||||||
void ImGui::ShowMetricsWindow(bool* p_open)
|
void ImGui::ShowMetricsWindow(bool* p_open)
|
||||||
{
|
{
|
||||||
if (!ImGui::Begin("ImGui Metrics", p_open))
|
if (!ImGui::Begin("Dear ImGui Metrics", p_open))
|
||||||
{
|
{
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum { RT_OuterRect, RT_OuterRectClipped, RT_InnerMainRect, RT_InnerWorkRect, RT_InnerWorkRectClipped, RT_ContentsRegionRect, RT_ContentsFullRect };
|
enum { RT_OuterRect, RT_OuterRectClipped, RT_InnerVisibleRect, RT_InnerWorkRect, RT_InnerWorkRectClipped, RT_ContentsRegionRect, RT_ContentsFullRect };
|
||||||
static bool show_windows_begin_order = false;
|
static bool show_windows_begin_order = false;
|
||||||
static bool show_windows_rects = false;
|
static bool show_windows_rects = false;
|
||||||
static int show_windows_rect_type = RT_InnerWorkRect;
|
static int show_windows_rect_type = RT_InnerWorkRect;
|
||||||
@ -14420,6 +14435,18 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
|
|
||||||
struct Funcs
|
struct Funcs
|
||||||
{
|
{
|
||||||
|
static ImRect GetRect(ImGuiWindow* window, int rect_type)
|
||||||
|
{
|
||||||
|
if (rect_type == RT_OuterRect) { return window->Rect(); }
|
||||||
|
else if (rect_type == RT_OuterRectClipped) { return window->OuterRectClipped; }
|
||||||
|
else if (rect_type == RT_InnerVisibleRect) { return window->InnerVisibleRect; }
|
||||||
|
else if (rect_type == RT_InnerWorkRect) { return window->InnerWorkRect; }
|
||||||
|
else if (rect_type == RT_InnerWorkRectClipped) { return window->InnerWorkRectClipped; }
|
||||||
|
else if (rect_type == RT_ContentsRegionRect) { return window->ContentsRegionRect; }
|
||||||
|
IM_ASSERT(0);
|
||||||
|
return ImRect();
|
||||||
|
}
|
||||||
|
|
||||||
static void NodeDrawList(ImGuiWindow* window, ImGuiViewportP* viewport, ImDrawList* draw_list, const char* label)
|
static void NodeDrawList(ImGuiWindow* window, ImGuiViewportP* viewport, ImDrawList* draw_list, const char* label)
|
||||||
{
|
{
|
||||||
bool node_open = ImGui::TreeNode(draw_list, "%s: '%s' %d vtx, %d indices, %d cmds", label, draw_list->_OwnerName ? draw_list->_OwnerName : "", draw_list->VtxBuffer.Size, draw_list->IdxBuffer.Size, draw_list->CmdBuffer.Size);
|
bool node_open = ImGui::TreeNode(draw_list, "%s: '%s' %d vtx, %d indices, %d cmds", label, draw_list->_OwnerName ? draw_list->_OwnerName : "", draw_list->VtxBuffer.Size, draw_list->IdxBuffer.Size, draw_list->CmdBuffer.Size);
|
||||||
@ -14448,9 +14475,10 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
|
ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
|
||||||
bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()),
|
char buf[300];
|
||||||
"Draw %4d %s vtx, tex 0x%p, clip_rect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
|
ImFormatString(buf, IM_ARRAYSIZE(buf), "Draw %4d triangles, tex 0x%p, clip_rect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
|
||||||
pcmd->ElemCount, draw_list->IdxBuffer.Size > 0 ? "indexed" : "non-indexed", (void*)(intptr_t)pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
pcmd->ElemCount/3, (void*)(intptr_t)pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
||||||
|
bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "%s", buf);
|
||||||
if (show_drawcmd_clip_rects && fg_draw_list && ImGui::IsItemHovered())
|
if (show_drawcmd_clip_rects && fg_draw_list && ImGui::IsItemHovered())
|
||||||
{
|
{
|
||||||
ImRect clip_rect = pcmd->ClipRect;
|
ImRect clip_rect = pcmd->ClipRect;
|
||||||
@ -14464,11 +14492,11 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Display individual triangles/vertices. Hover on to get the corresponding triangle highlighted.
|
// Display individual triangles/vertices. Hover on to get the corresponding triangle highlighted.
|
||||||
|
ImGui::Text("ElemCount: %d, ElemCount/3: %d, VtxOffset: +%d, IdxOffset: +%d", pcmd->ElemCount, pcmd->ElemCount/3, pcmd->VtxOffset, pcmd->IdxOffset);
|
||||||
ImGuiListClipper clipper(pcmd->ElemCount/3); // Manually coarse clip our print out of individual vertices to save CPU, only items that may be visible.
|
ImGuiListClipper clipper(pcmd->ElemCount/3); // Manually coarse clip our print out of individual vertices to save CPU, only items that may be visible.
|
||||||
while (clipper.Step())
|
while (clipper.Step())
|
||||||
for (int prim = clipper.DisplayStart, idx_i = elem_offset + clipper.DisplayStart*3; prim < clipper.DisplayEnd; prim++)
|
for (int prim = clipper.DisplayStart, idx_i = elem_offset + clipper.DisplayStart*3; prim < clipper.DisplayEnd; prim++)
|
||||||
{
|
{
|
||||||
char buf[300];
|
|
||||||
char *buf_p = buf, *buf_end = buf + IM_ARRAYSIZE(buf);
|
char *buf_p = buf, *buf_end = buf + IM_ARRAYSIZE(buf);
|
||||||
ImVec2 triangles_pos[3];
|
ImVec2 triangles_pos[3];
|
||||||
for (int n = 0; n < 3; n++, idx_i++)
|
for (int n = 0; n < 3; n++, idx_i++)
|
||||||
@ -14477,7 +14505,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImDrawVert& v = draw_list->VtxBuffer[vtx_i];
|
ImDrawVert& v = draw_list->VtxBuffer[vtx_i];
|
||||||
triangles_pos[n] = v.pos;
|
triangles_pos[n] = v.pos;
|
||||||
buf_p += ImFormatString(buf_p, buf_end - buf_p, "%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n",
|
buf_p += ImFormatString(buf_p, buf_end - buf_p, "%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n",
|
||||||
(n == 0) ? "idx" : " ", idx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);
|
(n == 0) ? "elem" : " ", idx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);
|
||||||
}
|
}
|
||||||
ImGui::Selectable(buf, false);
|
ImGui::Selectable(buf, false);
|
||||||
if (fg_draw_list && ImGui::IsItemHovered())
|
if (fg_draw_list && ImGui::IsItemHovered())
|
||||||
@ -14639,7 +14667,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImGui::Checkbox("Show windows rectangles", &show_windows_rects);
|
ImGui::Checkbox("Show windows rectangles", &show_windows_rects);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 12);
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 12);
|
||||||
show_windows_rects |= ImGui::Combo("##rects_type", &show_windows_rect_type, "OuterRect\0" "OuterRectClipped\0" "InnerMainRect\0" "InnerWorkRect\0" "InnerWorkRectClipped\0" "ContentsRegionRect\0");
|
show_windows_rects |= ImGui::Combo("##rects_type", &show_windows_rect_type, "OuterRect\0" "OuterRectClipped\0" "InnerVisibleRect\0" "InnerWorkRect\0" "InnerWorkRectClipped\0" "ContentsRegionRect\0");
|
||||||
|
if (show_windows_rects && g.NavWindow)
|
||||||
|
{
|
||||||
|
ImRect r = Funcs::GetRect(g.NavWindow, show_windows_rect_type);
|
||||||
|
ImGui::BulletText("'%s': (%.1f,%.1f) (%.1f,%.1f) Size (%.1f,%.1f)", g.NavWindow->Name, r.Min.x, r.Min.y, r.Max.x, r.Max.y, r.GetWidth(), r.GetHeight());
|
||||||
|
}
|
||||||
ImGui::Checkbox("Show clipping rectangle when hovering ImDrawCmd node", &show_drawcmd_clip_rects);
|
ImGui::Checkbox("Show clipping rectangle when hovering ImDrawCmd node", &show_drawcmd_clip_rects);
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
@ -14654,13 +14687,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImDrawList* draw_list = GetForegroundDrawList(window);
|
ImDrawList* draw_list = GetForegroundDrawList(window);
|
||||||
if (show_windows_rects)
|
if (show_windows_rects)
|
||||||
{
|
{
|
||||||
ImRect r;
|
ImRect r = Funcs::GetRect(window, show_windows_rect_type);
|
||||||
if (show_windows_rect_type == RT_OuterRect) { r = window->Rect(); }
|
|
||||||
else if (show_windows_rect_type == RT_OuterRectClipped) { r = window->OuterRectClipped; }
|
|
||||||
else if (show_windows_rect_type == RT_InnerMainRect) { r = window->InnerMainRect; }
|
|
||||||
else if (show_windows_rect_type == RT_InnerWorkRect) { r = window->InnerWorkRect; }
|
|
||||||
else if (show_windows_rect_type == RT_InnerWorkRectClipped) { r = window->InnerWorkRectClipped; }
|
|
||||||
else if (show_windows_rect_type == RT_ContentsRegionRect) { r = window->ContentsRegionRect; }
|
|
||||||
draw_list->AddRect(r.Min, r.Max, IM_COL32(255, 0, 128, 255));
|
draw_list->AddRect(r.Min, r.Max, IM_COL32(255, 0, 128, 255));
|
||||||
}
|
}
|
||||||
if (show_windows_begin_order && !(window->Flags & ImGuiWindowFlags_ChildWindow))
|
if (show_windows_begin_order && !(window->Flags & ImGuiWindowFlags_ChildWindow))
|
||||||
|
47
imgui.h
47
imgui.h
@ -48,7 +48,7 @@ Index of this file:
|
|||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.71 WIP"
|
#define IMGUI_VERSION "1.71 WIP"
|
||||||
#define IMGUI_VERSION_NUM 17002
|
#define IMGUI_VERSION_NUM 17003
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch
|
#define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch
|
||||||
#define IMGUI_HAS_DOCK 1 // Docking WIP branch
|
#define IMGUI_HAS_DOCK 1 // Docking WIP branch
|
||||||
@ -227,9 +227,9 @@ namespace ImGui
|
|||||||
IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render.
|
IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render.
|
||||||
|
|
||||||
// Demo, Debug, Information
|
// Demo, Debug, Information
|
||||||
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create demo/test window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
||||||
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create about window. display Dear ImGui version, credits and build/system information.
|
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
||||||
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create metrics/debug window. display Dear ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc.
|
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debug window. display Dear ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc.
|
||||||
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
|
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
|
||||||
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
||||||
IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts.
|
IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts.
|
||||||
@ -864,9 +864,9 @@ enum ImGuiTabBarFlags_
|
|||||||
ImGuiTabBarFlags_None = 0,
|
ImGuiTabBarFlags_None = 0,
|
||||||
ImGuiTabBarFlags_Reorderable = 1 << 0, // Allow manually dragging tabs to re-order them + New tabs are appended at the end of list
|
ImGuiTabBarFlags_Reorderable = 1 << 0, // Allow manually dragging tabs to re-order them + New tabs are appended at the end of list
|
||||||
ImGuiTabBarFlags_AutoSelectNewTabs = 1 << 1, // Automatically select new tabs when they appear
|
ImGuiTabBarFlags_AutoSelectNewTabs = 1 << 1, // Automatically select new tabs when they appear
|
||||||
ImGuiTabBarFlags_TabListPopupButton = 1 << 2,
|
ImGuiTabBarFlags_TabListPopupButton = 1 << 2, // Disable buttons to open the tab list popup
|
||||||
ImGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 3, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
|
ImGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 3, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
|
||||||
ImGuiTabBarFlags_NoTabListScrollingButtons = 1 << 4,
|
ImGuiTabBarFlags_NoTabListScrollingButtons = 1 << 4, // Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll)
|
||||||
ImGuiTabBarFlags_NoTooltip = 1 << 5, // Disable tooltips when hovering a tab
|
ImGuiTabBarFlags_NoTooltip = 1 << 5, // Disable tooltips when hovering a tab
|
||||||
ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, // Resize tabs when they don't fit
|
ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, // Resize tabs when they don't fit
|
||||||
ImGuiTabBarFlags_FittingPolicyScroll = 1 << 7, // Add scroll buttons when tabs don't fit
|
ImGuiTabBarFlags_FittingPolicyScroll = 1 << 7, // Add scroll buttons when tabs don't fit
|
||||||
@ -1068,9 +1068,10 @@ enum ImGuiConfigFlags_
|
|||||||
enum ImGuiBackendFlags_
|
enum ImGuiBackendFlags_
|
||||||
{
|
{
|
||||||
ImGuiBackendFlags_None = 0,
|
ImGuiBackendFlags_None = 0,
|
||||||
ImGuiBackendFlags_HasGamepad = 1 << 0, // Back-end supports gamepad and currently has one connected.
|
ImGuiBackendFlags_HasGamepad = 1 << 0, // Back-end Platform supports gamepad and currently has one connected.
|
||||||
ImGuiBackendFlags_HasMouseCursors = 1 << 1, // Back-end supports honoring GetMouseCursor() value to change the OS cursor shape.
|
ImGuiBackendFlags_HasMouseCursors = 1 << 1, // Back-end Platform supports honoring GetMouseCursor() value to change the OS cursor shape.
|
||||||
ImGuiBackendFlags_HasSetMousePos = 1 << 2, // Back-end supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set).
|
ImGuiBackendFlags_HasSetMousePos = 1 << 2, // Back-end Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set).
|
||||||
|
ImGuiBackendFlags_HasVtxOffset = 1 << 3, // Back-end Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bits indices.
|
||||||
|
|
||||||
// [BETA] Viewports
|
// [BETA] Viewports
|
||||||
ImGuiBackendFlags_PlatformHasViewports = 1 << 10, // Back-end Platform supports multiple viewports.
|
ImGuiBackendFlags_PlatformHasViewports = 1 << 10, // Back-end Platform supports multiple viewports.
|
||||||
@ -1864,25 +1865,31 @@ struct ImColor
|
|||||||
// The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) { cmd.UserCallback(parent_list, cmd); } else { RenderTriangles() }'
|
// The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) { cmd.UserCallback(parent_list, cmd); } else { RenderTriangles() }'
|
||||||
typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd);
|
typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd);
|
||||||
|
|
||||||
// Special Draw Callback value to request renderer back-end to reset the graphics/render state.
|
// Special Draw callback value to request renderer back-end to reset the graphics/render state.
|
||||||
// The renderer back-end needs to handle this special value, otherwise it will crash trying to call a function at this address.
|
// The renderer back-end needs to handle this special value, otherwise it will crash trying to call a function at this address.
|
||||||
// This is useful for example if you submitted callbacks which you know have altered the render state and you want it to be restored.
|
// This is useful for example if you submitted callbacks which you know have altered the render state and you want it to be restored.
|
||||||
// It is not done by default because they are many perfectly useful way of altering render state for imgui contents (e.g. changing shader/blending settings before an Image call).
|
// It is not done by default because they are many perfectly useful way of altering render state for imgui contents (e.g. changing shader/blending settings before an Image call).
|
||||||
#define ImDrawCallback_ResetRenderState (ImDrawCallback)(-1)
|
#define ImDrawCallback_ResetRenderState (ImDrawCallback)(-1)
|
||||||
|
|
||||||
// Typically, 1 command = 1 GPU draw call (unless command is a callback)
|
// Typically, 1 command = 1 GPU draw call (unless command is a callback)
|
||||||
|
// Pre 1.71 back-ends will typically ignore the VtxOffset/IdxOffset fields. When (io.BackendFlags & ImGuiBackendFlags_HasVtxOffset)
|
||||||
|
// is enabled, those fields allow us to render meshes larger than 64K vertices while keeping 16-bits indices.
|
||||||
struct ImDrawCmd
|
struct ImDrawCmd
|
||||||
{
|
{
|
||||||
unsigned int ElemCount; // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[].
|
unsigned int ElemCount; // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[].
|
||||||
ImVec4 ClipRect; // Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates
|
ImVec4 ClipRect; // Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates
|
||||||
ImTextureID TextureId; // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas.
|
ImTextureID TextureId; // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas.
|
||||||
|
unsigned int VtxOffset; // Start offset in vertex buffer. Pre-1.71 or without ImGuiBackendFlags_HasVtxOffset: always 0. With ImGuiBackendFlags_HasVtxOffset: may be >0 to support meshes larger than 64K vertices with 16-bits indices.
|
||||||
|
unsigned int IdxOffset; // Start offset in index buffer. Always equal to sum of ElemCount drawn so far.
|
||||||
ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
|
ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
|
||||||
void* UserCallbackData; // The draw callback code can access this.
|
void* UserCallbackData; // The draw callback code can access this.
|
||||||
|
|
||||||
ImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = ClipRect.z = ClipRect.w = 0.0f; TextureId = (ImTextureID)NULL; UserCallback = NULL; UserCallbackData = NULL; }
|
ImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = ClipRect.z = ClipRect.w = 0.0f; TextureId = (ImTextureID)NULL; VtxOffset = IdxOffset = 0; UserCallback = NULL; UserCallbackData = NULL; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Vertex index (override with '#define ImDrawIdx unsigned int' in imconfig.h)
|
// Vertex index
|
||||||
|
// (to allow large meshes with 16-bits indices: set 'io.BackendFlags |= ImGuiBackendFlags_HasVtxOffset' and handle ImDrawCmd::VtxOffset in the renderer back-end)
|
||||||
|
// (to use 32-bits indices: override with '#define ImDrawIdx unsigned int' in imconfig.h)
|
||||||
#ifndef ImDrawIdx
|
#ifndef ImDrawIdx
|
||||||
typedef unsigned short ImDrawIdx;
|
typedef unsigned short ImDrawIdx;
|
||||||
#endif
|
#endif
|
||||||
@ -1928,7 +1935,8 @@ enum ImDrawListFlags_
|
|||||||
{
|
{
|
||||||
ImDrawListFlags_None = 0,
|
ImDrawListFlags_None = 0,
|
||||||
ImDrawListFlags_AntiAliasedLines = 1 << 0, // Lines are anti-aliased (*2 the number of triangles for 1.0f wide line, otherwise *3 the number of triangles)
|
ImDrawListFlags_AntiAliasedLines = 1 << 0, // Lines are anti-aliased (*2 the number of triangles for 1.0f wide line, otherwise *3 the number of triangles)
|
||||||
ImDrawListFlags_AntiAliasedFill = 1 << 1 // Filled shapes have anti-aliased edges (*2 the number of vertices)
|
ImDrawListFlags_AntiAliasedFill = 1 << 1, // Filled shapes have anti-aliased edges (*2 the number of vertices)
|
||||||
|
ImDrawListFlags_AllowVtxOffset = 1 << 2 // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'io.BackendFlags & ImGuiBackendFlags_HasVtxOffset' is enabled.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Draw command list
|
// Draw command list
|
||||||
@ -1948,7 +1956,8 @@ struct ImDrawList
|
|||||||
// [Internal, used while building lists]
|
// [Internal, used while building lists]
|
||||||
const ImDrawListSharedData* _Data; // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context)
|
const ImDrawListSharedData* _Data; // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context)
|
||||||
const char* _OwnerName; // Pointer to owner window's name for debugging
|
const char* _OwnerName; // Pointer to owner window's name for debugging
|
||||||
unsigned int _VtxCurrentIdx; // [Internal] == VtxBuffer.Size
|
unsigned int _VtxCurrentOffset; // [Internal] Always 0 unless 'Flags & ImDrawListFlags_AllowVtxOffset'.
|
||||||
|
unsigned int _VtxCurrentIdx; // [Internal] Generally == VtxBuffer.Size unless we are past 64K vertices, in which case this gets reset to 0.
|
||||||
ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
||||||
ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
|
||||||
ImVector<ImVec4> _ClipRectStack; // [Internal]
|
ImVector<ImVec4> _ClipRectStack; // [Internal]
|
||||||
@ -2171,11 +2180,14 @@ struct ImFontAtlas
|
|||||||
IMGUI_API const ImWchar* GetGlyphRangesVietnamese(); // Default + Vietname characters
|
IMGUI_API const ImWchar* GetGlyphRangesVietnamese(); // Default + Vietname characters
|
||||||
|
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
// Custom Rectangles/Glyphs API
|
// [BETA] Custom Rectangles/Glyphs API
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
|
|
||||||
// You can request arbitrary rectangles to be packed into the atlas, for your own purposes. After calling Build(), you can query the rectangle position and render your pixels.
|
// You can request arbitrary rectangles to be packed into the atlas, for your own purposes.
|
||||||
// You can also request your rectangles to be mapped as font glyph (given a font + Unicode point), so you can render e.g. custom colorful icons and use them as regular glyphs.
|
// After calling Build(), you can query the rectangle position and render your pixels.
|
||||||
|
// You can also request your rectangles to be mapped as font glyph (given a font + Unicode point),
|
||||||
|
// so you can render e.g. custom colorful icons and use them as regular glyphs.
|
||||||
|
// Read misc/fonts/README.txt for more details about using colorful icons.
|
||||||
struct CustomRect
|
struct CustomRect
|
||||||
{
|
{
|
||||||
unsigned int ID; // Input // User ID. Use <0x10000 to map into a font glyph, >=0x10000 for other/internal/custom texture data.
|
unsigned int ID; // Input // User ID. Use <0x10000 to map into a font glyph, >=0x10000 for other/internal/custom texture data.
|
||||||
@ -2187,7 +2199,6 @@ struct ImFontAtlas
|
|||||||
CustomRect() { ID = 0xFFFFFFFF; Width = Height = 0; X = Y = 0xFFFF; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0,0); Font = NULL; }
|
CustomRect() { ID = 0xFFFFFFFF; Width = Height = 0; X = Y = 0xFFFF; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0,0); Font = NULL; }
|
||||||
bool IsPacked() const { return X != 0xFFFF; }
|
bool IsPacked() const { return X != 0xFFFF; }
|
||||||
};
|
};
|
||||||
|
|
||||||
IMGUI_API int AddCustomRectRegular(unsigned int id, int width, int height); // Id needs to be >= 0x10000. Id >= 0x80000000 are reserved for ImGui and ImDrawList
|
IMGUI_API int AddCustomRectRegular(unsigned int id, int width, int height); // Id needs to be >= 0x10000. Id >= 0x80000000 are reserved for ImGui and ImDrawList
|
||||||
IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0,0)); // Id needs to be < 0x10000 to register a rectangle to map into a specific font.
|
IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0,0)); // Id needs to be < 0x10000 to register a rectangle to map into a specific font.
|
||||||
const CustomRect* GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
const CustomRect* GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
||||||
|
@ -263,7 +263,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::SetNextWindowSize(ImVec2(550, 680), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(550, 680), ImGuiCond_FirstUseEver);
|
||||||
|
|
||||||
// Main body of the Demo window starts here.
|
// Main body of the Demo window starts here.
|
||||||
if (!ImGui::Begin("ImGui Demo", p_open, window_flags))
|
if (!ImGui::Begin("Dear ImGui Demo", p_open, window_flags))
|
||||||
{
|
{
|
||||||
// Early out if the window is collapsed, as an optimization.
|
// Early out if the window is collapsed, as an optimization.
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
@ -401,6 +401,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasGamepad);
|
ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasGamepad);
|
||||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseCursors);
|
ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseCursors);
|
||||||
ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasSetMousePos);
|
ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasSetMousePos);
|
||||||
|
ImGui::CheckboxFlags("io.BackendFlags: HasVtxOffset", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasVtxOffset);
|
||||||
ImGui::CheckboxFlags("io.BackendFlags: PlatformHasViewports", (unsigned int *)&backend_flags, ImGuiBackendFlags_PlatformHasViewports);
|
ImGui::CheckboxFlags("io.BackendFlags: PlatformHasViewports", (unsigned int *)&backend_flags, ImGuiBackendFlags_PlatformHasViewports);
|
||||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseHoveredViewport", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseHoveredViewport);
|
ImGui::CheckboxFlags("io.BackendFlags: HasMouseHoveredViewport", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseHoveredViewport);
|
||||||
ImGui::CheckboxFlags("io.BackendFlags: RendererHasViewports", (unsigned int *)&backend_flags, ImGuiBackendFlags_RendererHasViewports);
|
ImGui::CheckboxFlags("io.BackendFlags: RendererHasViewports", (unsigned int *)&backend_flags, ImGuiBackendFlags_RendererHasViewports);
|
||||||
@ -1290,8 +1291,8 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::Text("HSV encoded colors");
|
ImGui::Text("HSV encoded colors");
|
||||||
ImGui::SameLine(); HelpMarker("By default, colors are given to ColorEdit and ColorPicker in RGB, but ImGuiColorEditFlags_InputHSV allows you to store colors as HSV and pass them to ColorEdit and ColorPicker as HSV. This comes with the added benefit that you can manipulate hue values with the picker even when saturation or value are zero.");
|
ImGui::SameLine(); HelpMarker("By default, colors are given to ColorEdit and ColorPicker in RGB, but ImGuiColorEditFlags_InputHSV allows you to store colors as HSV and pass them to ColorEdit and ColorPicker as HSV. This comes with the added benefit that you can manipulate hue values with the picker even when saturation or value are zero.");
|
||||||
ImGui::Text("Color widget with InputHSV:");
|
ImGui::Text("Color widget with InputHSV:");
|
||||||
ImGui::ColorEdit4("HSV shown as HSV##1", (float*)&color_stored_as_hsv, ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_InputHSV | ImGuiColorEditFlags_Float);
|
ImGui::ColorEdit4("HSV shown as RGB##1", (float*)&color_stored_as_hsv, ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_InputHSV | ImGuiColorEditFlags_Float);
|
||||||
ImGui::ColorEdit4("HSV shown as RGB##1", (float*)&color_stored_as_hsv, ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_InputHSV | ImGuiColorEditFlags_Float);
|
ImGui::ColorEdit4("HSV shown as HSV##1", (float*)&color_stored_as_hsv, ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_InputHSV | ImGuiColorEditFlags_Float);
|
||||||
ImGui::DragFloat4("Raw HSV values", (float*)&color_stored_as_hsv, 0.01f, 0.0f, 1.0f);
|
ImGui::DragFloat4("Raw HSV values", (float*)&color_stored_as_hsv, 0.01f, 0.0f, 1.0f);
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -2630,7 +2631,7 @@ static void ShowDemoWindowColumns()
|
|||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
if (open1)
|
if (open1)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < 5; y++)
|
for (int y = 0; y < 3; y++)
|
||||||
{
|
{
|
||||||
bool open2 = ImGui::TreeNode((void*)(intptr_t)y, "Node%d.%d", x, y);
|
bool open2 = ImGui::TreeNode((void*)(intptr_t)y, "Node%d.%d", x, y);
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
@ -2938,6 +2939,7 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
|||||||
if (io.BackendFlags & ImGuiBackendFlags_HasGamepad) ImGui::Text(" HasGamepad");
|
if (io.BackendFlags & ImGuiBackendFlags_HasGamepad) ImGui::Text(" HasGamepad");
|
||||||
if (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) ImGui::Text(" HasMouseCursors");
|
if (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) ImGui::Text(" HasMouseCursors");
|
||||||
if (io.BackendFlags & ImGuiBackendFlags_HasSetMousePos) ImGui::Text(" HasSetMousePos");
|
if (io.BackendFlags & ImGuiBackendFlags_HasSetMousePos) ImGui::Text(" HasSetMousePos");
|
||||||
|
if (io.BackendFlags & ImGuiBackendFlags_HasVtxOffset) ImGui::Text(" HasVtxOffset");
|
||||||
if (io.BackendFlags & ImGuiBackendFlags_PlatformHasViewports) ImGui::Text(" PlatformHasViewports");
|
if (io.BackendFlags & ImGuiBackendFlags_PlatformHasViewports) ImGui::Text(" PlatformHasViewports");
|
||||||
if (io.BackendFlags & ImGuiBackendFlags_HasMouseHoveredViewport)ImGui::Text(" HasMouseHoveredViewport");
|
if (io.BackendFlags & ImGuiBackendFlags_HasMouseHoveredViewport)ImGui::Text(" HasMouseHoveredViewport");
|
||||||
if (io.BackendFlags & ImGuiBackendFlags_RendererHasViewports) ImGui::Text(" RendererHasViewports");
|
if (io.BackendFlags & ImGuiBackendFlags_RendererHasViewports) ImGui::Text(" RendererHasViewports");
|
||||||
|
@ -354,6 +354,7 @@ ImDrawListSharedData::ImDrawListSharedData()
|
|||||||
FontSize = 0.0f;
|
FontSize = 0.0f;
|
||||||
CurveTessellationTol = 0.0f;
|
CurveTessellationTol = 0.0f;
|
||||||
ClipRectFullscreen = ImVec4(-8192.0f, -8192.0f, +8192.0f, +8192.0f);
|
ClipRectFullscreen = ImVec4(-8192.0f, -8192.0f, +8192.0f, +8192.0f);
|
||||||
|
InitialFlags = ImDrawListFlags_None;
|
||||||
|
|
||||||
// Const data
|
// Const data
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(CircleVtx12); i++)
|
for (int i = 0; i < IM_ARRAYSIZE(CircleVtx12); i++)
|
||||||
@ -368,7 +369,8 @@ void ImDrawList::Clear()
|
|||||||
CmdBuffer.resize(0);
|
CmdBuffer.resize(0);
|
||||||
IdxBuffer.resize(0);
|
IdxBuffer.resize(0);
|
||||||
VtxBuffer.resize(0);
|
VtxBuffer.resize(0);
|
||||||
Flags = ImDrawListFlags_AntiAliasedLines | ImDrawListFlags_AntiAliasedFill;
|
Flags = _Data->InitialFlags;
|
||||||
|
_VtxCurrentOffset = 0;
|
||||||
_VtxCurrentIdx = 0;
|
_VtxCurrentIdx = 0;
|
||||||
_VtxWritePtr = NULL;
|
_VtxWritePtr = NULL;
|
||||||
_IdxWritePtr = NULL;
|
_IdxWritePtr = NULL;
|
||||||
@ -421,6 +423,8 @@ void ImDrawList::AddDrawCmd()
|
|||||||
ImDrawCmd draw_cmd;
|
ImDrawCmd draw_cmd;
|
||||||
draw_cmd.ClipRect = GetCurrentClipRect();
|
draw_cmd.ClipRect = GetCurrentClipRect();
|
||||||
draw_cmd.TextureId = GetCurrentTextureId();
|
draw_cmd.TextureId = GetCurrentTextureId();
|
||||||
|
draw_cmd.VtxOffset = _VtxCurrentOffset;
|
||||||
|
draw_cmd.IdxOffset = IdxBuffer.Size;
|
||||||
|
|
||||||
IM_ASSERT(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z && draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w);
|
IM_ASSERT(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z && draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w);
|
||||||
CmdBuffer.push_back(draw_cmd);
|
CmdBuffer.push_back(draw_cmd);
|
||||||
@ -609,6 +613,14 @@ void ImDrawList::ChannelsSetCurrent(int idx)
|
|||||||
// NB: this can be called with negative count for removing primitives (as long as the result does not underflow)
|
// NB: this can be called with negative count for removing primitives (as long as the result does not underflow)
|
||||||
void ImDrawList::PrimReserve(int idx_count, int vtx_count)
|
void ImDrawList::PrimReserve(int idx_count, int vtx_count)
|
||||||
{
|
{
|
||||||
|
// Large mesh support (when enabled)
|
||||||
|
if (sizeof(ImDrawIdx) == 2 && (_VtxCurrentIdx + vtx_count >= (1 << 16)) && (Flags & ImDrawListFlags_AllowVtxOffset))
|
||||||
|
{
|
||||||
|
_VtxCurrentOffset = VtxBuffer.Size;
|
||||||
|
_VtxCurrentIdx = 0;
|
||||||
|
AddDrawCmd();
|
||||||
|
}
|
||||||
|
|
||||||
ImDrawCmd& draw_cmd = CmdBuffer.Data[CmdBuffer.Size-1];
|
ImDrawCmd& draw_cmd = CmdBuffer.Data[CmdBuffer.Size-1];
|
||||||
draw_cmd.ElemCount += idx_count;
|
draw_cmd.ElemCount += idx_count;
|
||||||
|
|
||||||
@ -2955,7 +2967,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
|||||||
draw_list->CmdBuffer[draw_list->CmdBuffer.Size-1].ElemCount -= (idx_expected_size - draw_list->IdxBuffer.Size);
|
draw_list->CmdBuffer[draw_list->CmdBuffer.Size-1].ElemCount -= (idx_expected_size - draw_list->IdxBuffer.Size);
|
||||||
draw_list->_VtxWritePtr = vtx_write;
|
draw_list->_VtxWritePtr = vtx_write;
|
||||||
draw_list->_IdxWritePtr = idx_write;
|
draw_list->_IdxWritePtr = idx_write;
|
||||||
draw_list->_VtxCurrentIdx = (unsigned int)draw_list->VtxBuffer.Size;
|
draw_list->_VtxCurrentIdx = vtx_current_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -358,14 +358,21 @@ enum ImGuiColumnsFlags_
|
|||||||
ImGuiColumnsFlags_GrowParentContentsSize= 1 << 4 // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.
|
ImGuiColumnsFlags_GrowParentContentsSize= 1 << 4 // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Extend ImGuiSelectableFlags_
|
||||||
enum ImGuiSelectableFlagsPrivate_
|
enum ImGuiSelectableFlagsPrivate_
|
||||||
{
|
{
|
||||||
// NB: need to be in sync with last value of ImGuiSelectableFlags_
|
// NB: need to be in sync with last value of ImGuiSelectableFlags_
|
||||||
ImGuiSelectableFlags_NoHoldingActiveID = 1 << 10,
|
ImGuiSelectableFlags_NoHoldingActiveID = 1 << 20,
|
||||||
ImGuiSelectableFlags_PressedOnClick = 1 << 11,
|
ImGuiSelectableFlags_PressedOnClick = 1 << 21,
|
||||||
ImGuiSelectableFlags_PressedOnRelease = 1 << 12,
|
ImGuiSelectableFlags_PressedOnRelease = 1 << 22,
|
||||||
ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 13, // FIXME: We may be able to remove this (added in 6251d379 for menus)
|
ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 23, // FIXME: We may be able to remove this (added in 6251d379 for menus)
|
||||||
ImGuiSelectableFlags_AllowItemOverlap = 1 << 14
|
ImGuiSelectableFlags_AllowItemOverlap = 1 << 24
|
||||||
|
};
|
||||||
|
|
||||||
|
// Extend ImGuiTreeNodeFlags_
|
||||||
|
enum ImGuiTreeNodeFlagsPrivate_
|
||||||
|
{
|
||||||
|
ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 20
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiSeparatorFlags_
|
enum ImGuiSeparatorFlags_
|
||||||
@ -745,6 +752,7 @@ struct IMGUI_API ImDrawListSharedData
|
|||||||
float FontSize; // Current/default font size (optional, for simplified AddText overload)
|
float FontSize; // Current/default font size (optional, for simplified AddText overload)
|
||||||
float CurveTessellationTol;
|
float CurveTessellationTol;
|
||||||
ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen()
|
ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen()
|
||||||
|
ImDrawListFlags InitialFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
|
||||||
|
|
||||||
// Const data
|
// Const data
|
||||||
// FIXME: Bake rounded corners fill/borders in atlas
|
// FIXME: Bake rounded corners fill/borders in atlas
|
||||||
@ -1408,8 +1416,8 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImVec2 Size; // Current size (==SizeFull or collapsed title bar size)
|
ImVec2 Size; // Current size (==SizeFull or collapsed title bar size)
|
||||||
ImVec2 SizeFull; // Size when non collapsed
|
ImVec2 SizeFull; // Size when non collapsed
|
||||||
ImVec2 SizeFullAtLastBegin; // Copy of SizeFull at the end of Begin. This is the reference value we'll use on the next frame to decide if we need scrollbars.
|
ImVec2 SizeFullAtLastBegin; // Copy of SizeFull at the end of Begin. This is the reference value we'll use on the next frame to decide if we need scrollbars.
|
||||||
ImVec2 SizeContents; // Size of contents (== extents reach of the drawing cursor) from previous frame. Include decoration, window title, border, menu, etc.
|
ImVec2 SizeContents; // Size of contents (== extents reach of the drawing cursor) from previous frame. FIXME: Include decoration, window title, border, menu, etc. Ideally should remove them from this value?
|
||||||
ImVec2 SizeContentsExplicit; // Size of contents explicitly set by the user via SetNextWindowContentSize()
|
ImVec2 SizeContentsExplicit; // Size of contents explicitly set by the user via SetNextWindowContentSize(). EXCLUDE decorations. Making this not consistent with the above!
|
||||||
ImVec2 WindowPadding; // Window padding at the time of begin.
|
ImVec2 WindowPadding; // Window padding at the time of begin.
|
||||||
float WindowRounding; // Window rounding at the time of begin.
|
float WindowRounding; // Window rounding at the time of begin.
|
||||||
float WindowBorderSize; // Window border size at the time of begin.
|
float WindowBorderSize; // Window border size at the time of begin.
|
||||||
@ -1453,7 +1461,7 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
|
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
|
||||||
ImRect ClipRect; // Current clipping rectangle. = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.
|
ImRect ClipRect; // Current clipping rectangle. = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.
|
||||||
ImRect OuterRectClipped; // == WindowRect just after setup in Begin(). == window->Rect() for root window.
|
ImRect OuterRectClipped; // == WindowRect just after setup in Begin(). == window->Rect() for root window.
|
||||||
ImRect InnerMainRect; //
|
ImRect InnerVisibleRect; // Inner visible rectangle
|
||||||
ImRect InnerWorkRect; // == InnerMainRect minus WindowPadding.x
|
ImRect InnerWorkRect; // == InnerMainRect minus WindowPadding.x
|
||||||
ImRect InnerWorkRectClipped; // == InnerMainRect minus WindowPadding.x, clipped within viewport or parent clip rect.
|
ImRect InnerWorkRectClipped; // == InnerMainRect minus WindowPadding.x, clipped within viewport or parent clip rect.
|
||||||
ImVec2ih HitTestHoleSize, HitTestHoleOffset;
|
ImVec2ih HitTestHoleSize, HitTestHoleOffset;
|
||||||
@ -1527,6 +1535,7 @@ struct ImGuiItemHoveredDataBackup
|
|||||||
// Tab bar, tab item
|
// Tab bar, tab item
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Extend ImGuiTabBarFlags_
|
||||||
enum ImGuiTabBarFlagsPrivate_
|
enum ImGuiTabBarFlagsPrivate_
|
||||||
{
|
{
|
||||||
ImGuiTabBarFlags_DockNode = 1 << 20, // Part of a dock node [we don't use this in the master branch but it facilitate branch syncing to keep this around]
|
ImGuiTabBarFlags_DockNode = 1 << 20, // Part of a dock node [we don't use this in the master branch but it facilitate branch syncing to keep this around]
|
||||||
@ -1534,6 +1543,7 @@ enum ImGuiTabBarFlagsPrivate_
|
|||||||
ImGuiTabBarFlags_SaveSettings = 1 << 22 // FIXME: Settings are handled by the docking system, this only request the tab bar to mark settings dirty when reordering tabs
|
ImGuiTabBarFlags_SaveSettings = 1 << 22 // FIXME: Settings are handled by the docking system, this only request the tab bar to mark settings dirty when reordering tabs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Extend ImGuiTabItemFlags_
|
||||||
enum ImGuiTabItemFlagsPrivate_
|
enum ImGuiTabItemFlagsPrivate_
|
||||||
{
|
{
|
||||||
ImGuiTabItemFlags_NoCloseButton = 1 << 20, // Store whether p_open is set or not, which we need to recompute WidthContents during layout.
|
ImGuiTabItemFlags_NoCloseButton = 1 << 20, // Store whether p_open is set or not, which we need to recompute WidthContents during layout.
|
||||||
|
@ -919,14 +919,14 @@ void ImGui::Scrollbar(ImGuiAxis axis)
|
|||||||
ImRect bb;
|
ImRect bb;
|
||||||
if (axis == ImGuiAxis_X)
|
if (axis == ImGuiAxis_X)
|
||||||
{
|
{
|
||||||
bb.Min = ImVec2(window->InnerMainRect.Min.x, window->InnerMainRect.Max.y);
|
bb.Min = ImVec2(window->InnerVisibleRect.Min.x, window->InnerVisibleRect.Max.y);
|
||||||
bb.Max = ImVec2(window->InnerMainRect.Max.x, outer_rect.Max.y - window->WindowBorderSize);
|
bb.Max = ImVec2(window->InnerVisibleRect.Max.x, outer_rect.Max.y - window->WindowBorderSize);
|
||||||
rounding_corners |= ImDrawCornerFlags_BotLeft;
|
rounding_corners |= ImDrawCornerFlags_BotLeft;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bb.Min = ImVec2(window->InnerMainRect.Max.x, window->InnerMainRect.Min.y);
|
bb.Min = ImVec2(window->InnerVisibleRect.Max.x, window->InnerVisibleRect.Min.y);
|
||||||
bb.Max = ImVec2(outer_rect.Max.x - window->WindowBorderSize, window->InnerMainRect.Max.y);
|
bb.Max = ImVec2(outer_rect.Max.x - window->WindowBorderSize, window->InnerVisibleRect.Max.y);
|
||||||
rounding_corners |= ((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0;
|
rounding_corners |= ((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0;
|
||||||
}
|
}
|
||||||
ScrollbarEx(bb, id, axis, &window->Scroll[axis], window->SizeFull[axis] - other_scrollbar_size, window->SizeContents[axis], rounding_corners);
|
ScrollbarEx(bb, id, axis, &window->Scroll[axis], window->SizeFull[axis] - other_scrollbar_size, window->SizeContents[axis], rounding_corners);
|
||||||
@ -4292,7 +4292,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|||||||
Spacing();
|
Spacing();
|
||||||
}
|
}
|
||||||
ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags__InputMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar;
|
ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags__InputMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar;
|
||||||
ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;
|
ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__DisplayMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;
|
||||||
SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes?
|
SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes?
|
||||||
value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x);
|
value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x);
|
||||||
EndPopup();
|
EndPopup();
|
||||||
@ -5263,6 +5263,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|||||||
RenderFrame(frame_bb.Min, frame_bb.Max, col, true, style.FrameRounding);
|
RenderFrame(frame_bb.Min, frame_bb.Max, col, true, style.FrameRounding);
|
||||||
RenderNavHighlight(frame_bb, id, nav_highlight_flags);
|
RenderNavHighlight(frame_bb, id, nav_highlight_flags);
|
||||||
RenderArrow(frame_bb.Min + ImVec2(padding.x, text_base_offset_y), is_open ? ImGuiDir_Down : ImGuiDir_Right, 1.0f);
|
RenderArrow(frame_bb.Min + ImVec2(padding.x, text_base_offset_y), is_open ? ImGuiDir_Down : ImGuiDir_Right, 1.0f);
|
||||||
|
if (flags & ImGuiTreeNodeFlags_ClipLabelForTrailingButton)
|
||||||
|
frame_bb.Max.x -= g.FontSize + style.FramePadding.x;
|
||||||
if (g.LogEnabled)
|
if (g.LogEnabled)
|
||||||
{
|
{
|
||||||
// NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here.
|
// NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here.
|
||||||
@ -5389,7 +5391,8 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
ImGuiID id = window->GetID(label);
|
ImGuiID id = window->GetID(label);
|
||||||
bool is_open = TreeNodeBehavior(id, flags | ImGuiTreeNodeFlags_CollapsingHeader | (p_open ? ImGuiTreeNodeFlags_AllowItemOverlap : 0), label);
|
flags |= ImGuiTreeNodeFlags_CollapsingHeader | (p_open ? ImGuiTreeNodeFlags_AllowItemOverlap | ImGuiTreeNodeFlags_ClipLabelForTrailingButton : 0);
|
||||||
|
bool is_open = TreeNodeBehavior(id, flags, label);
|
||||||
if (p_open)
|
if (p_open)
|
||||||
{
|
{
|
||||||
// Create a small overlapping close button
|
// Create a small overlapping close button
|
||||||
@ -5398,8 +5401,9 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiItemHoveredDataBackup last_item_backup;
|
ImGuiItemHoveredDataBackup last_item_backup;
|
||||||
float button_size = g.FontSize;
|
float button_size = g.FontSize;
|
||||||
ImVec2 button_pos = ImVec2(ImMin(window->DC.LastItemRect.Max.x, window->ClipRect.Max.x) - g.Style.FramePadding.x * 2.0f - button_size, window->DC.LastItemRect.Min.y);
|
float button_x = ImMax(window->DC.LastItemRect.Min.x, window->DC.LastItemRect.Max.x - g.Style.FramePadding.x * 2.0f - button_size);
|
||||||
if (CloseButton(window->GetID((void*)((intptr_t)id + 1)), button_pos))
|
float button_y = window->DC.LastItemRect.Min.y;
|
||||||
|
if (CloseButton(window->GetID((void*)((intptr_t)id + 1)), ImVec2(button_x, button_y)))
|
||||||
*p_open = false;
|
*p_open = false;
|
||||||
last_item_backup.Restore();
|
last_item_backup.Restore();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ If you have other loading/merging/adding fonts, you can post on the Dear ImGui "
|
|||||||
- Fonts Loading Instructions
|
- Fonts Loading Instructions
|
||||||
- FreeType rasterizer, Small font sizes
|
- FreeType rasterizer, Small font sizes
|
||||||
- Building Custom Glyph Ranges
|
- Building Custom Glyph Ranges
|
||||||
|
- Using custom colorful icons
|
||||||
- Embedding Fonts in Source Code
|
- Embedding Fonts in Source Code
|
||||||
- Credits/Licences for fonts included in this folder
|
- Credits/Licences for fonts included in this folder
|
||||||
- Fonts Links
|
- Fonts Links
|
||||||
@ -198,6 +199,43 @@ For example: for a game where your script is known, if you can feed your entire
|
|||||||
io.Fonts->Build(); // Build the atlas while 'ranges' is still in scope and not deleted.
|
io.Fonts->Build(); // Build the atlas while 'ranges' is still in scope and not deleted.
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
USING CUSTOM COLORFUL ICONS
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
(This is a BETA api, use if you are familiar with dear imgui and with your rendering back-end)
|
||||||
|
|
||||||
|
You can use the ImFontAtlas::AddCustomRect() and ImFontAtlas::AddCustomRectFontGlyph() api to register rectangles
|
||||||
|
that will be packed into the font atlas texture. Register them before building the atlas, then call Build().
|
||||||
|
You can then use ImFontAtlas::GetCustomRectByIndex(int) to query the position/size of your rectangle within the
|
||||||
|
texture, and blit/copy any graphics data of your choice into those rectangles.
|
||||||
|
|
||||||
|
Pseudo-code:
|
||||||
|
|
||||||
|
// Add font, then register one custom 13x13 rectangle mapped to glyph 'a' of this font
|
||||||
|
ImFont* font = io.Fonts->AddFontDefault();
|
||||||
|
int rect_id = io.Fonts->AddCustomRectFontGlyph(font, 'a', 13, 13, 13+1);
|
||||||
|
|
||||||
|
// Build atlas
|
||||||
|
io.Fonts->Build();
|
||||||
|
|
||||||
|
// Retrieve texture in RGBA format
|
||||||
|
unsigned char* tex_pixels = NULL;
|
||||||
|
int tex_width, tex_height;
|
||||||
|
io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_width, &tex_height);
|
||||||
|
|
||||||
|
// Fill the custom rectangle with red pixels (in reality you would draw/copy your bitmap data here)
|
||||||
|
if (const ImFontAtlas::CustomRect* rect = io.Fonts->GetCustomRectByIndex(rect_id))
|
||||||
|
{
|
||||||
|
for (int y = 0; y < rect->Height; y++)
|
||||||
|
{
|
||||||
|
ImU32* p = (ImU32*)tex_pixels + (rect->Y + y) * tex_width + (rect->X);
|
||||||
|
for (int x = rect->Width; x > 0; x--)
|
||||||
|
*p++ = IM_COL32(255, 0, 0, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
EMBEDDING FONTS IN SOURCE CODE
|
EMBEDDING FONTS IN SOURCE CODE
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user