1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-27 17:10:57 +01:00

Revert "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 reverts commit 597c024904.
This commit is contained in:
omar 2019-06-06 00:59:07 +02:00
parent 597c024904
commit 480d57e6a2
5 changed files with 10 additions and 23 deletions

View File

@ -35,10 +35,6 @@ 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

View File

@ -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: 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'
// 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; }
CUSTOMVERTEX* vtx_dst;
ImDrawIdx* idx_dst;
if (g_pVB->Lock(0, (UINT)(draw_data->TotalVtxCount * sizeof(CUSTOMVERTEX)), (void**)&vtx_dst, D3DLOCK_DISCARD) < 0)

View File

@ -68,9 +68,6 @@
// 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

View File

@ -369,8 +369,6 @@ 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
View File

@ -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. You may override layout with a #define.
struct ImDrawVert; // A single vertex (pos + uv + col = 20 bytes by default. Override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT)
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,23 +1803,19 @@ typedef unsigned short ImDrawIdx;
#endif
// Vertex 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
#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
struct ImDrawVert
{
ImVec2 pos;
ImVec2 uv;
ImU32 col;
};
#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!
#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). This is because ImVec2/ImU32 are likely not declared a the time you'd want to set your type up.
// 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
// For use by ImDrawListSplitter.