|
@@ -1764,6 +1764,7 @@ enum ImGuiCol_
|
|
ImGuiCol_NavWindowingHighlight, // Highlight window when using CTRL+TAB
|
|
ImGuiCol_NavWindowingHighlight, // Highlight window when using CTRL+TAB
|
|
ImGuiCol_NavWindowingDimBg, // Darken/colorize entire screen behind the CTRL+TAB window list, when active
|
|
ImGuiCol_NavWindowingDimBg, // Darken/colorize entire screen behind the CTRL+TAB window list, when active
|
|
ImGuiCol_ModalWindowDimBg, // Darken/colorize entire screen behind a modal window, when one is active
|
|
ImGuiCol_ModalWindowDimBg, // Darken/colorize entire screen behind a modal window, when one is active
|
|
|
|
+ ImGuiCol_WindowShadow, // Window shadows
|
|
ImGuiCol_COUNT,
|
|
ImGuiCol_COUNT,
|
|
|
|
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
@@ -2303,6 +2304,10 @@ struct ImGuiStyle
|
|
float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
|
|
float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
|
|
float CircleTessellationMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.
|
|
float CircleTessellationMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.
|
|
|
|
|
|
|
|
+ float WindowShadowSize; // Size (in pixels) of window shadows. Set this to zero to disable shadows.
|
|
|
|
+ float WindowShadowOffsetDist; // Offset distance (in pixels) of window shadows from casting window.
|
|
|
|
+ float WindowShadowOffsetAngle; // Offset angle of window shadows from casting window (0.0f = left, 0.5f*PI = bottom, 1.0f*PI = right, 1.5f*PI = top).
|
|
|
|
+
|
|
// Colors
|
|
// Colors
|
|
ImVec4 Colors[ImGuiCol_COUNT];
|
|
ImVec4 Colors[ImGuiCol_COUNT];
|
|
|
|
|
|
@@ -3189,6 +3194,7 @@ enum ImDrawFlags_
|
|
ImDrawFlags_RoundCornersAll = ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight,
|
|
ImDrawFlags_RoundCornersAll = ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight,
|
|
ImDrawFlags_RoundCornersDefault_ = ImDrawFlags_RoundCornersAll, // Default to ALL corners if none of the _RoundCornersXX flags are specified.
|
|
ImDrawFlags_RoundCornersDefault_ = ImDrawFlags_RoundCornersAll, // Default to ALL corners if none of the _RoundCornersXX flags are specified.
|
|
ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone,
|
|
ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone,
|
|
|
|
+ ImDrawFlags_ShadowCutOutShapeBackground = 1 << 9, // Do not render the shadow shape under the objects to be shadowed to save on fill-rate or facilitate blending. Slower on CPU.
|
|
};
|
|
};
|
|
|
|
|
|
// Flags for ImDrawList instance. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly.
|
|
// Flags for ImDrawList instance. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly.
|
|
@@ -3287,6 +3293,23 @@ struct ImDrawList
|
|
IMGUI_API void AddImageQuad(ImTextureRef tex_ref, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& uv1 = ImVec2(0, 0), const ImVec2& uv2 = ImVec2(1, 0), const ImVec2& uv3 = ImVec2(1, 1), const ImVec2& uv4 = ImVec2(0, 1), ImU32 col = IM_COL32_WHITE);
|
|
IMGUI_API void AddImageQuad(ImTextureRef tex_ref, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& uv1 = ImVec2(0, 0), const ImVec2& uv2 = ImVec2(1, 0), const ImVec2& uv3 = ImVec2(1, 1), const ImVec2& uv4 = ImVec2(0, 1), ImU32 col = IM_COL32_WHITE);
|
|
IMGUI_API void AddImageRounded(ImTextureRef tex_ref, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawFlags flags = 0);
|
|
IMGUI_API void AddImageRounded(ImTextureRef tex_ref, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawFlags flags = 0);
|
|
|
|
|
|
|
|
+ // Shadows primitives
|
|
|
|
+ // [BETA] API
|
|
|
|
+ // - Add shadow for a object, with min/max or center/radius describing the object extents, and offset shifting the shadow.
|
|
|
|
+ // - Rounding parameters refer to the object itself, not the shadow!
|
|
|
|
+ // - By default, the area under the object is filled, because this is simpler to process.
|
|
|
|
+ // Using the ImDrawFlags_ShadowCutOutShapeBackground flag makes the function not render this area and leave a hole under the object.
|
|
|
|
+ // - Shadows w/ fill under the object: a bit faster for CPU, more pixels rendered, visible/darkening if used behind a transparent shape.
|
|
|
|
+ // Typically used by: small, frequent objects, opaque objects, transparent objects if shadow darkening isn't an issue.
|
|
|
|
+ // - Shadows w/ hole under the object: a bit slower for CPU, less pixels rendered, no difference if used behind a transparent shape.
|
|
|
|
+ // Typically used by: large, infrequent objects, transparent objects if exact blending/color matter.
|
|
|
|
+ // - FIXME-SHADOWS: 'offset' + ImDrawFlags_ShadowCutOutShapeBackground are not currently supported together with AddShadowCircle(), AddShadowConvexPoly(), AddShadowNGon().
|
|
|
|
+ #define IMGUI_HAS_SHADOWS 1
|
|
|
|
+ IMGUI_API void AddShadowRect(const ImVec2& obj_min, const ImVec2& obj_max, ImU32 shadow_col, float shadow_thickness, const ImVec2& shadow_offset, ImDrawFlags flags = 0, float obj_rounding = 0.0f);
|
|
|
|
+ IMGUI_API void AddShadowCircle(const ImVec2& obj_center, float obj_radius, ImU32 shadow_col, float shadow_thickness, const ImVec2& shadow_offset, ImDrawFlags flags = 0, int obj_num_segments = 12);
|
|
|
|
+ IMGUI_API void AddShadowConvexPoly(const ImVec2* points, int points_count, ImU32 shadow_col, float shadow_thickness, const ImVec2& shadow_offset, ImDrawFlags flags = 0);
|
|
|
|
+ IMGUI_API void AddShadowNGon(const ImVec2& obj_center, float obj_radius, ImU32 shadow_col, float shadow_thickness, const ImVec2& shadow_offset, ImDrawFlags flags, int obj_num_segments);
|
|
|
|
+
|
|
// Stateful path API, add points then finish with PathFillConvex() or PathStroke()
|
|
// Stateful path API, add points then finish with PathFillConvex() or PathStroke()
|
|
// - Important: filled shapes must always use clockwise winding order! The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing.
|
|
// - Important: filled shapes must always use clockwise winding order! The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing.
|
|
// so e.g. 'PathArcTo(center, radius, PI * -0.5f, PI)' is ok, whereas 'PathArcTo(center, radius, PI, PI * -0.5f)' won't have correct anti-aliasing when followed by PathFillConvex().
|
|
// so e.g. 'PathArcTo(center, radius, PI * -0.5f, PI)' is ok, whereas 'PathArcTo(center, radius, PI, PI * -0.5f)' won't have correct anti-aliasing when followed by PathFillConvex().
|
|
@@ -3475,6 +3498,24 @@ struct ImTextureData
|
|
// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFontGlyphRangesBuilder, ImFont)
|
|
// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFontGlyphRangesBuilder, ImFont)
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
+// [Internal] Shadow texture baking config
|
|
|
|
+struct ImFontAtlasShadowTexConfig
|
|
|
|
+{
|
|
|
|
+ int TexCornerSize; // Size of the corner areas.
|
|
|
|
+ int TexEdgeSize; // Size of the edge areas (and by extension the center). Changing this is normally unnecessary.
|
|
|
|
+ float TexFalloffPower; // The power factor for the shadow falloff curve.
|
|
|
|
+ float TexDistanceFieldOffset; // How much to offset the distance field by (allows over/under-shadowing, potentially useful for accommodating rounded corners on the "casting" shape).
|
|
|
|
+ bool TexBlur; // Do we want to Gaussian blur the shadow texture?
|
|
|
|
+
|
|
|
|
+ inline ImFontAtlasShadowTexConfig() { memset(this, 0, sizeof(*this)); }
|
|
|
|
+ IMGUI_API void SetupDefaults();
|
|
|
|
+ int GetRectTexPadding() const { return 2; } // Number of pixels of padding to add to the rectangular texture to avoid sampling artifacts at the edges.
|
|
|
|
+ int CalcRectTexSize() const { return TexCornerSize + TexEdgeSize + GetRectTexPadding(); } // The size of the texture area required for the actual 2x2 rectangle shadow texture (after the redundant corners have been removed). Padding is required here to avoid sampling artifacts at the edge adjoining the removed corners. int CalcConvexTexWidth() const; // The width of the texture area required for the convex shape shadow texture.
|
|
|
|
+ int GetConvexTexPadding() const { return 8; } // Number of pixels of padding to add to the convex shape texture to avoid sampling artifacts at the edges. This also acts as padding for the expanded corner triangles.
|
|
|
|
+ int CalcConvexTexWidth() const; // The width of the texture area required for the convex shape shadow texture.
|
|
|
|
+ int CalcConvexTexHeight() const; // The height of the texture area required for the convex shape shadow texture.
|
|
|
|
+};
|
|
|
|
+
|
|
// A font input/source (we may rename this to ImFontSource in the future)
|
|
// A font input/source (we may rename this to ImFontSource in the future)
|
|
struct ImFontConfig
|
|
struct ImFontConfig
|
|
{
|
|
{
|
|
@@ -3721,6 +3762,11 @@ struct ImFontAtlas
|
|
int RefCount; // Number of contexts using this atlas
|
|
int RefCount; // Number of contexts using this atlas
|
|
ImGuiContext* OwnerContext; // Context which own the atlas will be in charge of updating and destroying it.
|
|
ImGuiContext* OwnerContext; // Context which own the atlas will be in charge of updating and destroying it.
|
|
|
|
|
|
|
|
+ // [Internal] Shadow data
|
|
|
|
+ int ShadowRectIds[2]; // IDs of rect for shadow textures
|
|
|
|
+ ImVec4 ShadowRectUvs[10]; // UV coordinates for shadow textures, 9 for the rectangle shadows and the final entry for the convex shape shadows
|
|
|
|
+ ImFontAtlasShadowTexConfig ShadowTexConfig; // Shadow texture baking config
|
|
|
|
+
|
|
// [Obsolete]
|
|
// [Obsolete]
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
// Legacy: You can 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. --> Prefer using a custom ImFontLoader.
|
|
// Legacy: You can 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. --> Prefer using a custom ImFontLoader.
|