mirror of
https://github.com/ocornut/imgui.git
synced 2025-04-13 00:33:07 +00:00
Shadows: Fix broken shadows due to zero-clear added in 9417acc2
This commit is contained in:
parent
c9729b4388
commit
52bea181f6
2 changed files with 4 additions and 2 deletions
3
imgui.h
3
imgui.h
|
@ -3292,7 +3292,8 @@ struct ImFontAtlasShadowTexConfig
|
|||
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?
|
||||
|
||||
IMGUI_API ImFontAtlasShadowTexConfig();
|
||||
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.
|
||||
|
|
|
@ -376,7 +376,7 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst)
|
|||
// [SECTION] ImFontAtlasShadowTexConfig
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ImFontAtlasShadowTexConfig::ImFontAtlasShadowTexConfig()
|
||||
void ImFontAtlasShadowTexConfig::SetupDefaults()
|
||||
{
|
||||
TexCornerSize = 16;
|
||||
TexEdgeSize = 1;
|
||||
|
@ -3224,6 +3224,7 @@ ImFontAtlas::ImFontAtlas()
|
|||
TexGlyphPadding = 1;
|
||||
PackIdMouseCursors = PackIdLines = -1;
|
||||
ShadowRectIds[0] = ShadowRectIds[1] = -1;
|
||||
ShadowTexConfig.SetupDefaults();
|
||||
}
|
||||
|
||||
ImFontAtlas::~ImFontAtlas()
|
||||
|
|
Loading…
Add table
Reference in a new issue