mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-24 00:26:36 +00:00
Changed syntax for (very rarely used) IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT mechanism, instead you only need to '#define ImDrawVert MyDrawVert' to use this feature, avoiding the need to declare the entire structure within an awkward macro. Using the old macro will now error with a message pointing you to the new method. (#38, #103, #1172, #1231, #2489)
This commit is contained in:
parent
c96f2c4057
commit
597c024904
@ -35,6 +35,10 @@ HOW TO UPDATE?
|
||||
Breaking Changes:
|
||||
- IO: changed AddInputCharacter(unsigned short c) signature to AddInputCharacter(unsigned int c).
|
||||
- Renamed SetNextTreeNodeOpen() to SetNextItemOpen(). Kept inline redirection function (will obsolete).
|
||||
- Changed syntax for (very rarely used) IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT mechanism, instead you only
|
||||
need to '#define ImDrawVert MyDrawVert' to use this feature, avoiding the need to declare the entire
|
||||
structure within an awkward macro. Using the old macro will now error with a message pointing you
|
||||
to the new method. (#38, #103, #1172, #1231, #2489)
|
||||
|
||||
Other Changes:
|
||||
- Window: clarified behavior of SetNextWindowContentSize(). Content size is defined as the size available
|
||||
|
@ -138,8 +138,8 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
|
||||
|
||||
// Copy and convert all vertices into a single contiguous buffer, convert colors to DX9 default format.
|
||||
// FIXME-OPT: This is a waste of resource, the ideal is to use imconfig.h and
|
||||
// 1) to avoid repacking colors: #define IMGUI_USE_BGRA_PACKED_COLOR
|
||||
// 2) to avoid repacking vertices: #define IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT struct ImDrawVert { ImVec2 pos; float z; ImU32 col; ImVec2 uv; }
|
||||
// 1) to avoid repacking colors: use '#define IMGUI_USE_BGRA_PACKED_COLOR'
|
||||
// 2) to avoid repacking vertices: use 'struct ImDrawVertDx9 { ImVec2 pos; float z; ImU32 col; ImVec2 uv; }' + '#define ImDrawVert ImDrawVertDx9'
|
||||
CUSTOMVERTEX* vtx_dst;
|
||||
ImDrawIdx* idx_dst;
|
||||
if (g_pVB->Lock(0, (UINT)(draw_data->TotalVtxCount * sizeof(CUSTOMVERTEX)), (void**)&vtx_dst, D3DLOCK_DISCARD) < 0)
|
||||
|
@ -68,6 +68,9 @@
|
||||
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
|
||||
//#define ImDrawIdx unsigned int
|
||||
|
||||
//---- Override ImDrawVert layout (see comments near ImDrawVert declaration)
|
||||
//#define ImDrawVert MyDrawVert
|
||||
|
||||
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
|
||||
/*
|
||||
namespace ImGui
|
||||
|
@ -369,6 +369,8 @@ CODE
|
||||
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2019/06/05 (1.71) - changed syntax for (very rarely used) IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT mechanism. instead you only need to '#define ImDrawVert MyDrawVert' to use this feature,
|
||||
avoiding the need to declare the entire structure within an awkward macro. Using the old macro will now error and show a message pointing you to the you method.
|
||||
- 2019/05/13 (1.71) - renamed SetNextTreeNodeOpen() to SetNextItemOpen(). Kept inline redirection function (will obsolete).
|
||||
- 2019/05/11 (1.71) - changed io.AddInputCharacter(unsigned short c) signature to io.AddInputCharacter(unsigned int c).
|
||||
- 2019/04/29 (1.70) - improved ImDrawList thick strokes (>1.0f) preserving correct thickness up to 90 degrees angles (e.g. rectangles). If you have custom rendering using thick lines, they will appear thicker now.
|
||||
|
20
imgui.h
20
imgui.h
@ -97,7 +97,7 @@ struct ImDrawData; // All draw command lists required to render
|
||||
struct ImDrawList; // A single draw command list (generally one per window, conceptually you may see this as a dynamic "mesh" builder)
|
||||
struct ImDrawListSharedData; // Data shared among multiple draw lists (typically owned by parent ImGui context, but you may create one yourself)
|
||||
struct ImDrawListSplitter; // Helper to split a draw list into different layers which can be drawn into out of order, then flattened back.
|
||||
struct ImDrawVert; // A single vertex (pos + uv + col = 20 bytes by default. Override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT)
|
||||
struct ImDrawVert; // A single vertex (pos + uv + col = 20 bytes by default. You may override layout with a #define.
|
||||
struct ImFont; // Runtime data for a single font within a parent ImFontAtlas
|
||||
struct ImFontAtlas; // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader
|
||||
struct ImFontConfig; // Configuration data when adding a font or merging fonts
|
||||
@ -1803,19 +1803,23 @@ typedef unsigned short ImDrawIdx;
|
||||
#endif
|
||||
|
||||
// Vertex layout
|
||||
#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
|
||||
// (You can override the vertex format layout by using e.g. #define ImDrawVert MyDrawVert in imconfig.h
|
||||
// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields
|
||||
// as needed to simplify integration in your engine. IMPORTANT: dear imgui DOES NOT CLEAR THE STRUCTURE AND DOESN"T CALL ITS CONSTRUCTOR,
|
||||
// so any field other than pos/uv/col will be uninitialized. If you add extra fields (such as a Z coordinate) you will need to either
|
||||
// ignore them, either set them up yourself.)
|
||||
#ifndef ImDrawVert
|
||||
struct ImDrawVert
|
||||
{
|
||||
ImVec2 pos;
|
||||
ImVec2 uv;
|
||||
ImU32 col;
|
||||
};
|
||||
#else
|
||||
// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h
|
||||
// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine.
|
||||
// The type has to be described within the macro (you can either declare the struct or use a typedef)
|
||||
// NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM.
|
||||
IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
|
||||
#endif
|
||||
|
||||
// We previously used IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT that was expanded in this file. Instead please use '#define ImDrawVert MyDrawVert' [OBSOLETED in 1.71]
|
||||
#if defined(IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT)
|
||||
#error Please use '#define ImDrawVert MyDrawVert' instead!
|
||||
#endif
|
||||
|
||||
// For use by ImDrawListSplitter.
|
||||
|
Loading…
Reference in New Issue
Block a user