fix: Remove unnecessary vertex expansion

This commit is contained in:
mob-sakai
2025-04-03 18:19:44 +09:00
parent 909281c66b
commit 974e3e8769
3 changed files with 17 additions and 21 deletions
+10 -11
View File
@@ -749,37 +749,36 @@ namespace Coffee.UIEffects
UIVertexUtil.Flip(verts, flipHorizontal, flipVertical);
}
private Vector2 GetExpandSize(bool canModifyShape)
private Vector4 GetExpandSize(bool canModifyShape)
{
if (!canModifyShape) return Vector2.zero;
if (!canModifyShape) return Vector4.zero;
var expandSize = Vector2.zero;
var expandSize = Vector4.zero;
switch (samplingFilter)
{
case SamplingFilter.BlurFast:
expandSize.x += 10;
expandSize.y += 10;
expandSize += Vector4.one * 10;
break;
case SamplingFilter.BlurMedium:
expandSize.x += 15;
expandSize.y += 15;
expandSize += Vector4.one * 15;
break;
case SamplingFilter.BlurDetail:
expandSize.x += 20;
expandSize.y += 20;
expandSize += Vector4.one * 20;
break;
case SamplingFilter.RgbShift:
expandSize.x += 40;
expandSize.y += 40;
expandSize.z += 40;
break;
}
switch (transitionFilter)
{
case TransitionFilter.Melt:
case TransitionFilter.Burn:
expandSize.y += 40;
break;
case TransitionFilter.Burn:
expandSize.w += 40;
break;
}
return expandSize;
@@ -72,9 +72,9 @@ namespace Coffee.UIEffects
{
}
public virtual Vector4 ModifyExpandSize(Graphic graphic, Vector2 expandSize)
public virtual Vector4 ModifyExpandSize(Graphic graphic, Vector4 expandSize)
{
return new Vector4(expandSize.x, expandSize.y, expandSize.x, expandSize.y);
return expandSize;
}
private static readonly Func<UIVertex, UIVertex, UIVertex, float, UIVertex> s_OnLerpVertex =
+5 -8
View File
@@ -33,25 +33,22 @@ namespace Coffee.UIEffects
return false;
}
public override Vector4 ModifyExpandSize(Graphic graphic, Vector2 expandSize)
public override Vector4 ModifyExpandSize(Graphic graphic, Vector4 expandSize)
{
var image = graphic as Image;
var ret = new Vector4(expandSize.x, expandSize.y, expandSize.x, expandSize.y);
if (image
if (graphic is Image image
&& image.type == Image.Type.Filled
&& image.fillMethod == Image.FillMethod.Radial360
&& image.fillAmount <= 0.5f)
{
ret[(image.fillOrigin + (image.fillClockwise ? 2 : 0)) % 4] = 0;
expandSize[(image.fillOrigin + (image.fillClockwise ? 2 : 0)) % 4] = 0;
if (image.fillAmount <= 0.25f)
{
ret[(image.fillOrigin + 3) % 4] = 0;
expandSize[(image.fillOrigin + 3) % 4] = 0;
}
}
return ret;
return expandSize;
}
}
}