1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-13 18:50:58 +01:00

Shadows: Fix broken shadows due to zero-clear added in 9417acc2

This commit is contained in:
ocornut 2021-08-24 18:59:10 +02:00 committed by ocornut
parent a2ee47852b
commit 63c15058dc
2 changed files with 4 additions and 2 deletions

View File

@ -3249,7 +3249,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.

View File

@ -373,7 +373,7 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst)
// [SECTION] ImFontAtlasShadowTexConfig
//-----------------------------------------------------------------------------
ImFontAtlasShadowTexConfig::ImFontAtlasShadowTexConfig()
void ImFontAtlasShadowTexConfig::SetupDefaults()
{
TexCornerSize = 16;
TexEdgeSize = 1;
@ -3176,6 +3176,7 @@ ImFontAtlas::ImFontAtlas()
TexGlyphPadding = 1;
PackIdMouseCursors = PackIdLines = -1;
ShadowRectIds[0] = ShadowRectIds[1] = -1;
ShadowTexConfig.SetupDefaults();
}
ImFontAtlas::~ImFontAtlas()