mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-21 19:37:01 +00:00
Shadows: Fix broken shadows due to zero-clear added in 9417acc2
This commit is contained in:
parent
0b9ede2697
commit
1d933fbbd8
3
imgui.h
3
imgui.h
@ -2675,7 +2675,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).
|
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?
|
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 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 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 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.
|
||||||
|
@ -377,7 +377,7 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst)
|
|||||||
// [SECTION] ImFontAtlasShadowTexConfig
|
// [SECTION] ImFontAtlasShadowTexConfig
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImFontAtlasShadowTexConfig::ImFontAtlasShadowTexConfig()
|
void ImFontAtlasShadowTexConfig::SetupDefaults()
|
||||||
{
|
{
|
||||||
TexCornerSize = 16;
|
TexCornerSize = 16;
|
||||||
TexEdgeSize = 1;
|
TexEdgeSize = 1;
|
||||||
@ -2725,6 +2725,7 @@ ImFontAtlas::ImFontAtlas()
|
|||||||
TexGlyphPadding = 1;
|
TexGlyphPadding = 1;
|
||||||
PackIdMouseCursors = PackIdLines = -1;
|
PackIdMouseCursors = PackIdLines = -1;
|
||||||
ShadowRectIds[0] = ShadowRectIds[1] = -1;
|
ShadowRectIds[0] = ShadowRectIds[1] = -1;
|
||||||
|
ShadowTexConfig.SetupDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImFontAtlas::~ImFontAtlas()
|
ImFontAtlas::~ImFontAtlas()
|
||||||
|
Loading…
Reference in New Issue
Block a user